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

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

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/platform/UserGestureIndicator.h
diff --git a/third_party/WebKit/Source/platform/UserGestureIndicator.h b/third_party/WebKit/Source/platform/UserGestureIndicator.h
index 5cab2e0c690d05884219ad11a0204570c1b19ab7..909142d5ca8462f504ce70ebbf6b47548c5ac33a 100644
--- a/third_party/WebKit/Source/platform/UserGestureIndicator.h
+++ b/third_party/WebKit/Source/platform/UserGestureIndicator.h
@@ -94,11 +94,16 @@ class PLATFORM_EXPORT UserGestureIndicator final {
WTF_MAKE_NONCOPYABLE(UserGestureIndicator);
public:
+ enum ThreadCheck {
+ CheckThreadState,
+ DoNotCheckThreadState,
+ };
+
// 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 processingUserGesture(ThreadCheck = DoNotCheckThreadState);
kinuko 2016/12/09 03:15:51 I slightly prefer having processingUserGestureThre
Charlie Harrison 2016/12/09 15:24:14 Do you feel that way for all the methods? i.e. sho
// 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
@@ -110,9 +115,9 @@ class PLATFORM_EXPORT UserGestureIndicator final {
// it cannot be used again. This is done only for very security-sensitive
// operations like creating a new process.
// Like utilizeUserGesture, may invoke/clear any UserGestureUtilizedCallback.
- static bool consumeUserGesture();
+ static bool consumeUserGesture(ThreadCheck = DoNotCheckThreadState);
- static UserGestureToken* currentToken();
+ static UserGestureToken* currentToken(ThreadCheck = DoNotCheckThreadState);
explicit UserGestureIndicator(PassRefPtr<UserGestureToken>);
~UserGestureIndicator();

Powered by Google App Engine
This is Rietveld 408576698