| 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 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 DOMTimerCoordinator::DOMTimerCoordinator() | 13 DOMTimerCoordinator::DOMTimerCoordinator(WebTaskRunner* timerTaskRunner) |
| 14 : m_circularSequentialID(0) | 14 : m_circularSequentialID(0) |
| 15 , m_timerNestingLevel(0) | 15 , m_timerNestingLevel(0) |
| 16 , m_timerTaskRunner(timerTaskRunner) |
| 16 { | 17 { |
| 17 } | 18 } |
| 18 | 19 |
| 19 int DOMTimerCoordinator::installNewTimeout(ExecutionContext* context, PassOwnPtr
WillBeRawPtr<ScheduledAction> action, int timeout, bool singleShot) | 20 int DOMTimerCoordinator::installNewTimeout(ExecutionContext* context, PassOwnPtr
WillBeRawPtr<ScheduledAction> action, int timeout, bool singleShot) |
| 20 { | 21 { |
| 21 // FIXME: DOMTimers depends heavily on ExecutionContext. Decouple them. | 22 // FIXME: DOMTimers depends heavily on ExecutionContext. Decouple them. |
| 22 ASSERT(context->timers() == this); | 23 ASSERT(context->timers() == this); |
| 23 int timeoutID = nextID(); | 24 int timeoutID = nextID(); |
| 24 TimeoutMap::AddResult result = m_timers.add(timeoutID, DOMTimer::create(cont
ext, action, timeout, singleShot, timeoutID)); | 25 TimeoutMap::AddResult result = m_timers.add(timeoutID, DOMTimer::create(cont
ext, action, timeout, singleShot, timeoutID)); |
| 25 ASSERT(result.isNewEntry); | 26 ASSERT(result.isNewEntry); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 70 |
| 70 if (m_circularSequentialID <= 0) | 71 if (m_circularSequentialID <= 0) |
| 71 m_circularSequentialID = 1; | 72 m_circularSequentialID = 1; |
| 72 | 73 |
| 73 if (!m_timers.contains(m_circularSequentialID)) | 74 if (!m_timers.contains(m_circularSequentialID)) |
| 74 return m_circularSequentialID; | 75 return m_circularSequentialID; |
| 75 } | 76 } |
| 76 } | 77 } |
| 77 | 78 |
| 78 } // namespace blink | 79 } // namespace blink |
| OLD | NEW |