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

Unified Diff: third_party/WebKit/Source/platform/UserGestureIndicator.h

Issue 2555013004: UserGestureIndicator: remove many unnecessary calls to isMainThread (Closed)
Patch Set: Avoid duplicate thread checks in DOMTimer 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/platform/UserGestureIndicator.h
diff --git a/third_party/WebKit/Source/platform/UserGestureIndicator.h b/third_party/WebKit/Source/platform/UserGestureIndicator.h
index 5cab2e0c690d05884219ad11a0204570c1b19ab7..4e4cebe249c78f02e5a05612b7db6ab56aaa5ec8 100644
--- a/third_party/WebKit/Source/platform/UserGestureIndicator.h
+++ b/third_party/WebKit/Source/platform/UserGestureIndicator.h
@@ -94,11 +94,17 @@ class PLATFORM_EXPORT UserGestureIndicator final {
WTF_MAKE_NONCOPYABLE(UserGestureIndicator);
public:
+ // Note: All *ThreadSafe methods are safe to call from any thread. Their
+ // non-suffixed counterparts *must* be called on the main thread. Consider
+ // always using the non-suffixed one unless the code really
+ // needs to be thread-safe
+
// Returns whether a user gesture is currently in progress.
// Does not invoke the UserGestureUtilizedCallback. Consider calling
// utilizeUserGesture instead if you know for sure that the return value
// will have an effect.
static bool processingUserGesture();
+ static bool processingUserGestureThreadSafe();
// Indicates that a user gesture (if any) is being used, without preventing it
// from being used again. Returns whether a user gesture is currently in
@@ -111,8 +117,10 @@ class PLATFORM_EXPORT UserGestureIndicator final {
// operations like creating a new process.
// Like utilizeUserGesture, may invoke/clear any UserGestureUtilizedCallback.
static bool consumeUserGesture();
+ static bool consumeUserGestureThreadSafe();
static UserGestureToken* currentToken();
+ static UserGestureToken* currentTokenThreadSafe();
explicit UserGestureIndicator(PassRefPtr<UserGestureToken>);
~UserGestureIndicator();

Powered by Google App Engine
This is Rietveld 408576698