| 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 #include "platform/scheduler/renderer/task_queue_throttler.h" | 5 #include "platform/scheduler/renderer/task_queue_throttler.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 base::TimeDelta delay = pending_pump_throttled_tasks_runtime_.value() - now; | 306 base::TimeDelta delay = pending_pump_throttled_tasks_runtime_.value() - now; |
| 307 TRACE_EVENT1(tracing_category_, | 307 TRACE_EVENT1(tracing_category_, |
| 308 "TaskQueueThrottler::MaybeSchedulePumpThrottledTasks", | 308 "TaskQueueThrottler::MaybeSchedulePumpThrottledTasks", |
| 309 "delay_till_next_pump_ms", delay.InMilliseconds()); | 309 "delay_till_next_pump_ms", delay.InMilliseconds()); |
| 310 task_runner_->PostDelayedTask( | 310 task_runner_->PostDelayedTask( |
| 311 from_here, pump_throttled_tasks_closure_.callback(), delay); | 311 from_here, pump_throttled_tasks_closure_.callback(), delay); |
| 312 } | 312 } |
| 313 | 313 |
| 314 CPUTimeBudgetPool* TaskQueueThrottler::CreateCPUTimeBudgetPool( | 314 CPUTimeBudgetPool* TaskQueueThrottler::CreateCPUTimeBudgetPool( |
| 315 const char* name, | 315 const char* name) { |
| 316 base::Optional<base::TimeDelta> max_budget_level, | |
| 317 base::Optional<base::TimeDelta> max_throttling_duration) { | |
| 318 CPUTimeBudgetPool* time_budget_pool = | 316 CPUTimeBudgetPool* time_budget_pool = |
| 319 new CPUTimeBudgetPool(name, this, tick_clock_->NowTicks(), | 317 new CPUTimeBudgetPool(name, this, tick_clock_->NowTicks()); |
| 320 max_budget_level, max_throttling_duration); | |
| 321 budget_pools_[time_budget_pool] = base::WrapUnique(time_budget_pool); | 318 budget_pools_[time_budget_pool] = base::WrapUnique(time_budget_pool); |
| 322 return time_budget_pool; | 319 return time_budget_pool; |
| 323 } | 320 } |
| 324 | 321 |
| 325 void TaskQueueThrottler::OnTaskRunTimeReported(TaskQueue* task_queue, | 322 void TaskQueueThrottler::OnTaskRunTimeReported(TaskQueue* task_queue, |
| 326 base::TimeTicks start_time, | 323 base::TimeTicks start_time, |
| 327 base::TimeTicks end_time) { | 324 base::TimeTicks end_time) { |
| 328 if (!IsThrottled(task_queue)) | 325 if (!IsThrottled(task_queue)) |
| 329 return; | 326 return; |
| 330 | 327 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 queue->InsertFence(TaskQueue::InsertFencePosition::BEGINNING_OF_TIME); | 488 queue->InsertFence(TaskQueue::InsertFencePosition::BEGINNING_OF_TIME); |
| 492 queue->SetTimeDomain(time_domain_.get()); | 489 queue->SetTimeDomain(time_domain_.get()); |
| 493 SchedulePumpQueue(FROM_HERE, lazy_now.Now(), queue); | 490 SchedulePumpQueue(FROM_HERE, lazy_now.Now(), queue); |
| 494 } | 491 } |
| 495 | 492 |
| 496 TRACE_EVENT0(tracing_category_, "TaskQueueThrottler_EnableThrottling"); | 493 TRACE_EVENT0(tracing_category_, "TaskQueueThrottler_EnableThrottling"); |
| 497 } | 494 } |
| 498 | 495 |
| 499 } // namespace scheduler | 496 } // namespace scheduler |
| 500 } // namespace blink | 497 } // namespace blink |
| OLD | NEW |