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

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

Issue 1646583002: [Reland] Per WebViewScheduler virtual time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: WebViewSchedulerImpl to unregister the virtual_time_domain_ in the destructor Created 4 years, 10 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 static WebTaskRunner* UnthrottledWebTaskRunner(); 79 static WebTaskRunner* UnthrottledWebTaskRunner();
80 80
81 private: 81 private:
82 virtual void fired() = 0; 82 virtual void fired() = 0;
83 83
84 virtual WebTaskRunner* timerTaskRunner(); 84 virtual WebTaskRunner* timerTaskRunner();
85 85
86 NO_LAZY_SWEEP_SANITIZE_ADDRESS 86 NO_LAZY_SWEEP_SANITIZE_ADDRESS
87 virtual bool canFire() const { return true; } 87 virtual bool canFire() const { return true; }
88 88
89 double time() const;
90
89 void setNextFireTime(double now, double delay); 91 void setNextFireTime(double now, double delay);
90 92
91 void runInternal(); 93 void runInternal();
92 94
93 class CancellableTimerTask final : public WebTaskRunner::Task { 95 class CancellableTimerTask final : public WebTaskRunner::Task {
94 WTF_MAKE_NONCOPYABLE(CancellableTimerTask); 96 WTF_MAKE_NONCOPYABLE(CancellableTimerTask);
95 public: 97 public:
96 explicit CancellableTimerTask(TimerBase* timer) : m_timer(timer) { } 98 explicit CancellableTimerTask(TimerBase* timer) : m_timer(timer) { }
97 99
98 ~CancellableTimerTask() override 100 ~CancellableTimerTask() override
(...skipping 17 matching lines...) Expand all
116 m_timer = nullptr; 118 m_timer = nullptr;
117 } 119 }
118 120
119 private: 121 private:
120 TimerBase* m_timer; // NOT OWNED 122 TimerBase* m_timer; // NOT OWNED
121 }; 123 };
122 124
123 double m_nextFireTime; // 0 if inactive 125 double m_nextFireTime; // 0 if inactive
124 double m_repeatInterval; // 0 if not repeating 126 double m_repeatInterval; // 0 if not repeating
125 WebTraceLocation m_location; 127 WebTraceLocation m_location;
126 CancellableTimerTask* m_cancellableTimerTask; // NOT OWNED 128 CancellableTimerTask* m_cancellableTimerTask; // Not owned.
127 WebTaskRunner* m_webTaskRunner; // Not owned. 129 WebTaskRunner* m_webTaskRunner; // Not owned.
128 130
129 #if ENABLE(ASSERT) 131 #if ENABLE(ASSERT)
130 ThreadIdentifier m_thread; 132 ThreadIdentifier m_thread;
131 #endif 133 #endif
132 134
133 friend class ThreadTimers; 135 friend class ThreadTimers;
134 friend class TimerHeapLessThanFunction; 136 friend class TimerHeapLessThanFunction;
135 friend class TimerHeapReference; 137 friend class TimerHeapReference;
136 }; 138 };
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 NO_LAZY_SWEEP_SANITIZE_ADDRESS 211 NO_LAZY_SWEEP_SANITIZE_ADDRESS
210 inline bool TimerBase::isActive() const 212 inline bool TimerBase::isActive() const
211 { 213 {
212 ASSERT(m_thread == currentThread()); 214 ASSERT(m_thread == currentThread());
213 return m_cancellableTimerTask; 215 return m_cancellableTimerTask;
214 } 216 }
215 217
216 } // namespace blink 218 } // namespace blink
217 219
218 #endif // Timer_h 220 #endif // Timer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698