mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1626555 - Add dom/midi
to the list of non-unified-build-compatible directories. r=sg
Depends on D95137 Differential Revision: https://phabricator.services.mozilla.com/D95145
This commit is contained in:
parent
c952a3b5d0
commit
53ece981b4
@ -38,5 +38,6 @@ dom/manifest/
|
||||
dom/mathml/
|
||||
dom/media/
|
||||
dom/messagechannel/
|
||||
dom/midi/
|
||||
dom/quota/
|
||||
dom/simpledb/
|
||||
|
@ -7,6 +7,7 @@
|
||||
#ifndef mozilla_dom_MIDIInputMap_h
|
||||
#define mozilla_dom_MIDIInputMap_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsPIDOMWindowInner;
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MIDIMessageQueue.h"
|
||||
#include "mozilla/dom/MIDITypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -7,9 +7,13 @@
|
||||
#ifndef mozilla_dom_MIDIMessageQueue_h
|
||||
#define mozilla_dom_MIDIMessageQueue_h
|
||||
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class TimeStamp;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class MIDIMessage;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#ifndef mozilla_dom_MIDIOutputMap_h
|
||||
#define mozilla_dom_MIDIOutputMap_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsPIDOMWindowInner;
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/dom/MIDIPermissionRequest.h"
|
||||
#include "mozilla/dom/MIDIAccessManager.h"
|
||||
#include "mozilla/dom/MIDIOptionsBinding.h"
|
||||
#include "nsIGlobalObject.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -14,6 +15,8 @@
|
||||
// MIDI Permission Requests
|
||||
//-------------------------------------------------
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(MIDIPermissionRequest,
|
||||
ContentPermissionRequestBase, mPromise)
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define mozilla_dom_MIDIPermissionRequest_h
|
||||
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "nsContentPermissionHelper.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -14,7 +14,7 @@ namespace dom {
|
||||
|
||||
NS_IMETHODIMP
|
||||
MIDIBackgroundRunnable::Run() {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
if (!MIDIPlatformService::IsRunning()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -12,6 +12,9 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
enum class MIDIPortConnectionState : uint8_t;
|
||||
enum class MIDIPortDeviceState : uint8_t;
|
||||
|
||||
class MIDIPortParent;
|
||||
class MIDIMessage;
|
||||
class MIDIPortInfo;
|
||||
|
@ -5,8 +5,12 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MIDIPlatformService.h"
|
||||
#include "MIDIMessageQueue.h"
|
||||
#include "TestMIDIPlatformService.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/MIDIManagerParent.h"
|
||||
#include "mozilla/dom/MIDIPlatformRunnables.h"
|
||||
#include "mozilla/dom/MIDIUtils.h"
|
||||
#include "mozilla/dom/PMIDIManagerParent.h"
|
||||
#include "mozilla/ipc/BackgroundParent.h"
|
||||
#include "mozilla/dom/MIDIPortParent.h"
|
||||
@ -22,7 +26,7 @@ MIDIPlatformService::~MIDIPlatformService() = default;
|
||||
|
||||
void MIDIPlatformService::CheckAndReceive(const nsAString& aPortId,
|
||||
const nsTArray<MIDIMessage>& aMsgs) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
for (auto& port : mPorts) {
|
||||
// TODO Clean this up when we split input/output port arrays
|
||||
if (port->MIDIPortInterface::Id() != aPortId ||
|
||||
@ -46,14 +50,14 @@ void MIDIPlatformService::CheckAndReceive(const nsAString& aPortId,
|
||||
|
||||
void MIDIPlatformService::AddPort(MIDIPortParent* aPort) {
|
||||
MOZ_ASSERT(aPort);
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
mPorts.AppendElement(aPort);
|
||||
}
|
||||
|
||||
void MIDIPlatformService::RemovePort(MIDIPortParent* aPort) {
|
||||
// This should only be called from the background thread, when a MIDIPort
|
||||
// actor has been destroyed.
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aPort);
|
||||
mPorts.RemoveElement(aPort);
|
||||
MaybeStop();
|
||||
@ -61,7 +65,7 @@ void MIDIPlatformService::RemovePort(MIDIPortParent* aPort) {
|
||||
|
||||
void MIDIPlatformService::BroadcastState(const MIDIPortInfo& aPortInfo,
|
||||
const MIDIPortDeviceState& aState) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
for (auto& p : mPorts) {
|
||||
if (p->MIDIPortInterface::Id() == aPortInfo.id() &&
|
||||
p->DeviceState() != aState) {
|
||||
@ -72,7 +76,7 @@ void MIDIPlatformService::BroadcastState(const MIDIPortInfo& aPortInfo,
|
||||
|
||||
void MIDIPlatformService::QueueMessages(const nsAString& aId,
|
||||
nsTArray<MIDIMessage>& aMsgs) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
{
|
||||
MutexAutoLock lock(mMessageQueueMutex);
|
||||
MIDIMessageQueue* msgQueue = mMessageQueues.LookupOrAdd(aId);
|
||||
@ -82,7 +86,7 @@ void MIDIPlatformService::QueueMessages(const nsAString& aId,
|
||||
}
|
||||
|
||||
void MIDIPlatformService::SendPortList() {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
mHasSentPortList = true;
|
||||
MIDIPortList l;
|
||||
for (auto& el : mPortInfo) {
|
||||
@ -94,7 +98,7 @@ void MIDIPlatformService::SendPortList() {
|
||||
}
|
||||
|
||||
void MIDIPlatformService::Clear(MIDIPortParent* aPort) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aPort);
|
||||
{
|
||||
MutexAutoLock lock(mMessageQueueMutex);
|
||||
@ -107,7 +111,7 @@ void MIDIPlatformService::Clear(MIDIPortParent* aPort) {
|
||||
}
|
||||
|
||||
void MIDIPlatformService::AddPortInfo(MIDIPortInfo& aPortInfo) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
mPortInfo.AppendElement(aPortInfo);
|
||||
@ -135,7 +139,7 @@ void MIDIPlatformService::AddPortInfo(MIDIPortInfo& aPortInfo) {
|
||||
}
|
||||
|
||||
void MIDIPlatformService::RemovePortInfo(MIDIPortInfo& aPortInfo) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
mPortInfo.RemoveElement(aPortInfo);
|
||||
BroadcastState(aPortInfo, MIDIPortDeviceState::Disconnected);
|
||||
if (mHasSentPortList) {
|
||||
@ -151,7 +155,7 @@ bool MIDIPlatformService::IsRunning() {
|
||||
}
|
||||
|
||||
void MIDIPlatformService::Close(mozilla::dom::MIDIPortParent* aPort) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
{
|
||||
MutexAutoLock lock(mMessageQueueMutex);
|
||||
MIDIMessageQueue* msgQueue =
|
||||
@ -170,7 +174,7 @@ void MIDIPlatformService::Close(mozilla::dom::MIDIPortParent* aPort) {
|
||||
MIDIPlatformService* MIDIPlatformService::Get() {
|
||||
// We should never touch the platform service in a child process.
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
if (!IsRunning()) {
|
||||
ErrorResult rv;
|
||||
// Uncomment once we have an actual platform library to test.
|
||||
@ -185,7 +189,7 @@ MIDIPlatformService* MIDIPlatformService::Get() {
|
||||
}
|
||||
|
||||
void MIDIPlatformService::MaybeStop() {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
if (!IsRunning()) {
|
||||
// Service already stopped or never started. Exit.
|
||||
return;
|
||||
@ -199,7 +203,7 @@ void MIDIPlatformService::MaybeStop() {
|
||||
}
|
||||
|
||||
void MIDIPlatformService::AddManager(MIDIManagerParent* aManager) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
mManagers.AppendElement(aManager);
|
||||
// Managers add themselves during construction. We have to wait for the
|
||||
// protocol construction to finish before we send them a port list. The
|
||||
@ -211,7 +215,7 @@ void MIDIPlatformService::AddManager(MIDIManagerParent* aManager) {
|
||||
}
|
||||
|
||||
void MIDIPlatformService::RemoveManager(MIDIManagerParent* aManager) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
mManagers.RemoveElement(aManager);
|
||||
MaybeStop();
|
||||
}
|
||||
@ -219,7 +223,7 @@ void MIDIPlatformService::RemoveManager(MIDIManagerParent* aManager) {
|
||||
void MIDIPlatformService::UpdateStatus(
|
||||
const nsAString& aPortId, const MIDIPortDeviceState& aDeviceState,
|
||||
const MIDIPortConnectionState& aConnectionState) {
|
||||
AssertIsOnBackgroundThread();
|
||||
::mozilla::ipc::AssertIsOnBackgroundThread();
|
||||
for (auto port : mPorts) {
|
||||
if (port->MIDIPortInterface::Id() == aPortId) {
|
||||
port->SendUpdateStatus(aDeviceState, aConnectionState);
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/MIDIPort.h"
|
||||
#include "mozilla/dom/MIDIConnectionEvent.h"
|
||||
#include "mozilla/dom/MIDIPortChild.h"
|
||||
#include "mozilla/dom/MIDIAccess.h"
|
||||
#include "mozilla/dom/MIDITypes.h"
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "mozilla/dom/MIDIPlatformService.h"
|
||||
#include "mozilla/dom/MIDITypes.h"
|
||||
|
||||
MIDIPortInterface::MIDIPortInterface(const MIDIPortInfo& aPortInfo,
|
||||
bool aSysexEnabled)
|
||||
mozilla::dom::MIDIPortInterface::MIDIPortInterface(
|
||||
const MIDIPortInfo& aPortInfo, bool aSysexEnabled)
|
||||
: mId(aPortInfo.id()),
|
||||
mName(aPortInfo.name()),
|
||||
mManufacturer(aPortInfo.manufacturer()),
|
||||
@ -22,6 +22,6 @@ MIDIPortInterface::MIDIPortInterface(const MIDIPortInfo& aPortInfo,
|
||||
mConnectionState(MIDIPortConnectionState::Open),
|
||||
mShuttingDown(false) {}
|
||||
|
||||
MIDIPortInterface::~MIDIPortInterface() { Shutdown(); }
|
||||
mozilla::dom::MIDIPortInterface::~MIDIPortInterface() { Shutdown(); }
|
||||
|
||||
void MIDIPortInterface::Shutdown() { mShuttingDown = true; }
|
||||
void mozilla::dom::MIDIPortInterface::Shutdown() { mShuttingDown = true; }
|
||||
|
Loading…
Reference in New Issue
Block a user