/src/mozilla-central/dom/clients/manager/ClientSourceOpParent.cpp
Line | Count | Source (jump to first uncovered line) |
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 "ClientSourceOpParent.h" |
8 | | |
9 | | #include "ClientSourceParent.h" |
10 | | |
11 | | namespace mozilla { |
12 | | namespace dom { |
13 | | |
14 | | using mozilla::ipc::IPCResult; |
15 | | |
16 | | void |
17 | | ClientSourceOpParent::ActorDestroy(ActorDestroyReason aReason) |
18 | 0 | { |
19 | 0 | if (mPromise) { |
20 | 0 | mPromise->Reject(NS_ERROR_ABORT, __func__); |
21 | 0 | mPromise = nullptr; |
22 | 0 | } |
23 | 0 | } |
24 | | |
25 | | IPCResult |
26 | | ClientSourceOpParent::Recv__delete__(const ClientOpResult& aResult) |
27 | 0 | { |
28 | 0 | if (aResult.type() == ClientOpResult::Tnsresult && |
29 | 0 | NS_FAILED(aResult.get_nsresult())) { |
30 | 0 |
|
31 | 0 | // If a control message fails then clear the controller from |
32 | 0 | // the ClientSourceParent. We eagerly marked it controlled at |
33 | 0 | // the start of the operation. |
34 | 0 | if (mArgs.type() == ClientOpConstructorArgs::TClientControlledArgs) { |
35 | 0 | auto source = static_cast<ClientSourceParent*>(Manager()); |
36 | 0 | if (source) { |
37 | 0 | source->ClearController(); |
38 | 0 | } |
39 | 0 | } |
40 | 0 |
|
41 | 0 | mPromise->Reject(aResult.get_nsresult(), __func__); |
42 | 0 | mPromise = nullptr; |
43 | 0 | return IPC_OK(); |
44 | 0 | } |
45 | 0 |
|
46 | 0 | mPromise->Resolve(aResult, __func__); |
47 | 0 | mPromise = nullptr; |
48 | 0 | return IPC_OK(); |
49 | 0 | } |
50 | | |
51 | | ClientSourceOpParent::ClientSourceOpParent(const ClientOpConstructorArgs& aArgs, |
52 | | ClientOpPromise::Private* aPromise) |
53 | | : mArgs(aArgs) |
54 | | , mPromise(aPromise) |
55 | 0 | { |
56 | 0 | MOZ_DIAGNOSTIC_ASSERT(mPromise); |
57 | 0 | } |
58 | | |
59 | | ClientSourceOpParent::~ClientSourceOpParent() |
60 | 0 | { |
61 | 0 | MOZ_DIAGNOSTIC_ASSERT(!mPromise); |
62 | 0 | } |
63 | | |
64 | | } // namespace dom |
65 | | } // namespace mozilla |