| 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(bool main_frame_navigating) { |
| 1132 helper_.CheckOnValidThread(); | 1132 helper_.CheckOnValidThread(); |
| 1133 MainThreadOnly().navigation_task_expected_count++; | 1133 if (main_frame_navigating) { |
| 1134 UpdatePolicy(); | 1134 MainThreadOnly().navigation_task_expected_count++; |
| 1135 UpdatePolicy(); |
| 1136 } |
| 1135 } | 1137 } |
| 1136 | 1138 |
| 1137 void RendererSchedulerImpl::RemovePendingNavigation() { | 1139 void RendererSchedulerImpl::RemovePendingNavigation( |
| 1140 bool main_frame_navigating) { |
| 1138 helper_.CheckOnValidThread(); | 1141 helper_.CheckOnValidThread(); |
| 1139 DCHECK_GT(MainThreadOnly().navigation_task_expected_count, 0); | 1142 DCHECK_GT(MainThreadOnly().navigation_task_expected_count, 0); |
| 1140 if (MainThreadOnly().navigation_task_expected_count > 0) | 1143 if (main_frame_navigating && |
| 1144 MainThreadOnly().navigation_task_expected_count > 0) { |
| 1141 MainThreadOnly().navigation_task_expected_count--; | 1145 MainThreadOnly().navigation_task_expected_count--; |
| 1142 UpdatePolicy(); | 1146 UpdatePolicy(); |
| 1147 } |
| 1143 } | 1148 } |
| 1144 | 1149 |
| 1145 void RendererSchedulerImpl::OnNavigationStarted() { | 1150 void RendererSchedulerImpl::OnNavigationStarted() { |
| 1146 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 1151 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 1147 "RendererSchedulerImpl::OnNavigationStarted"); | 1152 "RendererSchedulerImpl::OnNavigationStarted"); |
| 1148 base::AutoLock lock(any_thread_lock_); | 1153 base::AutoLock lock(any_thread_lock_); |
| 1149 AnyThread().rails_loading_priority_deadline = | 1154 AnyThread().rails_loading_priority_deadline = |
| 1150 helper_.scheduler_tqm_delegate()->NowTicks() + | 1155 helper_.scheduler_tqm_delegate()->NowTicks() + |
| 1151 base::TimeDelta::FromMilliseconds( | 1156 base::TimeDelta::FromMilliseconds( |
| 1152 kRailsInitialLoadingPrioritizationMillis); | 1157 kRailsInitialLoadingPrioritizationMillis); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 } | 1265 } |
| 1261 MainThreadOnly().have_reported_blocking_intervention_since_navigation = | 1266 MainThreadOnly().have_reported_blocking_intervention_since_navigation = |
| 1262 true; | 1267 true; |
| 1263 BroadcastConsoleWarning( | 1268 BroadcastConsoleWarning( |
| 1264 "Deferred long-running timer task(s) to improve scrolling smoothness. " | 1269 "Deferred long-running timer task(s) to improve scrolling smoothness. " |
| 1265 "See crbug.com/574343."); | 1270 "See crbug.com/574343."); |
| 1266 } | 1271 } |
| 1267 } | 1272 } |
| 1268 | 1273 |
| 1269 } // namespace scheduler | 1274 } // namespace scheduler |
| OLD | NEW |