/src/mozilla-central/media/mtransport/ipc/StunAddrsRequestChild.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
3 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | | |
5 | | #include "StunAddrsRequestChild.h" |
6 | | |
7 | | #include "mozilla/net/NeckoChild.h" |
8 | | #include "nsIEventTarget.h" |
9 | | |
10 | | using namespace mozilla::ipc; |
11 | | |
12 | | namespace mozilla { |
13 | | namespace net { |
14 | | |
15 | | StunAddrsRequestChild::StunAddrsRequestChild( |
16 | | StunAddrsListener* listener, |
17 | | nsIEventTarget* mainThreadEventTarget) |
18 | | : mListener(listener) |
19 | 0 | { |
20 | 0 | if (mainThreadEventTarget) { |
21 | 0 | gNeckoChild->SetEventTargetForActor(this, mainThreadEventTarget); |
22 | 0 | } |
23 | 0 |
|
24 | 0 | gNeckoChild->SendPStunAddrsRequestConstructor(this); |
25 | 0 | // IPDL holds a reference until IPDL channel gets destroyed |
26 | 0 | AddIPDLReference(); |
27 | 0 | } |
28 | | |
29 | | mozilla::ipc::IPCResult |
30 | | StunAddrsRequestChild::RecvOnStunAddrsAvailable(const NrIceStunAddrArray& addrs) |
31 | 0 | { |
32 | 0 | if (mListener) { |
33 | 0 | mListener->OnStunAddrsAvailable(addrs); |
34 | 0 | } |
35 | 0 | return IPC_OK(); |
36 | 0 | } |
37 | | |
38 | | void |
39 | | StunAddrsRequestChild::Cancel() |
40 | 0 | { |
41 | 0 | mListener = nullptr; |
42 | 0 | } |
43 | | |
44 | | NS_IMPL_ADDREF(StunAddrsRequestChild) |
45 | | NS_IMPL_RELEASE(StunAddrsRequestChild) |
46 | | |
47 | | NS_IMPL_ADDREF(StunAddrsListener) |
48 | | NS_IMPL_RELEASE(StunAddrsListener) |
49 | | |
50 | | } // namespace net |
51 | | } // namespace mozilla |