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 <memory> | 10 #include <memory> |
(...skipping 16 matching lines...) Expand all Loading... |
27 public: | 27 public: |
28 explicit DOMTimerCoordinator(std::unique_ptr<WebTaskRunner>); | 28 explicit DOMTimerCoordinator(std::unique_ptr<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*, ScheduledAction*, int timeout, bool
singleShot); | 31 int installNewTimeout(ExecutionContext*, ScheduledAction*, 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 DOMTimer* removeTimeoutByID(int id); | 35 DOMTimer* removeTimeoutByID(int id); |
36 | 36 |
| 37 bool hasInstalledTimeout() const; |
| 38 |
37 // Timers created during the execution of other timers, and | 39 // Timers created during the execution of other timers, and |
38 // repeating timers, are throttled. Timer nesting level tracks the | 40 // repeating timers, are throttled. Timer nesting level tracks the |
39 // number of linked timers or repetitions of a timer. See | 41 // number of linked timers or repetitions of a timer. See |
40 // https://html.spec.whatwg.org/#timers | 42 // https://html.spec.whatwg.org/#timers |
41 int timerNestingLevel() { return m_timerNestingLevel; } | 43 int timerNestingLevel() { return m_timerNestingLevel; } |
42 | 44 |
43 // Sets the timer nesting level. Set when a timer executes so that | 45 // Sets the timer nesting level. Set when a timer executes so that |
44 // any timers created while the timer is executing will incur a | 46 // any timers created while the timer is executing will incur a |
45 // deeper timer nesting level, see DOMTimer::DOMTimer. | 47 // deeper timer nesting level, see DOMTimer::DOMTimer. |
46 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } | 48 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } |
(...skipping 11 matching lines...) Expand all Loading... |
58 TimeoutMap m_timers; | 60 TimeoutMap m_timers; |
59 | 61 |
60 int m_circularSequentialID; | 62 int m_circularSequentialID; |
61 int m_timerNestingLevel; | 63 int m_timerNestingLevel; |
62 std::unique_ptr<WebTaskRunner> m_timerTaskRunner; | 64 std::unique_ptr<WebTaskRunner> m_timerTaskRunner; |
63 }; | 65 }; |
64 | 66 |
65 } // namespace blink | 67 } // namespace blink |
66 | 68 |
67 #endif // DOMTimerCoordinator_h | 69 #endif // DOMTimerCoordinator_h |
OLD | NEW |