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 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 DOMTimerCoordinator::DOMTimerCoordinator() | 13 DOMTimerCoordinator::DOMTimerCoordinator() |
13 : m_circularSequentialID(0) | 14 : m_circularSequentialID(0) |
14 , m_timerNestingLevel(0) | 15 , m_timerNestingLevel(0) |
15 { | 16 { |
16 } | 17 } |
17 | 18 |
18 int DOMTimerCoordinator::installNewTimeout(ExecutionContext* context, PassOwnPtr
<ScheduledAction> action, int timeout, bool singleShot) | 19 int DOMTimerCoordinator::installNewTimeout(ExecutionContext* context, PassOwnPtr
WillBeRawPtr<ScheduledAction> action, int timeout, bool singleShot) |
19 { | 20 { |
20 // FIXME: DOMTimers depends heavily on ExecutionContext. Decouple them. | 21 // FIXME: DOMTimers depends heavily on ExecutionContext. Decouple them. |
21 ASSERT(context->timers() == this); | 22 ASSERT(context->timers() == this); |
22 int timeoutID = nextID(); | 23 int timeoutID = nextID(); |
23 TimeoutMap::AddResult result = m_timers.add(timeoutID, DOMTimer::create(cont
ext, action, timeout, singleShot, timeoutID)); | 24 TimeoutMap::AddResult result = m_timers.add(timeoutID, DOMTimer::create(cont
ext, action, timeout, singleShot, timeoutID)); |
24 ASSERT(result.isNewEntry); | 25 ASSERT(result.isNewEntry); |
25 DOMTimer* timer = result.storedValue->value.get(); | 26 DOMTimer* timer = result.storedValue->value.get(); |
26 | 27 |
27 timer->suspendIfNeeded(); | 28 timer->suspendIfNeeded(); |
28 | 29 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 61 |
61 if (m_circularSequentialID <= 0) | 62 if (m_circularSequentialID <= 0) |
62 m_circularSequentialID = 1; | 63 m_circularSequentialID = 1; |
63 | 64 |
64 if (!m_timers.contains(m_circularSequentialID)) | 65 if (!m_timers.contains(m_circularSequentialID)) |
65 return m_circularSequentialID; | 66 return m_circularSequentialID; |
66 } | 67 } |
67 } | 68 } |
68 | 69 |
69 } // namespace blink | 70 } // namespace blink |
OLD | NEW |