mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 10:33:33 +00:00
Bug 1657404 - Refactor gamepad monitoring - Part 1 r=daoshengmu
The starting/stopping of gamepad monitoring is probably a decision that should be made at the level of the GamepadPlatformService, not in the IPC actor. This is step 1, later I will expand some of these functions because it makes the code easier to understand. Differential Revision: https://phabricator.services.mozilla.com/D86266
This commit is contained in:
parent
492ec9ba2f
commit
1e641f2551
@ -221,6 +221,8 @@ void GamepadPlatformService::AddChannelParent(
|
||||
}
|
||||
|
||||
FlushPendingEvents();
|
||||
|
||||
StartGamepadMonitoring();
|
||||
}
|
||||
|
||||
void GamepadPlatformService::FlushPendingEvents() {
|
||||
@ -250,8 +252,12 @@ void GamepadPlatformService::RemoveChannelParent(
|
||||
MOZ_ASSERT(mChannelParents.Contains(aParent));
|
||||
|
||||
// We use mutex here to prevent race condition with monitor thread
|
||||
MutexAutoLock autoLock(mMutex);
|
||||
mChannelParents.RemoveElement(aParent);
|
||||
{
|
||||
MutexAutoLock autoLock(mMutex);
|
||||
mChannelParents.RemoveElement(aParent);
|
||||
}
|
||||
|
||||
MaybeStopGamepadMonitoring();
|
||||
}
|
||||
|
||||
bool GamepadPlatformService::HasGamepadListeners() {
|
||||
|
@ -49,8 +49,6 @@ bool GamepadEventChannelParent::Init() {
|
||||
|
||||
service->AddChannelParent(this);
|
||||
|
||||
StartGamepadMonitoring();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -61,8 +59,6 @@ void GamepadEventChannelParent::ActorDestroy(ActorDestroyReason aWhy) {
|
||||
GamepadPlatformService::GetParentService();
|
||||
MOZ_ASSERT(service);
|
||||
service->RemoveChannelParent(this);
|
||||
|
||||
MaybeStopGamepadMonitoring();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult GamepadEventChannelParent::RecvVibrateHaptic(
|
||||
|
Loading…
Reference in New Issue
Block a user