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

Side by Side Diff: third_party/WebKit/Source/platform/Timer.h

Issue 1441073006: Move throttling of background timers into the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last few changes Sami requested Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void startOneShot(double interval, const WebTraceLocation& caller) 54 void startOneShot(double interval, const WebTraceLocation& caller)
55 { 55 {
56 start(interval, 0, caller); 56 start(interval, 0, caller);
57 } 57 }
58 58
59 void stop(); 59 void stop();
60 bool isActive() const; 60 bool isActive() const;
61 const WebTraceLocation& location() const { return m_location; } 61 const WebTraceLocation& location() const { return m_location; }
62 62
63 double nextFireInterval() const; 63 double nextFireInterval() const;
64 double nextUnalignedFireInterval() const;
65 double repeatInterval() const { return m_repeatInterval; } 64 double repeatInterval() const { return m_repeatInterval; }
66 65
67 void augmentRepeatInterval(double delta) { 66 void augmentRepeatInterval(double delta) {
68 double now = monotonicallyIncreasingTime(); 67 double now = monotonicallyIncreasingTime();
69 setNextFireTime(now, m_nextFireTime - now + delta); 68 setNextFireTime(now, m_nextFireTime - now + delta);
70 m_repeatInterval += delta; 69 m_repeatInterval += delta;
71 } 70 }
72 71
73 void didChangeAlignmentInterval(double now);
74
75 struct PLATFORM_EXPORT Comparator { 72 struct PLATFORM_EXPORT Comparator {
76 bool operator()(const TimerBase* a, const TimerBase* b) const; 73 bool operator()(const TimerBase* a, const TimerBase* b) const;
77 }; 74 };
78 75
79 private: 76 private:
80 virtual void fired() = 0; 77 virtual void fired() = 0;
81 78
82 virtual WebTaskRunner* timerTaskRunner(); 79 virtual WebTaskRunner* timerTaskRunner();
83 80
84 NO_LAZY_SWEEP_SANITIZE_ADDRESS 81 NO_LAZY_SWEEP_SANITIZE_ADDRESS
(...skipping 29 matching lines...) Expand all
114 void cancel() 111 void cancel()
115 { 112 {
116 m_timer = nullptr; 113 m_timer = nullptr;
117 } 114 }
118 115
119 private: 116 private:
120 TimerBase* m_timer; // NOT OWNED 117 TimerBase* m_timer; // NOT OWNED
121 }; 118 };
122 119
123 double m_nextFireTime; // 0 if inactive 120 double m_nextFireTime; // 0 if inactive
124 double m_unalignedNextFireTime; // m_nextFireTime not considering alignment interval
125 double m_repeatInterval; // 0 if not repeating 121 double m_repeatInterval; // 0 if not repeating
126 WebTraceLocation m_location; 122 WebTraceLocation m_location;
127 CancellableTimerTask* m_cancellableTimerTask; // NOT OWNED 123 CancellableTimerTask* m_cancellableTimerTask; // NOT OWNED
128 WebScheduler* m_webScheduler; // Not owned. 124 WebScheduler* m_webScheduler; // Not owned.
129 125
130 #if ENABLE(ASSERT) 126 #if ENABLE(ASSERT)
131 ThreadIdentifier m_thread; 127 ThreadIdentifier m_thread;
132 #endif 128 #endif
133 129
134 friend class ThreadTimers; 130 friend class ThreadTimers;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 NO_LAZY_SWEEP_SANITIZE_ADDRESS 184 NO_LAZY_SWEEP_SANITIZE_ADDRESS
189 inline bool TimerBase::isActive() const 185 inline bool TimerBase::isActive() const
190 { 186 {
191 ASSERT(m_thread == currentThread()); 187 ASSERT(m_thread == currentThread());
192 return m_cancellableTimerTask; 188 return m_cancellableTimerTask;
193 } 189 }
194 190
195 } // namespace blink 191 } // namespace blink
196 192
197 #endif // Timer_h 193 #endif // Timer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp ('k') | third_party/WebKit/Source/platform/Timer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698