diff --git a/widget/gonk/GeckoTouchDispatcher.cpp b/widget/gonk/GeckoTouchDispatcher.cpp index f53717f85bc5..2963dd95f71f 100644 --- a/widget/gonk/GeckoTouchDispatcher.cpp +++ b/widget/gonk/GeckoTouchDispatcher.cpp @@ -63,6 +63,7 @@ GeckoTouchDispatcher::GetInstance() GeckoTouchDispatcher::GeckoTouchDispatcher() : mTouchQueueLock("GeckoTouchDispatcher::mTouchQueueLock") + , mHavePendingTouchMoves(false) , mTouchEventsFiltered(false) { // Since GeckoTouchDispatcher is initialized when input is initialized @@ -112,6 +113,7 @@ GeckoTouchDispatcher::NotifyTouch(MultiTouchInput& aTouch, TimeStamp aEventTime) if (aTouch.mType == MultiTouchInput::MULTITOUCH_MOVE) { MutexAutoLock lock(mTouchQueueLock); mTouchMoveEvents.push_back(aTouch); + mHavePendingTouchMoves = true; if (mResamplingEnabled) { return; } @@ -131,9 +133,10 @@ GeckoTouchDispatcher::DispatchTouchMoveEvents(TimeStamp aVsyncTime) { MutexAutoLock lock(mTouchQueueLock); - if (mTouchMoveEvents.empty()) { + if (!mHavePendingTouchMoves) { return; } + mHavePendingTouchMoves = false; if (mResamplingEnabled) { int touchCount = mTouchMoveEvents.size(); diff --git a/widget/gonk/GeckoTouchDispatcher.h b/widget/gonk/GeckoTouchDispatcher.h index bd832e70829c..60973087f096 100644 --- a/widget/gonk/GeckoTouchDispatcher.h +++ b/widget/gonk/GeckoTouchDispatcher.h @@ -60,10 +60,12 @@ private: void DispatchMouseEvent(MultiTouchInput& aMultiTouch, bool aForwardToChildren); - // mTouchQueueLock are used to protect the vector below - // as it is accessed on the vsync thread and main thread + // mTouchQueueLock is used to protect the vector and state below + // as it is accessed on multiple threads. Mutex mTouchQueueLock; std::vector mTouchMoveEvents; + bool mHavePendingTouchMoves; + // end stuff protected by mTouchQueueLock bool mResamplingEnabled; bool mTouchEventsFiltered;