Bug 1140578 - Add a explicit flag to track if we have pending touch moves to process. r=mchang

This commit is contained in:
Kartikaya Gupta 2015-03-09 12:46:04 -04:00
Родитель c856037b1d
Коммит e288f1cc73
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -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();

Просмотреть файл

@ -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<MultiTouchInput> mTouchMoveEvents;
bool mHavePendingTouchMoves;
// end stuff protected by mTouchQueueLock
bool mResamplingEnabled;
bool mTouchEventsFiltered;