| 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 5b4c4362359b1f205e332a6cb7bf541bf6efd081..8da53de52ffe4039807a7be57906d26bf0fa0270 100644
|
| --- a/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| +++ b/third_party/WebKit/Source/platform/UserGestureIndicator.cpp
|
| @@ -128,8 +128,9 @@ ProcessingUserGestureState UserGestureIndicator::s_state = DefinitelyNotProcessi
|
| UserGestureIndicator* UserGestureIndicator::s_topmostIndicator = 0;
|
| bool UserGestureIndicator::s_processedUserGestureSinceLoad = false;
|
|
|
| -UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
|
| +UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state, UserGestureUsedCallback* usageCallback)
|
| : m_previousState(DefinitelyNotProcessingUserGesture)
|
| + , m_usageCallback(usageCallback)
|
| {
|
| // Silently ignore UserGestureIndicators on non-main threads.
|
| if (!isMainThread())
|
| @@ -158,8 +159,9 @@ UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
|
| ASSERT(isDefinite(s_state));
|
| }
|
|
|
| -UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token)
|
| +UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token, UserGestureUsedCallback* usageCallback)
|
| : m_previousState(DefinitelyNotProcessingUserGesture)
|
| + , m_usageCallback(usageCallback)
|
| {
|
| // Silently ignore UserGestureIndicators on non-main threads.
|
| if (!isMainThread())
|
| @@ -198,6 +200,18 @@ UserGestureIndicator::~UserGestureIndicator()
|
| // static
|
| bool UserGestureIndicator::processingUserGesture()
|
| {
|
| + if (UserGestureIndicator::processingUserGestureUntracked()) {
|
| + if (s_topmostIndicator->m_usageCallback) {
|
| + s_topmostIndicator->m_usageCallback->userGestureUsed();
|
| + s_topmostIndicator->m_usageCallback = nullptr;
|
| + }
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +bool UserGestureIndicator::processingUserGestureUntracked()
|
| +{
|
| if (auto* token = currentToken()) {
|
| ASSERT(isMainThread());
|
| return isDefiniteUserGesture(s_state) && static_cast<GestureToken*>(token)->hasGestures();
|
| @@ -211,9 +225,14 @@ bool UserGestureIndicator::consumeUserGesture()
|
| {
|
| if (auto* token = currentToken()) {
|
| ASSERT(isMainThread());
|
| - return static_cast<GestureToken*>(token)->consumeGesture();
|
| + if (static_cast<GestureToken*>(token)->consumeGesture()) {
|
| + if (s_topmostIndicator->m_usageCallback) {
|
| + s_topmostIndicator->m_usageCallback->userGestureUsed();
|
| + s_topmostIndicator->m_usageCallback = nullptr;
|
| + }
|
| + return true;
|
| + }
|
| }
|
| -
|
| return false;
|
| }
|
|
|
|
|