| 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 "components/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "components/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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 void RendererSchedulerImpl::OnIdlePeriodEnded() { | 1123 void RendererSchedulerImpl::OnIdlePeriodEnded() { |
| 1124 base::AutoLock lock(any_thread_lock_); | 1124 base::AutoLock lock(any_thread_lock_); |
| 1125 AnyThread().last_idle_period_end_time = | 1125 AnyThread().last_idle_period_end_time = |
| 1126 helper_.scheduler_tqm_delegate()->NowTicks(); | 1126 helper_.scheduler_tqm_delegate()->NowTicks(); |
| 1127 AnyThread().in_idle_period = false; | 1127 AnyThread().in_idle_period = false; |
| 1128 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); | 1128 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 void RendererSchedulerImpl::AddPendingNavigation() { | 1131 void RendererSchedulerImpl::AddPendingNavigation( |
| 1132 blink::WebScheduler::NavigatingFrameType type) { |
| 1132 helper_.CheckOnValidThread(); | 1133 helper_.CheckOnValidThread(); |
| 1133 MainThreadOnly().navigation_task_expected_count++; | 1134 if (type == blink::WebScheduler::NavigatingFrameType::kMainFrame) { |
| 1134 UpdatePolicy(); | 1135 MainThreadOnly().navigation_task_expected_count++; |
| 1136 UpdatePolicy(); |
| 1137 } |
| 1135 } | 1138 } |
| 1136 | 1139 |
| 1137 void RendererSchedulerImpl::RemovePendingNavigation() { | 1140 void RendererSchedulerImpl::RemovePendingNavigation( |
| 1141 blink::WebScheduler::NavigatingFrameType type) { |
| 1138 helper_.CheckOnValidThread(); | 1142 helper_.CheckOnValidThread(); |
| 1139 DCHECK_GT(MainThreadOnly().navigation_task_expected_count, 0); | 1143 DCHECK_GT(MainThreadOnly().navigation_task_expected_count, 0); |
| 1140 if (MainThreadOnly().navigation_task_expected_count > 0) | 1144 if (type == blink::WebScheduler::NavigatingFrameType::kMainFrame && |
| 1145 MainThreadOnly().navigation_task_expected_count > 0) { |
| 1141 MainThreadOnly().navigation_task_expected_count--; | 1146 MainThreadOnly().navigation_task_expected_count--; |
| 1142 UpdatePolicy(); | 1147 UpdatePolicy(); |
| 1148 } |
| 1143 } | 1149 } |
| 1144 | 1150 |
| 1145 void RendererSchedulerImpl::OnNavigationStarted() { | 1151 void RendererSchedulerImpl::OnNavigationStarted() { |
| 1146 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 1152 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 1147 "RendererSchedulerImpl::OnNavigationStarted"); | 1153 "RendererSchedulerImpl::OnNavigationStarted"); |
| 1148 base::AutoLock lock(any_thread_lock_); | 1154 base::AutoLock lock(any_thread_lock_); |
| 1149 AnyThread().rails_loading_priority_deadline = | 1155 AnyThread().rails_loading_priority_deadline = |
| 1150 helper_.scheduler_tqm_delegate()->NowTicks() + | 1156 helper_.scheduler_tqm_delegate()->NowTicks() + |
| 1151 base::TimeDelta::FromMilliseconds( | 1157 base::TimeDelta::FromMilliseconds( |
| 1152 kRailsInitialLoadingPrioritizationMillis); | 1158 kRailsInitialLoadingPrioritizationMillis); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 } | 1266 } |
| 1261 MainThreadOnly().have_reported_blocking_intervention_since_navigation = | 1267 MainThreadOnly().have_reported_blocking_intervention_since_navigation = |
| 1262 true; | 1268 true; |
| 1263 BroadcastConsoleWarning( | 1269 BroadcastConsoleWarning( |
| 1264 "Deferred long-running timer task(s) to improve scrolling smoothness. " | 1270 "Deferred long-running timer task(s) to improve scrolling smoothness. " |
| 1265 "See crbug.com/574343."); | 1271 "See crbug.com/574343."); |
| 1266 } | 1272 } |
| 1267 } | 1273 } |
| 1268 | 1274 |
| 1269 } // namespace scheduler | 1275 } // namespace scheduler |
| OLD | NEW |