| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 pump_throttled_tasks_closure_.Reset(base::Bind( | 293 pump_throttled_tasks_closure_.Reset(base::Bind( |
| 294 &TaskQueueThrottler::PumpThrottledTasks, weak_factory_.GetWeakPtr())); | 294 &TaskQueueThrottler::PumpThrottledTasks, weak_factory_.GetWeakPtr())); |
| 295 forward_immediate_work_callback_ = | 295 forward_immediate_work_callback_ = |
| 296 base::Bind(&TaskQueueThrottler::OnTimeDomainHasImmediateWork, | 296 base::Bind(&TaskQueueThrottler::OnTimeDomainHasImmediateWork, |
| 297 weak_factory_.GetWeakPtr()); | 297 weak_factory_.GetWeakPtr()); |
| 298 | 298 |
| 299 renderer_scheduler_->RegisterTimeDomain(time_domain_.get()); | 299 renderer_scheduler_->RegisterTimeDomain(time_domain_.get()); |
| 300 } | 300 } |
| 301 | 301 |
| 302 TaskQueueThrottler::~TaskQueueThrottler() { | 302 TaskQueueThrottler::~TaskQueueThrottler() { |
| 303 // If the shutdown has been called we can just bail out. |
| 304 if (!renderer_scheduler_->real_time_domain()) |
| 305 return; |
| 303 // It's possible for queues to be still throttled, so we need to tidy up | 306 // It's possible for queues to be still throttled, so we need to tidy up |
| 304 // before unregistering the time domain. | 307 // before unregistering the time domain. |
| 305 for (const TaskQueueMap::value_type& map_entry : queue_details_) { | 308 for (const TaskQueueMap::value_type& map_entry : queue_details_) { |
| 306 TaskQueue* task_queue = map_entry.first; | 309 TaskQueue* task_queue = map_entry.first; |
| 307 if (IsThrottled(task_queue)) { | 310 if (IsThrottled(task_queue)) { |
| 308 task_queue->SetTimeDomain(renderer_scheduler_->real_time_domain()); | 311 task_queue->SetTimeDomain(renderer_scheduler_->real_time_domain()); |
| 309 task_queue->RemoveFence(); | 312 task_queue->RemoveFence(); |
| 310 } | 313 } |
| 311 } | 314 } |
| 312 | 315 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 queue->SetTimeDomain(time_domain_.get()); | 642 queue->SetTimeDomain(time_domain_.get()); |
| 640 MaybeSchedulePumpQueue(FROM_HERE, lazy_now.Now(), queue, | 643 MaybeSchedulePumpQueue(FROM_HERE, lazy_now.Now(), queue, |
| 641 GetNextAllowedRunTime(lazy_now.Now(), queue)); | 644 GetNextAllowedRunTime(lazy_now.Now(), queue)); |
| 642 } | 645 } |
| 643 | 646 |
| 644 TRACE_EVENT0(tracing_category_, "TaskQueueThrottler_EnableThrottling"); | 647 TRACE_EVENT0(tracing_category_, "TaskQueueThrottler_EnableThrottling"); |
| 645 } | 648 } |
| 646 | 649 |
| 647 } // namespace scheduler | 650 } // namespace scheduler |
| 648 } // namespace blink | 651 } // namespace blink |
| OLD | NEW |