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

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

Issue 2483983002: [Blink] Check thread access in UserGestureIndicator (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/UserGestureIndicator.cpp
diff --git a/third_party/WebKit/Source/platform/UserGestureIndicator.cpp b/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
index 517a873060e36f75cbb7f0843809c738ede852fc..84433950de11762274b42ad1da528f1b40838d11 100644
--- a/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
+++ b/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
@@ -118,12 +118,13 @@ static void RecordUserGestureMerge(const UserGestureToken& oldToken,
UserGestureToken* UserGestureIndicator::s_rootToken = nullptr;
-UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token)
- : m_token(token == s_rootToken ? nullptr : token.get()) {
- // Silently ignore UserGestureIndicators on non-main threads.
- if (!isMainThread() || !m_token)
+UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token) {
+ // Silently ignore UserGestureIndicators on non-main threads and tokens that
+ // are already active.
+ if (!isMainThread() || !token || token == s_rootToken)
return;
+ m_token = token;
if (!s_rootToken) {
s_rootToken = m_token.get();
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698