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

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

Issue 847803002: Make ScriptStreamer and dependents Oilpan friendly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add ScriptSourceCode::isNull() comment Created 5 years, 11 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/frame/DOMTimer.cpp ('k') | Source/core/frame/DOMTimerCoordinator.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 #ifndef DOMTimerCoordinator_h 5 #ifndef DOMTimerCoordinator_h
6 #define DOMTimerCoordinator_h 6 #define DOMTimerCoordinator_h
7 7
8 #include "core/frame/DOMTimer.h"
9 #include "platform/heap/Handle.h" 8 #include "platform/heap/Handle.h"
10 #include "wtf/Noncopyable.h" 9 #include "wtf/Noncopyable.h"
11 #include "wtf/PassOwnPtr.h" 10 #include "wtf/PassOwnPtr.h"
12 11
13 namespace blink { 12 namespace blink {
14 13
15 class DOMTimer; 14 class DOMTimer;
16 class ExecutionContext; 15 class ExecutionContext;
17 class ScheduledAction; 16 class ScheduledAction;
18 17
19 // Maintains a set of DOMTimers for a given page or 18 // Maintains a set of DOMTimers for a given page or
20 // worker. DOMTimerCoordinator assigns IDs to timers; these IDs are 19 // worker. DOMTimerCoordinator assigns IDs to timers; these IDs are
21 // the ones returned to web authors from setTimeout or setInterval. It 20 // the ones returned to web authors from setTimeout or setInterval. It
22 // also tracks recursive creation or iterative scheduling of timers, 21 // also tracks recursive creation or iterative scheduling of timers,
23 // which is used as a signal for throttling repetitive timers. 22 // which is used as a signal for throttling repetitive timers.
24 class DOMTimerCoordinator { 23 class DOMTimerCoordinator {
25 DISALLOW_ALLOCATION(); 24 DISALLOW_ALLOCATION();
26 WTF_MAKE_NONCOPYABLE(DOMTimerCoordinator); 25 WTF_MAKE_NONCOPYABLE(DOMTimerCoordinator);
27 public: 26 public:
28 DOMTimerCoordinator(); 27 DOMTimerCoordinator();
29 28
30 // Creates and installs a new timer. Returns the assigned ID. 29 // Creates and installs a new timer. Returns the assigned ID.
31 int installNewTimeout(ExecutionContext*, PassOwnPtr<ScheduledAction>, int ti meout, bool singleShot); 30 int installNewTimeout(ExecutionContext*, PassOwnPtrWillBeRawPtr<ScheduledAct ion>, int timeout, bool singleShot);
32 31
33 // Removes and disposes the timer with the specified ID, if any. This may 32 // Removes and disposes the timer with the specified ID, if any. This may
34 // destroy the timer. 33 // destroy the timer.
35 void removeTimeoutByID(int id); 34 void removeTimeoutByID(int id);
36 35
37 // Notifies registered timers that 36 // Notifies registered timers that
38 // ExecutionContext::timerAlignmentInterval has changed so that 37 // ExecutionContext::timerAlignmentInterval has changed so that
39 // timers can adjust their schedule to the new alignment interval. 38 // timers can adjust their schedule to the new alignment interval.
40 void didChangeTimerAlignmentInterval(); 39 void didChangeTimerAlignmentInterval();
41 40
42 // Timers created during the execution of other timers, and 41 // Timers created during the execution of other timers, and
43 // repeating timers, are throttled. Timer nesting level tracks the 42 // repeating timers, are throttled. Timer nesting level tracks the
44 // number of linked timers or repetitions of a timer. See 43 // number of linked timers or repetitions of a timer. See
45 // https://html.spec.whatwg.org/#timers 44 // https://html.spec.whatwg.org/#timers
46 int timerNestingLevel() { return m_timerNestingLevel; } 45 int timerNestingLevel() { return m_timerNestingLevel; }
47 46
48 // Sets the timer nesting level. Set when a timer executes so that 47 // Sets the timer nesting level. Set when a timer executes so that
49 // any timers created while the timer is executing will incur a 48 // any timers created while the timer is executing will incur a
50 // deeper timer nesting level, see DOMTimer::DOMTimer. 49 // deeper timer nesting level, see DOMTimer::DOMTimer.
51 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; } 50 void setTimerNestingLevel(int level) { m_timerNestingLevel = level; }
52 51
53 void trace(Visitor*); // Oilpan. 52 void trace(Visitor*); // Oilpan.
54 53
55 private: 54 private:
56 int nextID(); 55 int nextID();
57 56
58 typedef WillBeHeapHashMap<int, RefPtrWillBeMember<DOMTimer> > TimeoutMap; 57 using TimeoutMap = WillBeHeapHashMap<int, RefPtrWillBeMember<DOMTimer>>;
59 TimeoutMap m_timers; 58 TimeoutMap m_timers;
60 59
61 int m_circularSequentialID; 60 int m_circularSequentialID;
62 int m_timerNestingLevel; 61 int m_timerNestingLevel;
63 }; 62 };
64 63
65 } // namespace blink 64 } // namespace blink
66 65
67 #endif // DOMTimerCoordinator_h 66 #endif // DOMTimerCoordinator_h
OLDNEW
« no previous file with comments | « Source/core/frame/DOMTimer.cpp ('k') | Source/core/frame/DOMTimerCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698