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

Unified Diff: Source/WebCore/dom/UserGestureIndicator.cpp

Issue 10907083: Merge 126609 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 3 months 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 | « Source/WebCore/dom/UserGestureIndicator.h ('k') | Source/WebKit/chromium/public/WebFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/dom/UserGestureIndicator.cpp
===================================================================
--- Source/WebCore/dom/UserGestureIndicator.cpp (revision 127651)
+++ Source/WebCore/dom/UserGestureIndicator.cpp (working copy)
@@ -34,6 +34,7 @@
}
ProcessingUserGestureState UserGestureIndicator::s_state = DefinitelyNotProcessingUserGesture;
+size_t UserGestureIndicator::s_consumableGestures = 0;
UserGestureIndicator::UserGestureIndicator(ProcessingUserGestureState state)
: m_previousState(s_state)
@@ -41,13 +42,26 @@
// We overwrite s_state only if the caller is definite about the gesture state.
if (isDefinite(state))
s_state = state;
+
+ if (s_state == DefinitelyProcessingUserGesture)
+ s_consumableGestures++;
ASSERT(isDefinite(s_state));
}
UserGestureIndicator::~UserGestureIndicator()
{
+ if (s_consumableGestures && s_state == DefinitelyProcessingUserGesture)
+ s_consumableGestures--;
s_state = m_previousState;
ASSERT(isDefinite(s_state));
}
+bool UserGestureIndicator::consumeUserGesture()
+{
+ if (!s_consumableGestures)
+ return false;
+ s_consumableGestures--;
+ return true;
}
+
+}
« no previous file with comments | « Source/WebCore/dom/UserGestureIndicator.h ('k') | Source/WebKit/chromium/public/WebFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698