| 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 84433950de11762274b42ad1da528f1b40838d11..631145827362f2a19b324126f2feb653a7645af7 100644
|
| --- a/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| +++ b/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| @@ -42,7 +42,7 @@ UserGestureToken::UserGestureToken(Status status)
|
| m_timestamp(WTF::currentTime()),
|
| m_timeoutPolicy(Default),
|
| m_usageCallback(nullptr) {
|
| - if (status == NewGesture || !UserGestureIndicator::currentToken())
|
| + if (status == NewGesture || !UserGestureIndicator::currentTokenThreadSafe())
|
| m_consumableGestures++;
|
| }
|
|
|
| @@ -151,18 +151,18 @@ bool UserGestureIndicator::utilizeUserGesture() {
|
| }
|
|
|
| bool UserGestureIndicator::processingUserGesture() {
|
| - if (auto* token = currentToken()) {
|
| - ASSERT(isMainThread());
|
| + if (auto* token = currentToken())
|
| return token->hasGestures();
|
| - }
|
| -
|
| return false;
|
| }
|
|
|
| +bool UserGestureIndicator::processingUserGestureThreadSafe() {
|
| + return isMainThread() && processingUserGesture();
|
| +}
|
| +
|
| // static
|
| bool UserGestureIndicator::consumeUserGesture() {
|
| if (auto* token = currentToken()) {
|
| - ASSERT(isMainThread());
|
| if (token->consumeGesture()) {
|
| token->userGestureUtilized();
|
| return true;
|
| @@ -171,11 +171,17 @@ bool UserGestureIndicator::consumeUserGesture() {
|
| return false;
|
| }
|
|
|
| -// static
|
| +bool UserGestureIndicator::consumeUserGestureThreadSafe() {
|
| + return isMainThread() && consumeUserGesture();
|
| +}
|
| +
|
| UserGestureToken* UserGestureIndicator::currentToken() {
|
| - if (!isMainThread() || !s_rootToken)
|
| - return nullptr;
|
| + DCHECK(isMainThread());
|
| return s_rootToken;
|
| }
|
|
|
| +UserGestureToken* UserGestureIndicator::currentTokenThreadSafe() {
|
| + return isMainThread() ? currentToken() : nullptr;
|
| +}
|
| +
|
| } // namespace blink
|
|
|