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

Unified Diff: Source/core/page/DOMTimer.h

Issue 19494002: Distinguish actions registered with setTimeout() and setInterval(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test, and add a new test. Created 7 years, 5 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
Index: Source/core/page/DOMTimer.h
diff --git a/Source/core/page/DOMTimer.h b/Source/core/page/DOMTimer.h
index 496b83a5c95e8f376f21ade5c10efc2812682280..a9c023b897c1402ba52072dd21a263139e91a57e 100644
--- a/Source/core/page/DOMTimer.h
+++ b/Source/core/page/DOMTimer.h
@@ -40,13 +40,19 @@ class ScriptExecutionContext;
class DOMTimer : public SuspendableTimer {
public:
+ enum TimerType {
+ TimerTypeTimeout,
+ TimerTypeInterval
Ken Russell (switch to Gerrit) 2013/07/18 19:05:13 This seems verbose; since it's scoped in DOMTimer,
Yuta Kitamura 2013/07/19 05:14:08 Done.
+ };
+
// Creates a new timer owned by the ScriptExecutionContext, starts it and returns its ID.
- static int install(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int timeout, bool singleShot);
- static void removeByID(ScriptExecutionContext*, int timeoutID);
+ static int install(ScriptExecutionContext*, TimerType, PassOwnPtr<ScheduledAction>, int timeout);
+ static void removeByIDIfTypeMatches(ScriptExecutionContext*, TimerType, int timeoutID);
virtual ~DOMTimer();
int timeoutID() const;
+ TimerType timerType() const;
// ActiveDOMObject
virtual void contextDestroyed() OVERRIDE;
@@ -62,17 +68,18 @@ private:
friend class ScriptExecutionContext; // For create().
// Should only be used by ScriptExecutionContext.
- static PassOwnPtr<DOMTimer> create(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction> action, int timeout, bool singleShot, int timeoutID)
+ static PassOwnPtr<DOMTimer> create(ScriptExecutionContext* context, TimerType timerType, PassOwnPtr<ScheduledAction> action, int timeout, int timeoutID)
{
- return adoptPtr(new DOMTimer(context, action, timeout, singleShot, timeoutID));
+ return adoptPtr(new DOMTimer(context, timerType, action, timeout, timeoutID));
}
- DOMTimer(ScriptExecutionContext*, PassOwnPtr<ScheduledAction>, int interval, bool singleShot, int timeoutID);
- virtual void fired();
+ DOMTimer(ScriptExecutionContext*, TimerType, PassOwnPtr<ScheduledAction>, int interval, int timeoutID);
+ virtual void fired() OVERRIDE;
- // Retuns timer fire time rounded to the next multiple of timer alignment interval.
- virtual double alignedFireTime(double) const;
+ // Returns timer fire time rounded to the next multiple of timer alignment interval.
+ virtual double alignedFireTime(double) const OVERRIDE;
+ TimerType m_timerType;
int m_timeoutID;
int m_nestingLevel;
OwnPtr<ScheduledAction> m_action;

Powered by Google App Engine
This is Rietveld 408576698