void GeckoTouchDispatcher::DispatchTouchMoveEvents(TimeStamp aVsyncTime) { MultiTouchInput touchMove; { MutexAutoLock lock(mTouchQueueLock); if (!mHavePendingTouchMoves) { return; } mHavePendingTouchMoves = false; int touchCount = mTouchMoveEvents.size(); TimeDuration vsyncTouchDiff = aVsyncTime - mTouchMoveEvents.back().mTimeStamp; // The delay threshold is a positive pref, but we're testing to see if the // vsync time is delayed from the touch, so add a negative sign. bool isDelayedVsyncEvent = vsyncTouchDiff < -mDelayedVsyncThreshold; bool isOldTouch = vsyncTouchDiff > mOldTouchThreshold; bool resample = (touchCount > 1) && !isDelayedVsyncEvent && !isOldTouch; if (!resample) { touchMove = mTouchMoveEvents.back(); mTouchMoveEvents.clear(); if (!isDelayedVsyncEvent && !isOldTouch) { mTouchMoveEvents.push_back(touchMove); } } else { ResampleTouchMoves(touchMove, aVsyncTime); } } DispatchTouchEvent(touchMove); }
void GeckoTouchDispatcher::DispatchTouchMoveEvents(uint64_t aVsyncTime) { MultiTouchInput touchMove; { MutexAutoLock lock(mTouchQueueLock); if (mTouchMoveEvents.empty()) { return; } int touchCount = mTouchMoveEvents.size(); // Both aVsynctime and mLastTouchTime are uint64_t // Need to store as a signed int. int64_t vsyncTouchDiff = aVsyncTime - mLastTouchTime; bool resample = (touchCount > 1) && (vsyncTouchDiff > mMinResampleTime); if (!resample) { touchMove = mTouchMoveEvents.back(); mTouchMoveEvents.clear(); mTouchMoveEvents.push_back(touchMove); } else { ResampleTouchMoves(touchMove, aVsyncTime); } } DispatchTouchEvent(touchMove); }
void GeckoTouchDispatcher::DispatchTouchNonMoveEvent(MultiTouchInput aInput) { layers::APZThreadUtils::AssertOnControllerThread(); // Flush pending touch move events, if there are any // (DispatchTouchMoveEvents will check the mHavePendingTouchMoves flag and // bail out if there's nothing to be done). NotifyVsync(TimeStamp::Now()); DispatchTouchEvent(aInput); { // scope lock MutexAutoLock lock(mTouchQueueLock); mInflightNonMoveEvents--; MOZ_ASSERT(mInflightNonMoveEvents >= 0); } }