Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Unified Diff: third_party/WebKit/Source/core/input/TouchEventManager.cpp

Issue 2401123002: UserGestureIndicator is a mess. Clean it up. (Closed)
Patch Set: Callback cleanup, comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/input/TouchEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.cpp b/third_party/WebKit/Source/core/input/TouchEventManager.cpp
index 52ae9710746a4ad865c38584592e5da2331c8e9c..2bc292fedb82d34ea6102bb9b91979b488cb5469 100644
--- a/third_party/WebKit/Source/core/input/TouchEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/TouchEventManager.cpp
@@ -524,21 +524,19 @@ WebInputEventResult TouchEventManager::handleTouchEvent(
std::unique_ptr<UserGestureIndicator> gestureIndicator;
if (isTap || isSameOrigin) {
- UserGestureUtilizedCallback* callback = 0;
+ gestureIndicator = wrapUnique(
+ new UserGestureIndicator(m_touchSequenceUserGestureToken
+ ? m_touchSequenceUserGestureToken.release()
+ : UserGestureToken::create()));
+
+ m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken();
// These are cases we'd like to migrate to not hold a user gesture.
if (event.type() == PlatformEvent::TouchStart ||
event.type() == PlatformEvent::TouchMove ||
(event.type() == PlatformEvent::TouchEnd && m_touchScrollStarted)) {
// Collect metrics in userGestureUtilized().
- callback = this;
+ m_touchSequenceUserGestureToken->setUserGestureUtilizedCallback(this);
}
- if (m_touchSequenceUserGestureToken)
- gestureIndicator = wrapUnique(new UserGestureIndicator(
- m_touchSequenceUserGestureToken.release(), callback));
- else
- gestureIndicator = wrapUnique(
- new UserGestureIndicator(DefinitelyProcessingUserGesture, callback));
- m_touchSequenceUserGestureToken = UserGestureIndicator::currentToken();
}
return dispatchTouchEvents(event, touchInfos, allTouchesReleased);

Powered by Google App Engine
This is Rietveld 408576698