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

Unified Diff: third_party/WebKit/Source/core/frame/DOMTimer.cpp

Issue 2555013004: UserGestureIndicator: remove many unnecessary calls to isMainThread (Closed)
Patch Set: [test] remove isMainThread() check in currentToken() Created 4 years 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/frame/DOMTimer.cpp
diff --git a/third_party/WebKit/Source/core/frame/DOMTimer.cpp b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
index a6140804ca9f54ac1a5eb73cb73cc82aa0a5ac0c..db7945d64491da9f60370fc339218167adb9cb26 100644
--- a/third_party/WebKit/Source/core/frame/DOMTimer.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
@@ -47,7 +47,8 @@ static const double oneMillisecond = 0.001;
static const double minimumInterval = 0.004;
static inline bool shouldForwardUserGesture(int interval, int nestingLevel) {
- return UserGestureIndicator::processingUserGesture() &&
+ return UserGestureIndicator::processingUserGesture(
+ UserGestureIndicator::CheckThreadState) &&
interval <= maxIntervalForUserGestureForwarding &&
nestingLevel ==
1; // Gestures should not be forwarded to nested timers.
@@ -90,8 +91,10 @@ DOMTimer::DOMTimer(ExecutionContext* context,
m_nestingLevel(context->timers()->timerNestingLevel() + 1),
m_action(action) {
ASSERT(timeoutID > 0);
- if (shouldForwardUserGesture(interval, m_nestingLevel))
- m_userGestureToken = UserGestureIndicator::currentToken();
+ if (shouldForwardUserGesture(interval, m_nestingLevel)) {
+ m_userGestureToken = UserGestureIndicator::currentToken(
+ UserGestureIndicator::CheckThreadState);
+ }
InspectorInstrumentation::asyncTaskScheduled(
context, singleShot ? "setTimeout" : "setInterval", this, !singleShot);

Powered by Google App Engine
This is Rietveld 408576698