/src/mozilla-central/dom/midi/MIDIManagerChild.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
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 "MIDIManagerChild.h" |
8 | | #include "mozilla/dom/MIDIAccessManager.h" |
9 | | |
10 | | using namespace mozilla::dom; |
11 | | |
12 | | MIDIManagerChild::MIDIManagerChild() |
13 | | : mShutdown(false) |
14 | 0 | { |
15 | 0 | } |
16 | | |
17 | | mozilla::ipc::IPCResult |
18 | | MIDIManagerChild::RecvMIDIPortListUpdate(const MIDIPortList& aPortList) |
19 | 0 | { |
20 | 0 | MOZ_ASSERT(NS_IsMainThread()); |
21 | 0 | if (mShutdown) { |
22 | 0 | return IPC_OK(); |
23 | 0 | } |
24 | 0 | MOZ_ASSERT(MIDIAccessManager::IsRunning()); |
25 | 0 | MIDIAccessManager::Get()->Update(aPortList); |
26 | 0 | return IPC_OK(); |
27 | 0 | } |
28 | | |
29 | | void |
30 | | MIDIManagerChild::SetActorAlive() |
31 | 0 | { |
32 | 0 | // IPC Channels for MIDIManagers are created and managed by MIDIAccessManager, |
33 | 0 | // so once the actor is created, we'll need to add a reference to keep it |
34 | 0 | // alive until BackgroundChildImpl kills it. |
35 | 0 | AddRef(); |
36 | 0 | } |
37 | | |
38 | | void |
39 | | MIDIManagerChild::Shutdown() |
40 | 0 | { |
41 | 0 | MOZ_ASSERT(!mShutdown); |
42 | 0 | mShutdown = true; |
43 | 0 | SendShutdown(); |
44 | 0 | } |