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

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

Issue 2471153002: [scheduler] Use Finch to control background throttling. (Closed)
Patch Set: Address nits from skyostil@ 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 void EnableThrottling(); 187 void EnableThrottling();
188 188
189 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); } 189 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); }
190 190
191 static base::TimeTicks AlignedThrottledRunTime( 191 static base::TimeTicks AlignedThrottledRunTime(
192 base::TimeTicks unthrottled_runtime); 192 base::TimeTicks unthrottled_runtime);
193 193
194 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } 194 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; }
195 195
196 // Returned object is owned by |TaskQueueThrottler|. 196 // Returned object is owned by |TaskQueueThrottler|.
197 TimeBudgetPool* CreateTimeBudgetPool(const char* name); 197 TimeBudgetPool* CreateTimeBudgetPool(
198 const char* name,
199 base::Optional<base::TimeDelta> max_budget_level,
200 base::Optional<base::TimeDelta> max_throttling_duration);
198 201
199 // Accounts for given task for cpu-based throttling needs. 202 // Accounts for given task for cpu-based throttling needs.
200 void OnTaskRunTimeReported(TaskQueue* task_queue, 203 void OnTaskRunTimeReported(TaskQueue* task_queue,
201 base::TimeTicks start_time, 204 base::TimeTicks start_time,
202 base::TimeTicks end_time); 205 base::TimeTicks end_time);
203 206
204 void AsValueInto(base::trace_event::TracedValue* state, 207 void AsValueInto(base::trace_event::TracedValue* state,
205 base::TimeTicks now) const; 208 base::TimeTicks now) const;
206 209
207 private: 210 private:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 void MaybeDeleteQueueMetadata(TaskQueueMap::iterator it); 254 void MaybeDeleteQueueMetadata(TaskQueueMap::iterator it);
252 255
253 TaskQueueMap queue_details_; 256 TaskQueueMap queue_details_;
254 base::Callback<void(TaskQueue*)> forward_immediate_work_callback_; 257 base::Callback<void(TaskQueue*)> forward_immediate_work_callback_;
255 scoped_refptr<TaskQueue> task_runner_; 258 scoped_refptr<TaskQueue> task_runner_;
256 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED 259 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED
257 base::TickClock* tick_clock_; // NOT OWNED 260 base::TickClock* tick_clock_; // NOT OWNED
258 const char* tracing_category_; // NOT OWNED 261 const char* tracing_category_; // NOT OWNED
259 std::unique_ptr<ThrottledTimeDomain> time_domain_; 262 std::unique_ptr<ThrottledTimeDomain> time_domain_;
260 263
261 base::Optional<base::TimeDelta> max_budget_level_;
262 base::Optional<base::TimeDelta> max_throttling_duration_;
263
264 CancelableClosureHolder pump_throttled_tasks_closure_; 264 CancelableClosureHolder pump_throttled_tasks_closure_;
265 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_; 265 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_;
266 bool allow_throttling_; 266 bool allow_throttling_;
267 267
268 std::unordered_map<TimeBudgetPool*, std::unique_ptr<TimeBudgetPool>> 268 std::unordered_map<TimeBudgetPool*, std::unique_ptr<TimeBudgetPool>>
269 time_budget_pools_; 269 time_budget_pools_;
270 270
271 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; 271 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_;
272 272
273 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); 273 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler);
274 }; 274 };
275 275
276 } // namespace scheduler 276 } // namespace scheduler
277 } // namespace blink 277 } // namespace blink
278 278
279 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP ER_H_ 279 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698