| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/optional.h" | 12 #include "base/optional.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "platform/WebFrameScheduler.h" | 14 #include "platform/WebFrameScheduler.h" |
| 15 #include "platform/scheduler/base/real_time_domain.h" | 15 #include "platform/scheduler/base/real_time_domain.h" |
| 16 #include "platform/scheduler/child/scheduler_tqm_delegate.h" | 16 #include "platform/scheduler/child/scheduler_tqm_delegate.h" |
| 17 #include "platform/scheduler/renderer/budget_pool.h" | 17 #include "platform/scheduler/renderer/budget_pool.h" |
| 18 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" | 18 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
| 19 #include "platform/scheduler/renderer/throttled_time_domain.h" | 19 #include "platform/scheduler/renderer/throttled_time_domain.h" |
| 20 #include "platform/scheduler/renderer/web_frame_scheduler_impl.h" | 20 #include "platform/scheduler/renderer/web_frame_scheduler_impl.h" |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 23 namespace scheduler { | 23 namespace scheduler { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 base::Optional<base::TimeTicks> NextTaskRunTime(LazyNow* lazy_now, | 27 base::Optional<base::TimeTicks> NextTaskRunTime(LazyNow* lazy_now, |
| 28 TaskQueue* queue) { | 28 TaskQueue* queue) { |
| 29 if (queue->HasPendingImmediateWork()) | 29 if (queue->HasTaskToRunImmediately()) |
| 30 return lazy_now->Now(); | 30 return lazy_now->Now(); |
| 31 return queue->GetNextScheduledWakeUp(); | 31 return queue->GetNextScheduledWakeUp(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 template <class T> | 34 template <class T> |
| 35 T Min(const base::Optional<T>& optional, const T& value) { | 35 T Min(const base::Optional<T>& optional, const T& value) { |
| 36 if (!optional) { | 36 if (!optional) { |
| 37 return value; | 37 return value; |
| 38 } | 38 } |
| 39 return std::min(optional.value(), value); | 39 return std::min(optional.value(), value); |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 queue->InsertFence(TaskQueue::InsertFencePosition::BEGINNING_OF_TIME); | 559 queue->InsertFence(TaskQueue::InsertFencePosition::BEGINNING_OF_TIME); |
| 560 queue->SetTimeDomain(time_domain_.get()); | 560 queue->SetTimeDomain(time_domain_.get()); |
| 561 UpdateQueueThrottlingState(lazy_now.Now(), queue); | 561 UpdateQueueThrottlingState(lazy_now.Now(), queue); |
| 562 } | 562 } |
| 563 | 563 |
| 564 TRACE_EVENT0("renderer.scheduler", "TaskQueueThrottler_EnableThrottling"); | 564 TRACE_EVENT0("renderer.scheduler", "TaskQueueThrottler_EnableThrottling"); |
| 565 } | 565 } |
| 566 | 566 |
| 567 } // namespace scheduler | 567 } // namespace scheduler |
| 568 } // namespace blink | 568 } // namespace blink |
| OLD | NEW |