/src/mozilla-central/dom/clients/manager/ClientHandleChild.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 "ClientHandleChild.h" |
8 | | |
9 | | #include "ClientHandleOpChild.h" |
10 | | #include "mozilla/dom/ClientIPCTypes.h" |
11 | | |
12 | | namespace mozilla { |
13 | | namespace dom { |
14 | | |
15 | | using mozilla::ipc::IPCResult; |
16 | | |
17 | | IPCResult |
18 | | ClientHandleChild::RecvExecutionReady(const IPCClientInfo& aClientInfo) |
19 | 0 | { |
20 | 0 | if (mHandle) { |
21 | 0 | mHandle->ExecutionReady(ClientInfo(aClientInfo)); |
22 | 0 | } |
23 | 0 | return IPC_OK(); |
24 | 0 | } |
25 | | |
26 | | void |
27 | | ClientHandleChild::ActorDestroy(ActorDestroyReason aReason) |
28 | 0 | { |
29 | 0 | if (mHandle) { |
30 | 0 | mHandle->RevokeActor(this); |
31 | 0 |
|
32 | 0 | // Revoking the actor link should automatically cause the owner |
33 | 0 | // to call RevokeOwner() as well. |
34 | 0 | MOZ_DIAGNOSTIC_ASSERT(!mHandle); |
35 | 0 | } |
36 | 0 | } |
37 | | |
38 | | PClientHandleOpChild* |
39 | | ClientHandleChild::AllocPClientHandleOpChild(const ClientOpConstructorArgs& aArgs) |
40 | 0 | { |
41 | 0 | MOZ_ASSERT_UNREACHABLE("ClientHandleOpChild must be explicitly constructed."); |
42 | 0 | return nullptr; |
43 | 0 | } |
44 | | |
45 | | bool |
46 | | ClientHandleChild::DeallocPClientHandleOpChild(PClientHandleOpChild* aActor) |
47 | 0 | { |
48 | 0 | delete aActor; |
49 | 0 | return true; |
50 | 0 | } |
51 | | |
52 | | ClientHandleChild::ClientHandleChild() |
53 | | : mHandle(nullptr) |
54 | | , mTeardownStarted(false) |
55 | 0 | { |
56 | 0 | } |
57 | | |
58 | | void |
59 | | ClientHandleChild::SetOwner(ClientThing<ClientHandleChild>* aThing) |
60 | 0 | { |
61 | 0 | MOZ_DIAGNOSTIC_ASSERT(!mHandle); |
62 | 0 | mHandle = static_cast<ClientHandle*>(aThing); |
63 | 0 | MOZ_DIAGNOSTIC_ASSERT(mHandle); |
64 | 0 | } |
65 | | |
66 | | void |
67 | | ClientHandleChild::RevokeOwner(ClientThing<ClientHandleChild>* aThing) |
68 | 0 | { |
69 | 0 | MOZ_DIAGNOSTIC_ASSERT(mHandle); |
70 | 0 | MOZ_DIAGNOSTIC_ASSERT(mHandle == static_cast<ClientHandle*>(aThing)); |
71 | 0 | mHandle = nullptr; |
72 | 0 | } |
73 | | |
74 | | void |
75 | | ClientHandleChild::MaybeStartTeardown() |
76 | 0 | { |
77 | 0 | if (mTeardownStarted) { |
78 | 0 | return; |
79 | 0 | } |
80 | 0 | mTeardownStarted = true; |
81 | 0 | Unused << SendTeardown(); |
82 | 0 | } |
83 | | |
84 | | } // namespace dom |
85 | | } // namespace mozilla |