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

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

Issue 2483843002: Revert of [scheduler] Teach scheduler about audio state (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // becomes zero then |task_queue| is unthrottled. If the refcount was already 171 // becomes zero then |task_queue| is unthrottled. If the refcount was already
172 // zero this function does nothing. 172 // zero this function does nothing.
173 void DecreaseThrottleRefCount(TaskQueue* task_queue); 173 void DecreaseThrottleRefCount(TaskQueue* task_queue);
174 174
175 // Removes |task_queue| from |queue_details| and from appropriate budget pool. 175 // Removes |task_queue| from |queue_details| and from appropriate budget pool.
176 void UnregisterTaskQueue(TaskQueue* task_queue); 176 void UnregisterTaskQueue(TaskQueue* task_queue);
177 177
178 // Returns true if the |task_queue| is throttled. 178 // Returns true if the |task_queue| is throttled.
179 bool IsThrottled(TaskQueue* task_queue) const; 179 bool IsThrottled(TaskQueue* task_queue) const;
180 180
181 // Disable throttling for all queues, this setting takes precedence over 181 // Tells the TaskQueueThrottler we're using virtual time, which disables all
182 // all other throttling settings. Designed to be used when a global event 182 // throttling.
183 // disabling throttling happens (e.g. audio is playing). 183 void EnableVirtualTime();
184 void DisableThrottling();
185
186 // Enable back global throttling.
187 void EnableThrottling();
188 184
189 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); } 185 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); }
190 186
191 static base::TimeTicks AlignedThrottledRunTime( 187 static base::TimeTicks AlignedThrottledRunTime(
192 base::TimeTicks unthrottled_runtime); 188 base::TimeTicks unthrottled_runtime);
193 189
194 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } 190 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; }
195 191
196 // Returned object is owned by |TaskQueueThrottler|. 192 // Returned object is owned by |TaskQueueThrottler|.
197 TimeBudgetPool* CreateTimeBudgetPool(const char* name); 193 TimeBudgetPool* CreateTimeBudgetPool(const char* name);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED 252 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED
257 base::TickClock* tick_clock_; // NOT OWNED 253 base::TickClock* tick_clock_; // NOT OWNED
258 const char* tracing_category_; // NOT OWNED 254 const char* tracing_category_; // NOT OWNED
259 std::unique_ptr<ThrottledTimeDomain> time_domain_; 255 std::unique_ptr<ThrottledTimeDomain> time_domain_;
260 256
261 base::Optional<base::TimeDelta> max_budget_level_; 257 base::Optional<base::TimeDelta> max_budget_level_;
262 base::Optional<base::TimeDelta> max_throttling_duration_; 258 base::Optional<base::TimeDelta> max_throttling_duration_;
263 259
264 CancelableClosureHolder pump_throttled_tasks_closure_; 260 CancelableClosureHolder pump_throttled_tasks_closure_;
265 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_; 261 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_;
266 bool allow_throttling_; 262 bool virtual_time_;
267 263
268 std::unordered_map<TimeBudgetPool*, std::unique_ptr<TimeBudgetPool>> 264 std::unordered_map<TimeBudgetPool*, std::unique_ptr<TimeBudgetPool>>
269 time_budget_pools_; 265 time_budget_pools_;
270 266
271 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; 267 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_;
272 268
273 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); 269 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler);
274 }; 270 };
275 271
276 } // namespace scheduler 272 } // namespace scheduler
277 } // namespace blink 273 } // namespace blink
278 274
279 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP ER_H_ 275 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698