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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/base/time_domain.h

Issue 2572893002: [Reland] Dont post delayed DoWork for disabled queues. (Closed)
Patch Set: Rebased Created 3 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 // 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 // Notifies the time domain observer (if any) that |queue| has incoming 89 // Notifies the time domain observer (if any) that |queue| has incoming
90 // immediate work. 90 // immediate work.
91 void OnQueueHasImmediateWork(internal::TaskQueueImpl* queue); 91 void OnQueueHasImmediateWork(internal::TaskQueueImpl* queue);
92 92
93 // Schedules a call to TaskQueueImpl::WakeUpForDelayedWork when this 93 // Schedules a call to TaskQueueImpl::WakeUpForDelayedWork when this
94 // TimeDomain reaches |delayed_run_time|. This supersedes any previously 94 // TimeDomain reaches |delayed_run_time|. This supersedes any previously
95 // registered wakeup for |queue|. 95 // registered wakeup for |queue|.
96 void ScheduleDelayedWork(internal::TaskQueueImpl* queue, 96 void ScheduleDelayedWork(internal::TaskQueueImpl* queue,
97 base::TimeTicks delayed_run_time, 97 base::TimeTicks delayed_run_time,
98 base::TimeTicks now); 98 LazyNow* lazy_now);
99 99
100 // Cancels any scheduled calls to TaskQueueImpl::WakeUpForDelayedWork for 100 // Cancels any scheduled calls to TaskQueueImpl::WakeUpForDelayedWork for
101 // |queue|. 101 // |queue|.
102 void CancelDelayedWork(internal::TaskQueueImpl* queue); 102 void CancelDelayedWork(internal::TaskQueueImpl* queue);
103 103
104 // Registers the |queue|. 104 // Registers the |queue|.
105 void RegisterQueue(internal::TaskQueueImpl* queue); 105 void RegisterQueue(internal::TaskQueueImpl* queue);
106 106
107 // Removes |queue| from all internal data structures. 107 // Removes |queue| from all internal data structures.
108 void UnregisterQueue(internal::TaskQueueImpl* queue); 108 void UnregisterQueue(internal::TaskQueueImpl* queue);
109 109
110 // Called by the TaskQueueManager when the TimeDomain is registered. 110 // Called by the TaskQueueManager when the TimeDomain is registered.
111 virtual void OnRegisterWithTaskQueueManager( 111 virtual void OnRegisterWithTaskQueueManager(
112 TaskQueueManager* task_queue_manager) = 0; 112 TaskQueueManager* task_queue_manager) = 0;
113 113
114 // The implementaion will secedule task processing to run with |delay| with 114 // The implementation will schedule task processing to run at time |run_time|
115 // respect to the TimeDomain's time source. Always called on the main thread. 115 // within the TimeDomain's time line. Only called from the main thread.
116 // NOTE this is only called by ScheduleDelayedWork if the scheduled runtime 116 // NOTE this is only called by ScheduleDelayedWork if the scheduled runtime
117 // is sooner than any previously sheduled work or if there is no other 117 // is sooner than any previously sheduled work or if there is no other
118 // scheduled work. 118 // scheduled work.
119 virtual void RequestWakeup(base::TimeTicks now, base::TimeDelta delay) = 0; 119 virtual void RequestWakeupAt(LazyNow* lazy_now, base::TimeTicks run_time) = 0;
120
121 // The implementation will cancel a wake up previously requested by
122 // RequestWakeupAt. It's expected this will be a NOP for most virtual time
123 // domains.
124 virtual void CancelWakeupAt(base::TimeTicks run_time) = 0;
120 125
121 // For implementation specific tracing. 126 // For implementation specific tracing.
122 virtual void AsValueIntoInternal( 127 virtual void AsValueIntoInternal(
123 base::trace_event::TracedValue* state) const = 0; 128 base::trace_event::TracedValue* state) const = 0;
124 129
125 // Call TaskQueueImpl::UpdateDelayedWorkQueue for each queue where the delay 130 // Call TaskQueueImpl::UpdateDelayedWorkQueue for each queue where the delay
126 // has elapsed. 131 // has elapsed.
127 void WakeupReadyDelayedQueues(LazyNow* lazy_now); 132 void WakeupReadyDelayedQueues(LazyNow* lazy_now);
128 133
129 size_t NumberOfScheduledWakeups() const { 134 size_t NumberOfScheduledWakeups() const {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 166
162 base::ThreadChecker main_thread_checker_; 167 base::ThreadChecker main_thread_checker_;
163 168
164 DISALLOW_COPY_AND_ASSIGN(TimeDomain); 169 DISALLOW_COPY_AND_ASSIGN(TimeDomain);
165 }; 170 };
166 171
167 } // namespace scheduler 172 } // namespace scheduler
168 } // namespace blink 173 } // namespace blink
169 174
170 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ 175 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698