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

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

Issue 1162903005: Revert of Implement timers by posting delayed tasks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fetch/ResourceTest.cpp ('k') | Source/core/workers/WorkerThread.h » ('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();
47 for (TimeoutMap::iterator iter = m_timers.begin(); iter != m_timers.end(); + +iter) 46 for (TimeoutMap::iterator iter = m_timers.begin(); iter != m_timers.end(); + +iter)
48 iter->value->didChangeAlignmentInterval(now); 47 iter->value->didChangeAlignmentInterval();
49 } 48 }
50 49
51 DEFINE_TRACE(DOMTimerCoordinator) 50 DEFINE_TRACE(DOMTimerCoordinator)
52 { 51 {
53 #if ENABLE(OILPAN) 52 #if ENABLE(OILPAN)
54 visitor->trace(m_timers); 53 visitor->trace(m_timers);
55 #endif 54 #endif
56 } 55 }
57 56
58 int DOMTimerCoordinator::nextID() 57 int DOMTimerCoordinator::nextID()
59 { 58 {
60 while (true) { 59 while (true) {
61 ++m_circularSequentialID; 60 ++m_circularSequentialID;
62 61
63 if (m_circularSequentialID <= 0) 62 if (m_circularSequentialID <= 0)
64 m_circularSequentialID = 1; 63 m_circularSequentialID = 1;
65 64
66 if (!m_timers.contains(m_circularSequentialID)) 65 if (!m_timers.contains(m_circularSequentialID))
67 return m_circularSequentialID; 66 return m_circularSequentialID;
68 } 67 }
69 } 68 }
70 69
71 } // namespace blink 70 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/fetch/ResourceTest.cpp ('k') | Source/core/workers/WorkerThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698