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

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

Issue 1477353002: Revert of Move throttling of background timers into the renderer scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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;
64 double repeatInterval() const { return m_repeatInterval; } 65 double repeatInterval() const { return m_repeatInterval; }
65 66
66 void augmentRepeatInterval(double delta) { 67 void augmentRepeatInterval(double delta) {
67 double now = monotonicallyIncreasingTime(); 68 double now = monotonicallyIncreasingTime();
68 setNextFireTime(now, m_nextFireTime - now + delta); 69 setNextFireTime(now, m_nextFireTime - now + delta);
69 m_repeatInterval += delta; 70 m_repeatInterval += delta;
70 } 71 }
71 72
73 void didChangeAlignmentInterval(double now);
74
72 struct PLATFORM_EXPORT Comparator { 75 struct PLATFORM_EXPORT Comparator {
73 bool operator()(const TimerBase* a, const TimerBase* b) const; 76 bool operator()(const TimerBase* a, const TimerBase* b) const;
74 }; 77 };
75 78
76 private: 79 private:
77 virtual void fired() = 0; 80 virtual void fired() = 0;
78 81
79 virtual WebTaskRunner* timerTaskRunner(); 82 virtual WebTaskRunner* timerTaskRunner();
80 83
81 NO_LAZY_SWEEP_SANITIZE_ADDRESS 84 NO_LAZY_SWEEP_SANITIZE_ADDRESS
(...skipping 29 matching lines...) Expand all
111 void cancel() 114 void cancel()
112 { 115 {
113 m_timer = nullptr; 116 m_timer = nullptr;
114 } 117 }
115 118
116 private: 119 private:
117 TimerBase* m_timer; // NOT OWNED 120 TimerBase* m_timer; // NOT OWNED
118 }; 121 };
119 122
120 double m_nextFireTime; // 0 if inactive 123 double m_nextFireTime; // 0 if inactive
124 double m_unalignedNextFireTime; // m_nextFireTime not considering alignment interval
121 double m_repeatInterval; // 0 if not repeating 125 double m_repeatInterval; // 0 if not repeating
122 WebTraceLocation m_location; 126 WebTraceLocation m_location;
123 CancellableTimerTask* m_cancellableTimerTask; // NOT OWNED 127 CancellableTimerTask* m_cancellableTimerTask; // NOT OWNED
124 WebScheduler* m_webScheduler; // Not owned. 128 WebScheduler* m_webScheduler; // Not owned.
125 129
126 #if ENABLE(ASSERT) 130 #if ENABLE(ASSERT)
127 ThreadIdentifier m_thread; 131 ThreadIdentifier m_thread;
128 #endif 132 #endif
129 133
130 friend class ThreadTimers; 134 friend class ThreadTimers;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 NO_LAZY_SWEEP_SANITIZE_ADDRESS 188 NO_LAZY_SWEEP_SANITIZE_ADDRESS
185 inline bool TimerBase::isActive() const 189 inline bool TimerBase::isActive() const
186 { 190 {
187 ASSERT(m_thread == currentThread()); 191 ASSERT(m_thread == currentThread());
188 return m_cancellableTimerTask; 192 return m_cancellableTimerTask;
189 } 193 }
190 194
191 } // namespace blink 195 } // namespace blink
192 196
193 #endif // Timer_h 197 #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