mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
Remove unused code for managing physical audio devices.
This was only used in B2G/Gonk and can go.
This commit is contained in:
parent
ea5ece2be9
commit
7f6182b5a3
7 changed files with 0 additions and 273 deletions
90
hal/Hal.cpp
90
hal/Hal.cpp
|
|
@ -754,96 +754,6 @@ UnlockScreenOrientation()
|
|||
PROXY_IF_SANDBOXED(UnlockScreenOrientation());
|
||||
}
|
||||
|
||||
void
|
||||
EnableSwitchNotifications(SwitchDevice aDevice) {
|
||||
AssertMainThread();
|
||||
PROXY_IF_SANDBOXED(EnableSwitchNotifications(aDevice));
|
||||
}
|
||||
|
||||
void
|
||||
DisableSwitchNotifications(SwitchDevice aDevice) {
|
||||
AssertMainThread();
|
||||
PROXY_IF_SANDBOXED(DisableSwitchNotifications(aDevice));
|
||||
}
|
||||
|
||||
SwitchState GetCurrentSwitchState(SwitchDevice aDevice)
|
||||
{
|
||||
AssertMainThread();
|
||||
RETURN_PROXY_IF_SANDBOXED(GetCurrentSwitchState(aDevice), SWITCH_STATE_UNKNOWN);
|
||||
}
|
||||
|
||||
void NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState)
|
||||
{
|
||||
AssertMainThread();
|
||||
PROXY_IF_SANDBOXED(NotifySwitchStateFromInputDevice(aDevice, aState));
|
||||
}
|
||||
|
||||
typedef mozilla::ObserverList<SwitchEvent> SwitchObserverList;
|
||||
|
||||
static SwitchObserverList *sSwitchObserverLists = nullptr;
|
||||
|
||||
static SwitchObserverList&
|
||||
GetSwitchObserverList(SwitchDevice aDevice) {
|
||||
MOZ_ASSERT(0 <= aDevice && aDevice < NUM_SWITCH_DEVICE);
|
||||
if (sSwitchObserverLists == nullptr) {
|
||||
sSwitchObserverLists = new SwitchObserverList[NUM_SWITCH_DEVICE];
|
||||
}
|
||||
return sSwitchObserverLists[aDevice];
|
||||
}
|
||||
|
||||
static void
|
||||
ReleaseObserversIfNeeded() {
|
||||
for (int i = 0; i < NUM_SWITCH_DEVICE; i++) {
|
||||
if (sSwitchObserverLists[i].Length() != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
//The length of every list is 0, no observer in the list.
|
||||
delete [] sSwitchObserverLists;
|
||||
sSwitchObserverLists = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
RegisterSwitchObserver(SwitchDevice aDevice, SwitchObserver *aObserver)
|
||||
{
|
||||
AssertMainThread();
|
||||
SwitchObserverList& observer = GetSwitchObserverList(aDevice);
|
||||
observer.AddObserver(aObserver);
|
||||
if (observer.Length() == 1) {
|
||||
EnableSwitchNotifications(aDevice);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
UnregisterSwitchObserver(SwitchDevice aDevice, SwitchObserver *aObserver)
|
||||
{
|
||||
AssertMainThread();
|
||||
|
||||
if (!sSwitchObserverLists) {
|
||||
return;
|
||||
}
|
||||
|
||||
SwitchObserverList& observer = GetSwitchObserverList(aDevice);
|
||||
if (!observer.RemoveObserver(aObserver) || observer.Length() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
DisableSwitchNotifications(aDevice);
|
||||
ReleaseObserversIfNeeded();
|
||||
}
|
||||
|
||||
void
|
||||
NotifySwitchChange(const SwitchEvent& aEvent)
|
||||
{
|
||||
// When callback this notification, main thread may call unregister function
|
||||
// first. We should check if this pointer is valid.
|
||||
if (!sSwitchObserverLists)
|
||||
return;
|
||||
|
||||
SwitchObserverList& observer = GetSwitchObserverList(aEvent.device());
|
||||
observer.Broadcast(aEvent);
|
||||
}
|
||||
|
||||
static AlarmObserver* sAlarmObserver;
|
||||
|
||||
bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue