Index: Source/platform/UserGestureIndicator.cpp |
diff --git a/Source/platform/UserGestureIndicator.cpp b/Source/platform/UserGestureIndicator.cpp |
index dbebd06a9ddc724f81f454e1af6366d3c0ae55fb..b2899e171344a6af313534a0e0031dcd76b9bf30 100644 |
--- a/Source/platform/UserGestureIndicator.cpp |
+++ b/Source/platform/UserGestureIndicator.cpp |
@@ -64,6 +64,11 @@ public: |
m_timestamp = WTF::currentTime(); |
} |
+ void setTimestamp(double timestamp) |
+ { |
+ m_timestamp = timestamp; |
+ } |
+ |
bool consumeGesture() |
{ |
if (!m_consumableGestures) |
@@ -88,6 +93,11 @@ public: |
m_javascriptPrompt = true; |
} |
+ virtual double timestamp() const OVERRIDE |
+ { |
+ return m_timestamp; |
+ } |
+ |
private: |
GestureToken() |
: m_consumableGestures(0), |
@@ -167,6 +177,26 @@ UserGestureIndicator::UserGestureIndicator(PassRefPtr<UserGestureToken> token) |
ASSERT(isDefinite(s_state)); |
} |
+UserGestureIndicator::UserGestureIndicator(double timestamp) |
+ : m_previousState(s_state) |
+{ |
+ // Silently ignore UserGestureIndicators on non-main threads. |
+ if (!isMainThread()) |
+ return; |
+ |
+ if (!s_topmostIndicator) { |
+ s_topmostIndicator = this; |
+ m_token = GestureToken::create(); |
+ } else { |
+ m_token = s_topmostIndicator->currentToken(); |
+ } |
+ s_state = DefinitelyProcessingUserGesture; |
+ |
+ static_cast<GestureToken*>(m_token.get())->addGesture(); |
+ static_cast<GestureToken*>(m_token.get())->setTimestamp(timestamp); |
+ ASSERT(isDefinite(s_state)); |
+} |
+ |
UserGestureIndicator::~UserGestureIndicator() |
{ |
if (!isMainThread()) |