| 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..3b9e17a6e10ef88d5ec8d2687aaa976043864ff6 100644
|
| --- a/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| +++ b/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| @@ -42,8 +42,11 @@ UserGestureToken::UserGestureToken(Status status)
|
| m_timestamp(WTF::currentTime()),
|
| m_timeoutPolicy(Default),
|
| m_usageCallback(nullptr) {
|
| - if (status == NewGesture || !UserGestureIndicator::currentToken())
|
| + if (status == NewGesture ||
|
| + !UserGestureIndicator::currentToken(
|
| + UserGestureIndicator::CheckThreadState)) {
|
| m_consumableGestures++;
|
| + }
|
| }
|
|
|
| bool UserGestureToken::hasGestures() const {
|
| @@ -150,19 +153,15 @@ bool UserGestureIndicator::utilizeUserGesture() {
|
| return false;
|
| }
|
|
|
| -bool UserGestureIndicator::processingUserGesture() {
|
| - if (auto* token = currentToken()) {
|
| - ASSERT(isMainThread());
|
| +bool UserGestureIndicator::processingUserGesture(ThreadCheck threadCheck) {
|
| + if (auto* token = currentToken(threadCheck))
|
| return token->hasGestures();
|
| - }
|
| -
|
| return false;
|
| }
|
|
|
| // static
|
| -bool UserGestureIndicator::consumeUserGesture() {
|
| - if (auto* token = currentToken()) {
|
| - ASSERT(isMainThread());
|
| +bool UserGestureIndicator::consumeUserGesture(ThreadCheck threadCheck) {
|
| + if (auto* token = currentToken(threadCheck)) {
|
| if (token->consumeGesture()) {
|
| token->userGestureUtilized();
|
| return true;
|
| @@ -171,10 +170,10 @@ bool UserGestureIndicator::consumeUserGesture() {
|
| return false;
|
| }
|
|
|
| -// static
|
| -UserGestureToken* UserGestureIndicator::currentToken() {
|
| - if (!isMainThread() || !s_rootToken)
|
| +UserGestureToken* UserGestureIndicator::currentToken(ThreadCheck threadCheck) {
|
| + if (threadCheck == CheckThreadState && !isMainThread())
|
| return nullptr;
|
| + DCHECK(isMainThread());
|
| return s_rootToken;
|
| }
|
|
|
|
|