зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1658416 - Remove current pending events handling r=baku
The "pending events" functionality is going to be taken by the test channel itself, so this code is no longer needed Differential Revision: https://phabricator.services.mozilla.com/D86746
This commit is contained in:
Родитель
f050b91638
Коммит
5781802e5a
|
@ -64,13 +64,6 @@ void GamepadPlatformService::NotifyGamepadChange(uint32_t aIndex,
|
|||
// same time, we use mutex to prevent possible race condtion
|
||||
MutexAutoLock autoLock(mMutex);
|
||||
|
||||
// Buffer all events if we have no Channel to dispatch, which
|
||||
// may happen when performing Mochitest.
|
||||
if (mChannelParents.IsEmpty()) {
|
||||
mPendingEvents.AppendElement(e);
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < mChannelParents.Length(); ++i) {
|
||||
mChannelParents[i]->DispatchUpdateEvent(e);
|
||||
}
|
||||
|
@ -220,31 +213,11 @@ void GamepadPlatformService::AddChannelParent(
|
|||
aParent->DispatchUpdateEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
FlushPendingEvents();
|
||||
}
|
||||
|
||||
StartGamepadMonitoring();
|
||||
}
|
||||
|
||||
void GamepadPlatformService::FlushPendingEvents() {
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(!mChannelParents.IsEmpty());
|
||||
|
||||
if (mPendingEvents.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: This method must be called with mMutex held because it accesses
|
||||
// mChannelParents.
|
||||
for (uint32_t i = 0; i < mChannelParents.Length(); ++i) {
|
||||
for (uint32_t j = 0; j < mPendingEvents.Length(); ++j) {
|
||||
mChannelParents[i]->DispatchUpdateEvent(mPendingEvents[j]);
|
||||
}
|
||||
}
|
||||
mPendingEvents.Clear();
|
||||
}
|
||||
|
||||
void GamepadPlatformService::RemoveChannelParent(
|
||||
GamepadEventChannelParent* aParent) {
|
||||
// mChannelParents can only be modified once GamepadEventChannelParent
|
||||
|
|
|
@ -93,9 +93,6 @@ class GamepadPlatformService final {
|
|||
template <class T>
|
||||
void NotifyGamepadChange(uint32_t aIndex, const T& aInfo);
|
||||
|
||||
// Flush all pending events buffered in mPendingEvents, must be called
|
||||
// with mMutex held
|
||||
void FlushPendingEvents();
|
||||
void Cleanup();
|
||||
|
||||
// mGamepadIndex can only be accessed by monitor thread
|
||||
|
@ -110,10 +107,6 @@ class GamepadPlatformService final {
|
|||
// between background and monitor thread
|
||||
Mutex mMutex;
|
||||
|
||||
// In mochitest, it is possible that the test Events is synthesized
|
||||
// before GamepadEventChannel created, we need to buffer all events
|
||||
// until the channel is created if that happens.
|
||||
nsTArray<GamepadChangeEvent> mPendingEvents;
|
||||
std::map<uint32_t, GamepadAdded> mGamepadAdded;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче