tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ClientHandleOpChild.cpp (1484B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include "ClientHandleOpChild.h"
      8 
      9 #include "ClientHandle.h"
     10 
     11 namespace mozilla::dom {
     12 
     13 void ClientHandleOpChild::ActorDestroy(ActorDestroyReason aReason) {
     14  mClientHandle = nullptr;
     15  CopyableErrorResult rv;
     16  rv.ThrowAbortError("Client load aborted");
     17  mRejectCallback(rv);
     18 }
     19 
     20 mozilla::ipc::IPCResult ClientHandleOpChild::Recv__delete__(
     21    const ClientOpResult& aResult) {
     22  mClientHandle = nullptr;
     23  if (aResult.type() == ClientOpResult::TCopyableErrorResult &&
     24      aResult.get_CopyableErrorResult().Failed()) {
     25    mRejectCallback(aResult.get_CopyableErrorResult());
     26    return IPC_OK();
     27  }
     28  mResolveCallback(aResult);
     29  return IPC_OK();
     30 }
     31 
     32 ClientHandleOpChild::ClientHandleOpChild(
     33    ClientHandle* aClientHandle, const ClientOpConstructorArgs& aArgs,
     34    const ClientOpCallback&& aResolveCallback,
     35    const ClientOpCallback&& aRejectCallback)
     36    : mClientHandle(aClientHandle),
     37      mResolveCallback(std::move(aResolveCallback)),
     38      mRejectCallback(std::move(aRejectCallback)) {
     39  MOZ_DIAGNOSTIC_ASSERT(mClientHandle);
     40  MOZ_DIAGNOSTIC_ASSERT(mResolveCallback);
     41  MOZ_DIAGNOSTIC_ASSERT(mRejectCallback);
     42 }
     43 
     44 }  // namespace mozilla::dom