summaryrefslogtreecommitdiff
path: root/Source/WebCore/page/DOMTimer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/page/DOMTimer.cpp')
-rw-r--r--Source/WebCore/page/DOMTimer.cpp25
1 files changed, 5 insertions, 20 deletions
diff --git a/Source/WebCore/page/DOMTimer.cpp b/Source/WebCore/page/DOMTimer.cpp
index 7d6831196..dad76f58d 100644
--- a/Source/WebCore/page/DOMTimer.cpp
+++ b/Source/WebCore/page/DOMTimer.cpp
@@ -30,7 +30,7 @@
#include "InspectorInstrumentation.h"
#include "ScheduledAction.h"
#include "ScriptExecutionContext.h"
-#include <wtf/CurrentTime.h>
+#include "UserGestureIndicator.h"
#include <wtf/HashSet.h>
#include <wtf/StdLibExtras.h>
@@ -42,7 +42,6 @@ static const int maxIntervalForUserGestureForwarding = 1000; // One second match
static const int maxTimerNestingLevel = 5;
static const double oneMillisecond = 0.001;
double DOMTimer::s_minDefaultTimerInterval = 0.010; // 10 milliseconds
-double DOMTimer::s_defaultTimerAlignmentInterval = 0;
static int timerNestingLevel = 0;
@@ -69,9 +68,8 @@ DOMTimer::DOMTimer(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction>
, m_nestingLevel(timerNestingLevel + 1)
, m_action(action)
, m_originalInterval(interval)
+ , m_shouldForwardUserGesture(shouldForwardUserGesture(interval, m_nestingLevel))
{
- if (shouldForwardUserGesture(interval, m_nestingLevel))
- m_userGestureToken = UserGestureIndicator::currentToken();
scriptExecutionContext()->addTimeout(m_timeoutId, this);
double intervalMilliseconds = intervalClampedToMinimum(interval, context->minimumTimerInterval());
@@ -118,8 +116,10 @@ void DOMTimer::fired()
ScriptExecutionContext* context = scriptExecutionContext();
timerNestingLevel = m_nestingLevel;
ASSERT(!context->activeDOMObjectsAreSuspended());
+ UserGestureIndicator gestureIndicator(m_shouldForwardUserGesture ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture);
+
// Only the first execution of a multi-shot timer should get an affirmative user gesture indicator.
- UserGestureIndicator gestureIndicator(m_userGestureToken.release());
+ m_shouldForwardUserGesture = false;
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutId);
@@ -194,19 +194,4 @@ double DOMTimer::intervalClampedToMinimum(int timeout, double minimumTimerInterv
return intervalMilliseconds;
}
-double DOMTimer::alignedFireTime(double fireTime) const
-{
- double alignmentInterval = scriptExecutionContext()->timerAlignmentInterval();
- if (alignmentInterval) {
- double currentTime = monotonicallyIncreasingTime();
- if (fireTime <= currentTime)
- return fireTime;
-
- double alignedTime = ceil(fireTime / alignmentInterval) * alignmentInterval;
- return alignedTime;
- }
-
- return fireTime;
-}
-
} // namespace WebCore