Bug 1472338: part 2) Change `clipboard.readText()` to read from the clipboard asynchr...
[gecko.git] / dom / midi / MIDIPlatformRunnables.cpp
blobfddf6aef87751dbb5800968adc7bc84c5d9f0b50
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/. */
7 #include "mozilla/dom/MIDIPlatformRunnables.h"
8 #include "mozilla/dom/MIDIPlatformService.h"
9 #include "mozilla/dom/MIDIPortParent.h"
10 #include "mozilla/ipc/BackgroundParent.h"
12 namespace mozilla::dom {
14 NS_IMETHODIMP
15 MIDIBackgroundRunnable::Run() {
16 ::mozilla::ipc::AssertIsOnBackgroundThread();
17 if (!MIDIPlatformService::IsRunning()) {
18 return NS_OK;
20 RunInternal();
21 return NS_OK;
24 void ReceiveRunnable::RunInternal() {
25 MIDIPlatformService::Get()->CheckAndReceive(mPortId, mMsgs);
28 void AddPortRunnable::RunInternal() {
29 MIDIPlatformService::Get()->AddPortInfo(mPortInfo);
32 void RemovePortRunnable::RunInternal() {
33 MIDIPlatformService::Get()->RemovePortInfo(mPortInfo);
36 void SetStatusRunnable::RunInternal() {
37 MIDIPlatformService::Get()->UpdateStatus(mPort, mState, mConnection);
40 void SendPortListRunnable::RunInternal() {
41 // Unlike other runnables, SendPortListRunnable should just exit quietly if
42 // the service has died.
43 if (!MIDIPlatformService::IsRunning()) {
44 return;
46 MIDIPlatformService::Get()->SendPortList();
49 } // namespace mozilla::dom