| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 } | 478 } |
| 479 | 479 |
| 480 void TaskQueueThrottler::MaybeSchedulePumpThrottledTasks( | 480 void TaskQueueThrottler::MaybeSchedulePumpThrottledTasks( |
| 481 const tracked_objects::Location& from_here, | 481 const tracked_objects::Location& from_here, |
| 482 base::TimeTicks now, | 482 base::TimeTicks now, |
| 483 base::TimeTicks unaligned_runtime) { | 483 base::TimeTicks unaligned_runtime) { |
| 484 if (!allow_throttling_) | 484 if (!allow_throttling_) |
| 485 return; | 485 return; |
| 486 | 486 |
| 487 base::TimeTicks runtime = | 487 base::TimeTicks runtime = |
| 488 std::max(now, AlignedThrottledRunTime(unaligned_runtime)); | 488 AlignedThrottledRunTime(std::max(now, unaligned_runtime)); |
| 489 DCHECK_LE(now, runtime); |
| 489 | 490 |
| 490 // If there is a pending call to PumpThrottledTasks and it's sooner than | 491 // If there is a pending call to PumpThrottledTasks and it's sooner than |
| 491 // |runtime| then return. | 492 // |runtime| then return. |
| 492 if (pending_pump_throttled_tasks_runtime_ && | 493 if (pending_pump_throttled_tasks_runtime_ && |
| 493 runtime >= pending_pump_throttled_tasks_runtime_.value()) { | 494 runtime >= pending_pump_throttled_tasks_runtime_.value()) { |
| 494 return; | 495 return; |
| 495 } | 496 } |
| 496 | 497 |
| 497 pending_pump_throttled_tasks_runtime_ = runtime; | 498 pending_pump_throttled_tasks_runtime_ = runtime; |
| 498 | 499 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 queue->SetTimeDomain(time_domain_.get()); | 640 queue->SetTimeDomain(time_domain_.get()); |
| 640 MaybeSchedulePumpQueue(FROM_HERE, lazy_now.Now(), queue, | 641 MaybeSchedulePumpQueue(FROM_HERE, lazy_now.Now(), queue, |
| 641 GetNextAllowedRunTime(lazy_now.Now(), queue)); | 642 GetNextAllowedRunTime(lazy_now.Now(), queue)); |
| 642 } | 643 } |
| 643 | 644 |
| 644 TRACE_EVENT0(tracing_category_, "TaskQueueThrottler_EnableThrottling"); | 645 TRACE_EVENT0(tracing_category_, "TaskQueueThrottler_EnableThrottling"); |
| 645 } | 646 } |
| 646 | 647 |
| 647 } // namespace scheduler | 648 } // namespace scheduler |
| 648 } // namespace blink | 649 } // namespace blink |
| OLD | NEW |