Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: Source/core/frame/DOMTimerCoordinator.cpp

Issue 956333002: Refactor TimeBase to post tasks. Workers to use real Idle tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/fetch/ResourceTest.cpp ('k') | Source/core/workers/WorkerGlobalScope.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « Source/core/fetch/ResourceTest.cpp ('k') | Source/core/workers/WorkerGlobalScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698