OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DOMTimerCoordinator_h | 5 #ifndef DOMTimerCoordinator_h |
6 #define DOMTimerCoordinator_h | 6 #define DOMTimerCoordinator_h |
7 | 7 |
8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
9 #include "wtf/Noncopyable.h" | 9 #include "wtf/Noncopyable.h" |
10 #include "wtf/PassOwnPtr.h" | 10 #include "wtf/PassOwnPtr.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 public: | 27 public: |
28 explicit DOMTimerCoordinator(PassOwnPtr<WebTaskRunner>); | 28 explicit DOMTimerCoordinator(PassOwnPtr<WebTaskRunner>); |
29 | 29 |
30 // Creates and installs a new timer. Returns the assigned ID. | 30 // Creates and installs a new timer. Returns the assigned ID. |
31 int installNewTimeout(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAct
ion>, int timeout, bool singleShot); | 31 int installNewTimeout(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAct
ion>, int timeout, bool singleShot); |
32 | 32 |
33 // Removes and disposes the timer with the specified ID, if any. This may | 33 // Removes and disposes the timer with the specified ID, if any. This may |
34 // destroy the timer. | 34 // destroy the timer. |
35 void removeTimeoutByID(int id); | 35 void removeTimeoutByID(int id); |
36 | 36 |
37 // Notifies registered timers that | |
38 // ExecutionContext::timerAlignmentInterval has changed so that | |
39 // timers can adjust their schedule to the new alignment interval. | |
40 void didChangeTimerAlignmentInterval(); | |
41 | |
42 // Timers created during the execution of other timers, and | 37 // Timers created during the execution of other timers, and |
43 // repeating timers, are throttled. Timer nesting level tracks the | 38 // repeating timers, are throttled. Timer nesting level tracks the |
44 // number of linked timers or repetitions of a timer. See | 39 // number of linked timers or repetitions of a timer. See |
45 // https://html.spec.whatwg.org/#timers | 40 // https://html.spec.whatwg.org/#timers |
46 int timerNestingLevel() { return m_timerNestingLevel; } | 41 int timerNestingLevel() { return m_timerNestingLevel; } |
47 | 42 |
48 // Sets the timer nesting level. Set when a timer executes so that | 43 // Sets the timer nesting level. Set when a timer executes so that |
49 // any timers created while the timer is executing will incur a | 44 // any timers created while the timer is executing will incur a |
50 // deeper timer nesting level, see DOMTimer::DOMTimer. | 45 // deeper timer nesting level, see DOMTimer::DOMTimer. |
51 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } | 46 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } |
(...skipping 11 matching lines...) Expand all Loading... |
63 TimeoutMap m_timers; | 58 TimeoutMap m_timers; |
64 | 59 |
65 int m_circularSequentialID; | 60 int m_circularSequentialID; |
66 int m_timerNestingLevel; | 61 int m_timerNestingLevel; |
67 OwnPtr<WebTaskRunner> m_timerTaskRunner; | 62 OwnPtr<WebTaskRunner> m_timerTaskRunner; |
68 }; | 63 }; |
69 | 64 |
70 } // namespace blink | 65 } // namespace blink |
71 | 66 |
72 #endif // DOMTimerCoordinator_h | 67 #endif // DOMTimerCoordinator_h |
OLD | NEW |