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