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