/src/mozilla-central/dom/midi/MIDIPlatformRunnables.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 "mozilla/dom/MIDIPlatformRunnables.h" |
8 | | #include "mozilla/dom/MIDIPlatformService.h" |
9 | | #include "mozilla/dom/MIDIPortParent.h" |
10 | | #include "mozilla/ipc/BackgroundParent.h" |
11 | | |
12 | | namespace mozilla { |
13 | | namespace dom { |
14 | | |
15 | | NS_IMETHODIMP |
16 | | MIDIBackgroundRunnable::Run() |
17 | 0 | { |
18 | 0 | AssertIsOnBackgroundThread(); |
19 | 0 | if (!MIDIPlatformService::IsRunning()) { |
20 | 0 | return NS_OK; |
21 | 0 | } |
22 | 0 | RunInternal(); |
23 | 0 | return NS_OK; |
24 | 0 | } |
25 | | |
26 | | void |
27 | | ReceiveRunnable::RunInternal() |
28 | 0 | { |
29 | 0 | MIDIPlatformService::Get()->CheckAndReceive(mPortId, mMsgs); |
30 | 0 | } |
31 | | |
32 | | void |
33 | | AddPortRunnable::RunInternal() |
34 | 0 | { |
35 | 0 | MIDIPlatformService::Get()->AddPortInfo(mPortInfo); |
36 | 0 | } |
37 | | |
38 | | void |
39 | | RemovePortRunnable::RunInternal() |
40 | 0 | { |
41 | 0 | MIDIPlatformService::Get()->RemovePortInfo(mPortInfo); |
42 | 0 | } |
43 | | |
44 | | void |
45 | | SetStatusRunnable::RunInternal() |
46 | 0 | { |
47 | 0 | MIDIPlatformService::Get()->UpdateStatus(mPortId, mState, mConnection); |
48 | 0 | } |
49 | | |
50 | | void |
51 | | SendPortListRunnable::RunInternal() |
52 | 0 | { |
53 | 0 | // Unlike other runnables, SendPortListRunnable should just exit quietly if |
54 | 0 | // the service has died. |
55 | 0 | if (!MIDIPlatformService::IsRunning()) { |
56 | 0 | return; |
57 | 0 | } |
58 | 0 | MIDIPlatformService::Get()->SendPortList(); |
59 | 0 | } |
60 | | |
61 | | } // namespace dom |
62 | | } // namespace mozilla |