| OLD | NEW |
| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 void EnableThrottling(); | 195 void EnableThrottling(); |
| 196 | 196 |
| 197 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); } | 197 const ThrottledTimeDomain* time_domain() const { return time_domain_.get(); } |
| 198 | 198 |
| 199 static base::TimeTicks AlignedThrottledRunTime( | 199 static base::TimeTicks AlignedThrottledRunTime( |
| 200 base::TimeTicks unthrottled_runtime); | 200 base::TimeTicks unthrottled_runtime); |
| 201 | 201 |
| 202 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } | 202 const scoped_refptr<TaskQueue>& task_runner() const { return task_runner_; } |
| 203 | 203 |
| 204 // Returned object is owned by |TaskQueueThrottler|. | 204 // Returned object is owned by |TaskQueueThrottler|. |
| 205 TimeBudgetPool* CreateTimeBudgetPool(const char* name); | 205 TimeBudgetPool* CreateTimeBudgetPool( |
| 206 const char* name, |
| 207 base::Optional<base::TimeDelta> max_budget_level, |
| 208 base::Optional<base::TimeDelta> max_throttling_duration); |
| 206 | 209 |
| 207 // Accounts for given task for cpu-based throttling needs. | 210 // Accounts for given task for cpu-based throttling needs. |
| 208 void OnTaskRunTimeReported(TaskQueue* task_queue, | 211 void OnTaskRunTimeReported(TaskQueue* task_queue, |
| 209 base::TimeTicks start_time, | 212 base::TimeTicks start_time, |
| 210 base::TimeTicks end_time); | 213 base::TimeTicks end_time); |
| 211 | 214 |
| 212 void AsValueInto(base::trace_event::TracedValue* state, | 215 void AsValueInto(base::trace_event::TracedValue* state, |
| 213 base::TimeTicks now) const; | 216 base::TimeTicks now) const; |
| 214 | 217 |
| 215 private: | 218 private: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 void MaybeDeleteQueueMetadata(TaskQueueMap::iterator it); | 262 void MaybeDeleteQueueMetadata(TaskQueueMap::iterator it); |
| 260 | 263 |
| 261 TaskQueueMap queue_details_; | 264 TaskQueueMap queue_details_; |
| 262 base::Callback<void(TaskQueue*)> forward_immediate_work_callback_; | 265 base::Callback<void(TaskQueue*)> forward_immediate_work_callback_; |
| 263 scoped_refptr<TaskQueue> task_runner_; | 266 scoped_refptr<TaskQueue> task_runner_; |
| 264 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED | 267 RendererSchedulerImpl* renderer_scheduler_; // NOT OWNED |
| 265 base::TickClock* tick_clock_; // NOT OWNED | 268 base::TickClock* tick_clock_; // NOT OWNED |
| 266 const char* tracing_category_; // NOT OWNED | 269 const char* tracing_category_; // NOT OWNED |
| 267 std::unique_ptr<ThrottledTimeDomain> time_domain_; | 270 std::unique_ptr<ThrottledTimeDomain> time_domain_; |
| 268 | 271 |
| 269 base::Optional<base::TimeDelta> max_budget_level_; | |
| 270 base::Optional<base::TimeDelta> max_throttling_duration_; | |
| 271 | |
| 272 CancelableClosureHolder pump_throttled_tasks_closure_; | 272 CancelableClosureHolder pump_throttled_tasks_closure_; |
| 273 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_; | 273 base::Optional<base::TimeTicks> pending_pump_throttled_tasks_runtime_; |
| 274 bool allow_throttling_; | 274 bool allow_throttling_; |
| 275 | 275 |
| 276 std::unordered_map<TimeBudgetPool*, std::unique_ptr<TimeBudgetPool>> | 276 std::unordered_map<TimeBudgetPool*, std::unique_ptr<TimeBudgetPool>> |
| 277 time_budget_pools_; | 277 time_budget_pools_; |
| 278 | 278 |
| 279 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; | 279 base::WeakPtrFactory<TaskQueueThrottler> weak_factory_; |
| 280 | 280 |
| 281 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); | 281 DISALLOW_COPY_AND_ASSIGN(TaskQueueThrottler); |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 } // namespace scheduler | 284 } // namespace scheduler |
| 285 } // namespace blink | 285 } // namespace blink |
| 286 | 286 |
| 287 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP
ER_H_ | 287 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_THROTTLING_HELP
ER_H_ |
| OLD | NEW |