| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_scheduler_impl.h" | 5 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 // detected. | 843 // detected. |
| 844 if (GetAnyThread().awaiting_touch_start_response && | 844 if (GetAnyThread().awaiting_touch_start_response && |
| 845 result == WebInputEventResult::kHandledApplication) { | 845 result == WebInputEventResult::kHandledApplication) { |
| 846 GetAnyThread().awaiting_touch_start_response = false; | 846 GetAnyThread().awaiting_touch_start_response = false; |
| 847 GetAnyThread().default_gesture_prevented = true; | 847 GetAnyThread().default_gesture_prevented = true; |
| 848 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); | 848 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); |
| 849 } | 849 } |
| 850 } | 850 } |
| 851 } | 851 } |
| 852 | 852 |
| 853 base::TimeDelta RendererSchedulerImpl::MostRecentExpectedQueueingTime() { |
| 854 return GetMainThreadOnly().most_recent_expected_queueing_time; |
| 855 } |
| 856 |
| 853 bool RendererSchedulerImpl::IsHighPriorityWorkAnticipated() { | 857 bool RendererSchedulerImpl::IsHighPriorityWorkAnticipated() { |
| 854 helper_.CheckOnValidThread(); | 858 helper_.CheckOnValidThread(); |
| 855 if (helper_.IsShutdown()) | 859 if (helper_.IsShutdown()) |
| 856 return false; | 860 return false; |
| 857 | 861 |
| 858 MaybeUpdatePolicy(); | 862 MaybeUpdatePolicy(); |
| 859 // The touchstart, synchronized gesture and main-thread gesture use cases | 863 // The touchstart, synchronized gesture and main-thread gesture use cases |
| 860 // indicate a strong likelihood of high-priority work in the near future. | 864 // indicate a strong likelihood of high-priority work in the near future. |
| 861 UseCase use_case = GetMainThreadOnly().current_use_case; | 865 UseCase use_case = GetMainThreadOnly().current_use_case; |
| 862 return GetMainThreadOnly().touchstart_expected_soon || | 866 return GetMainThreadOnly().touchstart_expected_soon || |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2022 } | 2026 } |
| 2023 | 2027 |
| 2024 void RendererSchedulerImpl::RemoveTaskTimeObserver( | 2028 void RendererSchedulerImpl::RemoveTaskTimeObserver( |
| 2025 TaskTimeObserver* task_time_observer) { | 2029 TaskTimeObserver* task_time_observer) { |
| 2026 helper_.RemoveTaskTimeObserver(task_time_observer); | 2030 helper_.RemoveTaskTimeObserver(task_time_observer); |
| 2027 } | 2031 } |
| 2028 | 2032 |
| 2029 void RendererSchedulerImpl::OnQueueingTimeForWindowEstimated( | 2033 void RendererSchedulerImpl::OnQueueingTimeForWindowEstimated( |
| 2030 base::TimeDelta queueing_time, | 2034 base::TimeDelta queueing_time, |
| 2031 base::TimeTicks window_start_time) { | 2035 base::TimeTicks window_start_time) { |
| 2036 GetMainThreadOnly().most_recent_expected_queueing_time = queueing_time; |
| 2037 |
| 2032 if (GetMainThreadOnly().has_navigated) { | 2038 if (GetMainThreadOnly().has_navigated) { |
| 2033 if (GetMainThreadOnly().max_queueing_time < queueing_time) { | 2039 if (GetMainThreadOnly().max_queueing_time < queueing_time) { |
| 2034 if (!GetMainThreadOnly().max_queueing_time_metric) { | 2040 if (!GetMainThreadOnly().max_queueing_time_metric) { |
| 2035 GetMainThreadOnly().max_queueing_time_metric = | 2041 GetMainThreadOnly().max_queueing_time_metric = |
| 2036 CreateMaxQueueingTimeMetric(); | 2042 CreateMaxQueueingTimeMetric(); |
| 2037 } | 2043 } |
| 2038 GetMainThreadOnly().max_queueing_time_metric->SetSample( | 2044 GetMainThreadOnly().max_queueing_time_metric->SetSample( |
| 2039 queueing_time.InMilliseconds()); | 2045 queueing_time.InMilliseconds()); |
| 2040 GetMainThreadOnly().max_queueing_time = queueing_time; | 2046 GetMainThreadOnly().max_queueing_time = queueing_time; |
| 2041 } | 2047 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 case TimeDomainType::VIRTUAL: | 2197 case TimeDomainType::VIRTUAL: |
| 2192 return "virtual"; | 2198 return "virtual"; |
| 2193 default: | 2199 default: |
| 2194 NOTREACHED(); | 2200 NOTREACHED(); |
| 2195 return nullptr; | 2201 return nullptr; |
| 2196 } | 2202 } |
| 2197 } | 2203 } |
| 2198 | 2204 |
| 2199 } // namespace scheduler | 2205 } // namespace scheduler |
| 2200 } // namespace blink | 2206 } // namespace blink |
| OLD | NEW |