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

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: Fix perftest Created 4 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 // 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 // If there is a scheduled delayed task, |out_task_queue| is set to the queue 89 // If there is a scheduled delayed task, |out_task_queue| is set to the queue
90 // the next task was posted to and it returns true. Returns false otherwise. 90 // the next task was posted to and it returns true. Returns false otherwise.
91 bool NextScheduledTaskQueue(TaskQueue** out_task_queue) const; 91 bool NextScheduledTaskQueue(TaskQueue** out_task_queue) const;
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
100 // Cancels any delayed work requested for |queue|.
101 void CancelDelayedWork(internal::TaskQueueImpl* queue);
99 102
100 // Registers the |queue|. 103 // Registers the |queue|.
101 void RegisterQueue(internal::TaskQueueImpl* queue); 104 void RegisterQueue(internal::TaskQueueImpl* queue);
102 105
103 // Removes |queue| from all internal data structures. 106 // Removes |queue| from all internal data structures.
104 void UnregisterQueue(internal::TaskQueueImpl* queue); 107 void UnregisterQueue(internal::TaskQueueImpl* queue);
105 108
106 // Tells the time domain that |queue| went from having no immediate work to 109 // Tells the time domain that |queue| went from having no immediate work to
107 // having some. 110 // having some.
108 void OnQueueHasImmediateWork(internal::TaskQueueImpl* queue); 111 void OnQueueHasImmediateWork(internal::TaskQueueImpl* queue);
109 112
110 // Called by the TaskQueueManager when the TimeDomain is registered. 113 // Called by the TaskQueueManager when the TimeDomain is registered.
111 virtual void OnRegisterWithTaskQueueManager( 114 virtual void OnRegisterWithTaskQueueManager(
112 TaskQueueManager* task_queue_manager) = 0; 115 TaskQueueManager* task_queue_manager) = 0;
113 116
114 // The implementaion will secedule task processing to run with |delay| with 117 // 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. 118 // within the TimeDomain's time line. Only called from the main thread.
116 // NOTE this is only called by ScheduleDelayedWork if the scheduled runtime 119 // 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 120 // is sooner than any previously sheduled work or if there is no other
118 // scheduled work. 121 // scheduled work.
119 virtual void RequestWakeup(base::TimeTicks now, base::TimeDelta delay) = 0; 122 virtual void RequestWakeupAt(LazyNow* lazy_now, base::TimeTicks run_time) = 0;
123
124 // The implementation will cancel a wake up previously requested by
125 // RequestWakeupAt.
126 virtual void CancelWakeupAt(base::TimeTicks run_time) = 0;
120 127
121 // For implementation specific tracing. 128 // For implementation specific tracing.
122 virtual void AsValueIntoInternal( 129 virtual void AsValueIntoInternal(
123 base::trace_event::TracedValue* state) const = 0; 130 base::trace_event::TracedValue* state) const = 0;
124 131
125 // Call TaskQueueImpl::UpdateDelayedWorkQueue for each queue where the delay 132 // Call TaskQueueImpl::UpdateDelayedWorkQueue for each queue where the delay
126 // has elapsed. 133 // has elapsed.
127 void WakeupReadyDelayedQueues(LazyNow* lazy_now); 134 void WakeupReadyDelayedQueues(LazyNow* lazy_now);
128 135
129 size_t NumberOfScheduledWakeups() const { 136 size_t NumberOfScheduledWakeups() const {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 168
162 base::ThreadChecker main_thread_checker_; 169 base::ThreadChecker main_thread_checker_;
163 170
164 DISALLOW_COPY_AND_ASSIGN(TimeDomain); 171 DISALLOW_COPY_AND_ASSIGN(TimeDomain);
165 }; 172 };
166 173
167 } // namespace scheduler 174 } // namespace scheduler
168 } // namespace blink 175 } // namespace blink
169 176
170 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_ 177 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_TIME_DOMAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698