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 #include "config.h" | 5 #include "config.h" |
6 #include "core/frame/DOMTimerCoordinator.h" | 6 #include "core/frame/DOMTimerCoordinator.h" |
7 | 7 |
8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
9 #include "core/frame/DOMTimer.h" | 9 #include "core/frame/DOMTimer.h" |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 return; | 36 return; |
37 | 37 |
38 if (DOMTimer* removedTimer = m_timers.get(timeoutID)) | 38 if (DOMTimer* removedTimer = m_timers.get(timeoutID)) |
39 removedTimer->dispose(); | 39 removedTimer->dispose(); |
40 | 40 |
41 m_timers.remove(timeoutID); | 41 m_timers.remove(timeoutID); |
42 } | 42 } |
43 | 43 |
44 void DOMTimerCoordinator::didChangeTimerAlignmentInterval() | 44 void DOMTimerCoordinator::didChangeTimerAlignmentInterval() |
45 { | 45 { |
| 46 double now = monotonicallyIncreasingTime(); |
46 for (TimeoutMap::iterator iter = m_timers.begin(); iter != m_timers.end(); +
+iter) | 47 for (TimeoutMap::iterator iter = m_timers.begin(); iter != m_timers.end(); +
+iter) |
47 iter->value->didChangeAlignmentInterval(); | 48 iter->value->didChangeAlignmentInterval(now); |
48 } | 49 } |
49 | 50 |
50 DEFINE_TRACE(DOMTimerCoordinator) | 51 DEFINE_TRACE(DOMTimerCoordinator) |
51 { | 52 { |
52 #if ENABLE(OILPAN) | 53 #if ENABLE(OILPAN) |
53 visitor->trace(m_timers); | 54 visitor->trace(m_timers); |
54 #endif | 55 #endif |
55 } | 56 } |
56 | 57 |
57 int DOMTimerCoordinator::nextID() | 58 int DOMTimerCoordinator::nextID() |
58 { | 59 { |
59 while (true) { | 60 while (true) { |
60 ++m_circularSequentialID; | 61 ++m_circularSequentialID; |
61 | 62 |
62 if (m_circularSequentialID <= 0) | 63 if (m_circularSequentialID <= 0) |
63 m_circularSequentialID = 1; | 64 m_circularSequentialID = 1; |
64 | 65 |
65 if (!m_timers.contains(m_circularSequentialID)) | 66 if (!m_timers.contains(m_circularSequentialID)) |
66 return m_circularSequentialID; | 67 return m_circularSequentialID; |
67 } | 68 } |
68 } | 69 } |
69 | 70 |
70 } // namespace blink | 71 } // namespace blink |
OLD | NEW |