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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/renderer/task_queue_throttler.h

Issue 2403363003: [Merge to 2883] Revert "[scheduler] Teach scheduler about audio state" (Closed)
Patch Set: Created 4 years, 2 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_RENDERER_THROTTLING_HELPER_ H_ 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELPER_ H_
6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELPER_ H_ 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELPER_ H_
7 7
8 #include <set> 8 #include <set>
9 #include <unordered_map> 9 #include <unordered_map>
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // becomes zero then |task_queue| is unthrottled. If the refcount was already 153 // becomes zero then |task_queue| is unthrottled. If the refcount was already
154 // zero this function does nothing. 154 // zero this function does nothing.
155 void DecreaseThrottleRefCount(TaskQueue* task_queue); 155 void DecreaseThrottleRefCount(TaskQueue* task_queue);
156 156
157 // Removes |task_queue| from |queue_details| and from appropriate budget pool. 157 // Removes |task_queue| from |queue_details| and from appropriate budget pool.
158 void UnregisterTaskQueue(TaskQueue* task_queue); 158 void UnregisterTaskQueue(TaskQueue* task_queue);
159 159
160 // Returns true if the |task_queue| is throttled. 160 // Returns true if the |task_queue| is throttled.
161 bool IsThrottled(TaskQueue* task_queue) const; 161 bool IsThrottled(TaskQueue* task_queue) const;
162 162
163 // Disable throttling for all queues, this setting takes precedence over 163 // Tells the TaskQueueThrottler we're using virtual time, which disables all
164 // all other throttling settings. Designed to be used when a global event 164 // throttling.
165 // disabling throttling happens (e.g. audio is playing). 165 void EnableVirtualTime();
166 void DisableThrottling();
167
168 // Enable back global throttling.
169 void EnableThrottling();
170 166
171 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); } 167 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); }
172 168
173 static base::TimeTicks AlignedThrottledRunTime( 169 static base::TimeTicks AlignedThrottledRunTime(
174 base::TimeTicks unthrottled_runtime); 170 base::TimeTicks unthrottled_runtime);
175 171
176 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } 172 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; }
177 173
178 // Returned object is owned by |TaskQueueThrottler|. 174 // Returned object is owned by |TaskQueueThrottler|.
179 TimeBudgetPool* CreateTimeBudgetPool(const char* name); 175 TimeBudgetPool* CreateTimeBudgetPool(const char* name);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 TaskQueueMap queue_details_; 229 TaskQueueMap queue_details_;
234 base::Callback<void(TaskQueue*)> forward_immediate_work_callback_; 230 base::Callback<void(TaskQueue*)> forward_immediate_work_callback_;
235 scoped_refptr<TaskQueue> task_runner_; 231 scoped_refptr<TaskQueue> task_runner_;
236 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED 232 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED
237 base::TickClock* tick_clock_; // NOT OWNED 233 base::TickClock* tick_clock_; // NOT OWNED
238 const char* tracing_category_; // NOT OWNED 234 const char* tracing_category_; // NOT OWNED
239 std::unique_ptr<ThrottledTimeDomain> time_domain_; 235 std::unique_ptr<ThrottledTimeDomain> time_domain_;
240 236
241 CancelableClosureHolder pump_throttled_tasks_closure_; 237 CancelableClosureHolder pump_throttled_tasks_closure_;
242 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_; 238 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_;
243 bool allow_throttling_; 239 bool virtual_time_;
244 240
245 std::unordered_map<TimeBudgetPool*, std::unique_ptr<TimeBudgetPool>> 241 std::unordered_map<TimeBudgetPool*, std::unique_ptr<TimeBudgetPool>>
246 time_budget_pools_; 242 time_budget_pools_;
247 243
248 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; 244 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_;
249 245
250 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); 246 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler);
251 }; 247 };
252 248
253 } // namespace scheduler 249 } // namespace scheduler
254 } // namespace blink 250 } // namespace blink
255 251
256 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP ER_H_ 252 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698