/src/mozilla-central/dom/gamepad/ipc/GamepadTestChannelChild.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 file, |
5 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "GamepadTestChannelChild.h" |
8 | | |
9 | | namespace mozilla { |
10 | | namespace dom { |
11 | | |
12 | | void |
13 | | GamepadTestChannelChild::AddPromise(const uint32_t& aID, Promise* aPromise) |
14 | 0 | { |
15 | 0 | MOZ_ASSERT(!mPromiseList.Get(aID, nullptr)); |
16 | 0 | mPromiseList.Put(aID, aPromise); |
17 | 0 | } |
18 | | |
19 | | mozilla::ipc::IPCResult |
20 | | GamepadTestChannelChild::RecvReplyGamepadIndex(const uint32_t& aID, |
21 | | const uint32_t& aIndex) |
22 | 0 | { |
23 | 0 | RefPtr<Promise> p; |
24 | 0 | if (!mPromiseList.Get(aID, getter_AddRefs(p))) { |
25 | 0 | MOZ_CRASH("We should always have a promise."); |
26 | 0 | } |
27 | 0 |
|
28 | 0 | p->MaybeResolve(aIndex); |
29 | 0 | mPromiseList.Remove(aID); |
30 | 0 | return IPC_OK(); |
31 | 0 | } |
32 | | |
33 | | } // namespace dom |
34 | | } // namespace mozilla |