Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / clients / manager / ClientHandleOpChild.cpp
blob0370d5512b35b1a35f7ead3b43edd7778005e6a9
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/. */
7 #include "ClientHandleOpChild.h"
9 #include "ClientHandle.h"
11 namespace mozilla::dom {
13 void ClientHandleOpChild::ActorDestroy(ActorDestroyReason aReason) {
14 mClientHandle = nullptr;
15 CopyableErrorResult rv;
16 rv.ThrowAbortError("Client load aborted");
17 mRejectCallback(rv);
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();
28 mResolveCallback(aResult);
29 return IPC_OK();
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);
44 } // namespace mozilla::dom