Chromium Code Reviews| 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" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "base/trace_event/trace_event_argument.h" | 13 #include "base/trace_event/trace_event_argument.h" |
| 14 #include "cc/output/begin_frame_args.h" | 14 #include "cc/output/begin_frame_args.h" |
| 15 #include "components/scheduler/base/task_queue_impl.h" | 15 #include "components/scheduler/base/task_queue_impl.h" |
| 16 #include "components/scheduler/base/task_queue_selector.h" | 16 #include "components/scheduler/base/task_queue_selector.h" |
| 17 #include "components/scheduler/base/virtual_time_domain.h" | 17 #include "components/scheduler/base/virtual_time_domain.h" |
| 18 #include "components/scheduler/child/scheduler_tqm_delegate.h" | 18 #include "components/scheduler/child/scheduler_tqm_delegate.h" |
| 19 #include "components/scheduler/renderer/auto_advancing_virtual_time_domain.h" | |
| 19 #include "components/scheduler/renderer/web_view_scheduler_impl.h" | 20 #include "components/scheduler/renderer/web_view_scheduler_impl.h" |
| 20 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" | 21 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" |
| 21 | 22 |
| 22 namespace scheduler { | 23 namespace scheduler { |
| 23 namespace { | 24 namespace { |
| 24 // The run time of loading tasks is strongly bimodal. The vast majority are | 25 // The run time of loading tasks is strongly bimodal. The vast majority are |
| 25 // very cheap, but there are usually a handful of very expensive tasks (e.g ~1 | 26 // very cheap, but there are usually a handful of very expensive tasks (e.g ~1 |
| 26 // second on a mobile device) so we take a very pessimistic view when estimating | 27 // second on a mobile device) so we take a very pessimistic view when estimating |
| 27 // the cost of loading tasks. | 28 // the cost of loading tasks. |
| 28 const int kLoadingTaskEstimationSampleCount = 1000; | 29 const int kLoadingTaskEstimationSampleCount = 1000; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 | 90 |
| 90 for (const scoped_refptr<TaskQueue>& loading_queue : loading_task_runners_) { | 91 for (const scoped_refptr<TaskQueue>& loading_queue : loading_task_runners_) { |
| 91 loading_queue->RemoveTaskObserver( | 92 loading_queue->RemoveTaskObserver( |
| 92 &MainThreadOnly().loading_task_cost_estimator); | 93 &MainThreadOnly().loading_task_cost_estimator); |
| 93 } | 94 } |
| 94 for (const scoped_refptr<TaskQueue>& timer_queue : timer_task_runners_) { | 95 for (const scoped_refptr<TaskQueue>& timer_queue : timer_task_runners_) { |
| 95 timer_queue->RemoveTaskObserver( | 96 timer_queue->RemoveTaskObserver( |
| 96 &MainThreadOnly().timer_task_cost_estimator); | 97 &MainThreadOnly().timer_task_cost_estimator); |
| 97 } | 98 } |
| 98 | 99 |
| 100 if (virtual_time_domain_) | |
| 101 UnregisterTimeDomain(virtual_time_domain_.get()); | |
| 102 | |
| 99 // Ensure the renderer scheduler was shut down explicitly, because otherwise | 103 // Ensure the renderer scheduler was shut down explicitly, because otherwise |
| 100 // we could end up having stale pointers to the Blink heap which has been | 104 // we could end up having stale pointers to the Blink heap which has been |
| 101 // terminated by this point. | 105 // terminated by this point. |
| 102 DCHECK(MainThreadOnly().was_shutdown); | 106 DCHECK(MainThreadOnly().was_shutdown); |
| 103 } | 107 } |
| 104 | 108 |
| 105 RendererSchedulerImpl::MainThreadOnly::MainThreadOnly( | 109 RendererSchedulerImpl::MainThreadOnly::MainThreadOnly( |
| 106 RendererSchedulerImpl* renderer_scheduler_impl, | 110 RendererSchedulerImpl* renderer_scheduler_impl, |
| 107 const scoped_refptr<TaskQueue>& compositor_task_runner, | 111 const scoped_refptr<TaskQueue>& compositor_task_runner, |
| 108 base::TickClock* time_source) | 112 base::TickClock* time_source) |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 131 loading_tasks_seem_expensive(false), | 135 loading_tasks_seem_expensive(false), |
| 132 timer_tasks_seem_expensive(false), | 136 timer_tasks_seem_expensive(false), |
| 133 touchstart_expected_soon(false), | 137 touchstart_expected_soon(false), |
| 134 have_seen_a_begin_main_frame(false), | 138 have_seen_a_begin_main_frame(false), |
| 135 have_reported_blocking_intervention_in_current_policy(false), | 139 have_reported_blocking_intervention_in_current_policy(false), |
| 136 have_reported_blocking_intervention_since_navigation(false), | 140 have_reported_blocking_intervention_since_navigation(false), |
| 137 has_visible_render_widget_with_touch_handler(false), | 141 has_visible_render_widget_with_touch_handler(false), |
| 138 begin_frame_not_expected_soon(false), | 142 begin_frame_not_expected_soon(false), |
| 139 expensive_task_blocking_allowed(true), | 143 expensive_task_blocking_allowed(true), |
| 140 in_idle_period_for_testing(false), | 144 in_idle_period_for_testing(false), |
| 145 use_virtual_time(false), | |
| 141 rail_mode_observer(nullptr) {} | 146 rail_mode_observer(nullptr) {} |
| 142 | 147 |
| 143 RendererSchedulerImpl::MainThreadOnly::~MainThreadOnly() {} | 148 RendererSchedulerImpl::MainThreadOnly::~MainThreadOnly() {} |
| 144 | 149 |
| 145 RendererSchedulerImpl::AnyThread::AnyThread() | 150 RendererSchedulerImpl::AnyThread::AnyThread() |
| 146 : awaiting_touch_start_response(false), | 151 : awaiting_touch_start_response(false), |
| 147 in_idle_period(false), | 152 in_idle_period(false), |
| 148 begin_main_frame_on_critical_path(false), | 153 begin_main_frame_on_critical_path(false), |
| 149 last_gesture_was_compositor_driven(false), | 154 last_gesture_was_compositor_driven(false), |
| 150 default_gesture_prevented(true), | 155 default_gesture_prevented(true), |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 | 199 |
| 195 scoped_refptr<TaskQueue> RendererSchedulerImpl::ControlTaskRunner() { | 200 scoped_refptr<TaskQueue> RendererSchedulerImpl::ControlTaskRunner() { |
| 196 helper_.CheckOnValidThread(); | 201 helper_.CheckOnValidThread(); |
| 197 return helper_.ControlTaskRunner(); | 202 return helper_.ControlTaskRunner(); |
| 198 } | 203 } |
| 199 | 204 |
| 200 scoped_refptr<TaskQueue> RendererSchedulerImpl::NewLoadingTaskRunner( | 205 scoped_refptr<TaskQueue> RendererSchedulerImpl::NewLoadingTaskRunner( |
| 201 const char* name) { | 206 const char* name) { |
| 202 helper_.CheckOnValidThread(); | 207 helper_.CheckOnValidThread(); |
| 203 scoped_refptr<TaskQueue> loading_task_queue(helper_.NewTaskQueue( | 208 scoped_refptr<TaskQueue> loading_task_queue(helper_.NewTaskQueue( |
| 204 TaskQueue::Spec(name).SetShouldMonitorQuiescence(true))); | 209 TaskQueue::Spec(name).SetShouldMonitorQuiescence(true).SetTimeDomain( |
| 210 MainThreadOnly().use_virtual_time ? virtual_time_domain() | |
| 211 : nullptr))); | |
| 205 loading_task_runners_.insert(loading_task_queue); | 212 loading_task_runners_.insert(loading_task_queue); |
| 206 loading_task_queue->SetQueueEnabled( | 213 loading_task_queue->SetQueueEnabled( |
| 207 MainThreadOnly().current_policy.loading_queue_policy.is_enabled); | 214 MainThreadOnly().current_policy.loading_queue_policy.is_enabled); |
| 208 loading_task_queue->SetQueuePriority( | 215 loading_task_queue->SetQueuePriority( |
| 209 MainThreadOnly().current_policy.loading_queue_policy.priority); | 216 MainThreadOnly().current_policy.loading_queue_policy.priority); |
| 210 if (MainThreadOnly().current_policy.loading_queue_policy.time_domain_type == | 217 if (MainThreadOnly().current_policy.loading_queue_policy.time_domain_type == |
| 211 TimeDomainType::THROTTLED) { | 218 TimeDomainType::THROTTLED) { |
| 212 throttling_helper_->IncreaseThrottleRefCount(loading_task_queue.get()); | 219 throttling_helper_->IncreaseThrottleRefCount(loading_task_queue.get()); |
| 213 } | 220 } |
| 214 loading_task_queue->AddTaskObserver( | 221 loading_task_queue->AddTaskObserver( |
| 215 &MainThreadOnly().loading_task_cost_estimator); | 222 &MainThreadOnly().loading_task_cost_estimator); |
| 216 return loading_task_queue; | 223 return loading_task_queue; |
| 217 } | 224 } |
| 218 | 225 |
| 219 scoped_refptr<TaskQueue> RendererSchedulerImpl::NewTimerTaskRunner( | 226 scoped_refptr<TaskQueue> RendererSchedulerImpl::NewTimerTaskRunner( |
| 220 const char* name) { | 227 const char* name) { |
| 221 helper_.CheckOnValidThread(); | 228 helper_.CheckOnValidThread(); |
| 222 scoped_refptr<TaskQueue> timer_task_queue( | 229 scoped_refptr<TaskQueue> timer_task_queue( |
| 223 helper_.NewTaskQueue(TaskQueue::Spec(name) | 230 helper_.NewTaskQueue(TaskQueue::Spec(name) |
| 224 .SetShouldMonitorQuiescence(true) | 231 .SetShouldMonitorQuiescence(true) |
| 225 .SetShouldReportWhenExecutionBlocked(true))); | 232 .SetShouldReportWhenExecutionBlocked(true) |
| 233 .SetTimeDomain(MainThreadOnly().use_virtual_time | |
|
Sami
2016/07/29 14:05:50
Could you add a TODO here to make these use ApplyT
alex clarke (OOO till 29th)
2016/07/29 14:42:16
Done.
| |
| 234 ? virtual_time_domain() | |
| 235 : nullptr))); | |
| 226 timer_task_runners_.insert(timer_task_queue); | 236 timer_task_runners_.insert(timer_task_queue); |
| 227 timer_task_queue->SetQueueEnabled( | 237 timer_task_queue->SetQueueEnabled( |
| 228 MainThreadOnly().current_policy.timer_queue_policy.is_enabled); | 238 MainThreadOnly().current_policy.timer_queue_policy.is_enabled); |
| 229 timer_task_queue->SetQueuePriority( | 239 timer_task_queue->SetQueuePriority( |
| 230 MainThreadOnly().current_policy.timer_queue_policy.priority); | 240 MainThreadOnly().current_policy.timer_queue_policy.priority); |
| 231 if (MainThreadOnly().current_policy.timer_queue_policy.time_domain_type == | 241 if (MainThreadOnly().current_policy.timer_queue_policy.time_domain_type == |
| 232 TimeDomainType::THROTTLED) { | 242 TimeDomainType::THROTTLED) { |
| 233 throttling_helper_->IncreaseThrottleRefCount(timer_task_queue.get()); | 243 throttling_helper_->IncreaseThrottleRefCount(timer_task_queue.get()); |
| 234 } | 244 } |
| 235 timer_task_queue->AddTaskObserver( | 245 timer_task_queue->AddTaskObserver( |
| 236 &MainThreadOnly().timer_task_cost_estimator); | 246 &MainThreadOnly().timer_task_cost_estimator); |
| 237 return timer_task_queue; | 247 return timer_task_queue; |
| 238 } | 248 } |
| 239 | 249 |
| 240 scoped_refptr<TaskQueue> RendererSchedulerImpl::NewUnthrottledTaskRunner( | 250 scoped_refptr<TaskQueue> RendererSchedulerImpl::NewUnthrottledTaskRunner( |
| 241 const char* name) { | 251 const char* name) { |
| 242 helper_.CheckOnValidThread(); | 252 helper_.CheckOnValidThread(); |
| 243 scoped_refptr<TaskQueue> unthrottled_task_queue(helper_.NewTaskQueue( | 253 scoped_refptr<TaskQueue> unthrottled_task_queue(helper_.NewTaskQueue( |
| 244 TaskQueue::Spec(name).SetShouldMonitorQuiescence(true))); | 254 TaskQueue::Spec(name).SetShouldMonitorQuiescence(true).SetTimeDomain( |
| 255 MainThreadOnly().use_virtual_time ? virtual_time_domain() | |
| 256 : nullptr))); | |
| 257 unthrottled_task_runners_.insert(unthrottled_task_queue); | |
| 245 return unthrottled_task_queue; | 258 return unthrottled_task_queue; |
| 246 } | 259 } |
| 247 | 260 |
| 248 std::unique_ptr<RenderWidgetSchedulingState> | 261 std::unique_ptr<RenderWidgetSchedulingState> |
| 249 RendererSchedulerImpl::NewRenderWidgetSchedulingState() { | 262 RendererSchedulerImpl::NewRenderWidgetSchedulingState() { |
| 250 return render_widget_scheduler_signals_.NewRenderWidgetSchedulingState(); | 263 return render_widget_scheduler_signals_.NewRenderWidgetSchedulingState(); |
| 251 } | 264 } |
| 252 | 265 |
| 253 void RendererSchedulerImpl::OnUnregisterTaskQueue( | 266 void RendererSchedulerImpl::OnUnregisterTaskQueue( |
| 254 const scoped_refptr<TaskQueue>& task_queue) { | 267 const scoped_refptr<TaskQueue>& task_queue) { |
| 255 if (throttling_helper_.get()) | 268 if (throttling_helper_.get()) |
| 256 throttling_helper_->UnregisterTaskQueue(task_queue.get()); | 269 throttling_helper_->UnregisterTaskQueue(task_queue.get()); |
| 257 | 270 |
| 258 if (loading_task_runners_.find(task_queue) != loading_task_runners_.end()) { | 271 if (loading_task_runners_.find(task_queue) != loading_task_runners_.end()) { |
| 259 task_queue->RemoveTaskObserver( | 272 task_queue->RemoveTaskObserver( |
| 260 &MainThreadOnly().loading_task_cost_estimator); | 273 &MainThreadOnly().loading_task_cost_estimator); |
| 261 loading_task_runners_.erase(task_queue); | 274 loading_task_runners_.erase(task_queue); |
| 262 } else if (timer_task_runners_.find(task_queue) != | 275 } else if (timer_task_runners_.find(task_queue) != |
| 263 timer_task_runners_.end()) { | 276 timer_task_runners_.end()) { |
| 264 task_queue->RemoveTaskObserver(&MainThreadOnly().timer_task_cost_estimator); | 277 task_queue->RemoveTaskObserver(&MainThreadOnly().timer_task_cost_estimator); |
| 265 timer_task_runners_.erase(task_queue); | 278 timer_task_runners_.erase(task_queue); |
| 279 } else if (unthrottled_task_runners_.find(task_queue) != | |
| 280 unthrottled_task_runners_.end()) { | |
| 281 unthrottled_task_runners_.erase(task_queue); | |
| 266 } | 282 } |
| 267 } | 283 } |
| 268 | 284 |
| 269 bool RendererSchedulerImpl::CanExceedIdleDeadlineIfRequired() const { | 285 bool RendererSchedulerImpl::CanExceedIdleDeadlineIfRequired() const { |
| 270 return idle_helper_.CanExceedIdleDeadlineIfRequired(); | 286 return idle_helper_.CanExceedIdleDeadlineIfRequired(); |
| 271 } | 287 } |
| 272 | 288 |
| 273 void RendererSchedulerImpl::AddTaskObserver( | 289 void RendererSchedulerImpl::AddTaskObserver( |
| 274 base::MessageLoop::TaskObserver* task_observer) { | 290 base::MessageLoop::TaskObserver* task_observer) { |
| 275 helper_.AddTaskObserver(task_observer); | 291 helper_.AddTaskObserver(task_observer); |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 new_policy.loading_queue_policy.time_domain_type = | 872 new_policy.loading_queue_policy.time_domain_type = |
| 857 TimeDomainType::THROTTLED; | 873 TimeDomainType::THROTTLED; |
| 858 } | 874 } |
| 859 if (timer_tasks_seem_expensive) { | 875 if (timer_tasks_seem_expensive) { |
| 860 new_policy.timer_queue_policy.time_domain_type = | 876 new_policy.timer_queue_policy.time_domain_type = |
| 861 TimeDomainType::THROTTLED; | 877 TimeDomainType::THROTTLED; |
| 862 } | 878 } |
| 863 break; | 879 break; |
| 864 } | 880 } |
| 865 | 881 |
| 882 if (MainThreadOnly().use_virtual_time) { | |
| 883 new_policy.compositor_queue_policy.time_domain_type = | |
| 884 TimeDomainType::VIRTUAL; | |
| 885 new_policy.default_queue_policy.time_domain_type = TimeDomainType::VIRTUAL; | |
| 886 new_policy.loading_queue_policy.time_domain_type = TimeDomainType::VIRTUAL; | |
| 887 new_policy.timer_queue_policy.time_domain_type = TimeDomainType::VIRTUAL; | |
| 888 } | |
| 889 | |
| 866 MainThreadOnly().expensive_task_policy = expensive_task_policy; | 890 MainThreadOnly().expensive_task_policy = expensive_task_policy; |
| 867 | 891 |
| 868 if (MainThreadOnly().timer_queue_suspend_count != 0 || | 892 if (MainThreadOnly().timer_queue_suspend_count != 0 || |
| 869 MainThreadOnly().timer_queue_suspended_when_backgrounded) { | 893 MainThreadOnly().timer_queue_suspended_when_backgrounded) { |
| 870 new_policy.timer_queue_policy.is_enabled = false; | 894 new_policy.timer_queue_policy.is_enabled = false; |
| 871 new_policy.timer_queue_policy.time_domain_type = TimeDomainType::REAL; | 895 new_policy.timer_queue_policy.time_domain_type = TimeDomainType::REAL; |
|
Sami
2016/07/29 14:05:50
Is it okay to go back to real time here?
alex clarke (OOO till 29th)
2016/07/29 14:42:16
Huh, no. Lets fix that.
| |
| 872 } | 896 } |
| 873 | 897 |
| 874 if (MainThreadOnly().renderer_suspended) { | 898 if (MainThreadOnly().renderer_suspended) { |
| 875 new_policy.loading_queue_policy.is_enabled = false; | 899 new_policy.loading_queue_policy.is_enabled = false; |
| 876 DCHECK(!new_policy.timer_queue_policy.is_enabled); | 900 DCHECK(!new_policy.timer_queue_policy.is_enabled); |
| 877 } | 901 } |
| 878 | 902 |
| 879 // Tracing is done before the early out check, because it's quite possible we | 903 // Tracing is done before the early out check, because it's quite possible we |
| 880 // will otherwise miss this information in traces. | 904 // will otherwise miss this information in traces. |
| 881 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( | 905 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 944 if (old_task_queue_policy.is_enabled != new_task_queue_policy.is_enabled) { | 968 if (old_task_queue_policy.is_enabled != new_task_queue_policy.is_enabled) { |
| 945 throttling_helper_->SetQueueEnabled(task_queue, | 969 throttling_helper_->SetQueueEnabled(task_queue, |
| 946 new_task_queue_policy.is_enabled); | 970 new_task_queue_policy.is_enabled); |
| 947 } | 971 } |
| 948 | 972 |
| 949 if (old_task_queue_policy.priority != new_task_queue_policy.priority) | 973 if (old_task_queue_policy.priority != new_task_queue_policy.priority) |
| 950 task_queue->SetQueuePriority(new_task_queue_policy.priority); | 974 task_queue->SetQueuePriority(new_task_queue_policy.priority); |
| 951 | 975 |
| 952 if (old_task_queue_policy.time_domain_type != | 976 if (old_task_queue_policy.time_domain_type != |
| 953 new_task_queue_policy.time_domain_type) { | 977 new_task_queue_policy.time_domain_type) { |
| 954 if (new_task_queue_policy.time_domain_type == TimeDomainType::THROTTLED) { | 978 if (old_task_queue_policy.time_domain_type == TimeDomainType::THROTTLED) { |
| 979 throttling_helper_->DecreaseThrottleRefCount(task_queue); | |
| 980 } else if (new_task_queue_policy.time_domain_type == | |
| 981 TimeDomainType::THROTTLED) { | |
| 955 throttling_helper_->IncreaseThrottleRefCount(task_queue); | 982 throttling_helper_->IncreaseThrottleRefCount(task_queue); |
| 956 } else if (old_task_queue_policy.time_domain_type == | 983 } else if (new_task_queue_policy.time_domain_type == |
| 957 TimeDomainType::THROTTLED) { | 984 TimeDomainType::VIRTUAL) { |
| 958 throttling_helper_->DecreaseThrottleRefCount(task_queue); | 985 DCHECK(virtual_time_domain_); |
| 986 task_queue->SetTimeDomain(virtual_time_domain_.get()); | |
| 959 } | 987 } |
| 960 } | 988 } |
| 961 } | 989 } |
| 962 | 990 |
| 963 RendererSchedulerImpl::UseCase RendererSchedulerImpl::ComputeCurrentUseCase( | 991 RendererSchedulerImpl::UseCase RendererSchedulerImpl::ComputeCurrentUseCase( |
| 964 base::TimeTicks now, | 992 base::TimeTicks now, |
| 965 base::TimeDelta* expected_use_case_duration) const { | 993 base::TimeDelta* expected_use_case_duration) const { |
| 966 any_thread_lock_.AssertAcquired(); | 994 any_thread_lock_.AssertAcquired(); |
| 967 // Special case for flings. This is needed because we don't get notification | 995 // Special case for flings. This is needed because we don't get notification |
| 968 // of a fling ending (although we do for cancellation). | 996 // of a fling ending (although we do for cancellation). |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1402 | 1430 |
| 1403 void RendererSchedulerImpl::OnQueueingTimeForWindowEstimated( | 1431 void RendererSchedulerImpl::OnQueueingTimeForWindowEstimated( |
| 1404 base::TimeDelta queueing_time) { | 1432 base::TimeDelta queueing_time) { |
| 1405 UMA_HISTOGRAM_TIMES("RendererScheduler.ExpectedTaskQueueingDuration", | 1433 UMA_HISTOGRAM_TIMES("RendererScheduler.ExpectedTaskQueueingDuration", |
| 1406 queueing_time); | 1434 queueing_time); |
| 1407 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 1435 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 1408 "estimated_queueing_time_for_window", | 1436 "estimated_queueing_time_for_window", |
| 1409 queueing_time.InMillisecondsF()); | 1437 queueing_time.InMillisecondsF()); |
| 1410 } | 1438 } |
| 1411 | 1439 |
| 1440 AutoAdvancingVirtualTimeDomain* RendererSchedulerImpl::virtual_time_domain() { | |
|
Sami
2016/07/29 14:05:50
nit: This should be called VirtualTimeDomain() sin
alex clarke (OOO till 29th)
2016/07/29 14:42:16
Done.
| |
| 1441 if (!virtual_time_domain_) { | |
| 1442 virtual_time_domain_.reset( | |
| 1443 new AutoAdvancingVirtualTimeDomain(tick_clock()->NowTicks())); | |
| 1444 RegisterTimeDomain(virtual_time_domain_.get()); | |
| 1445 } | |
| 1446 return virtual_time_domain_.get(); | |
| 1447 } | |
| 1448 | |
| 1449 void RendererSchedulerImpl::EnableVirtualTime() { | |
| 1450 MainThreadOnly().use_virtual_time = true; | |
| 1451 | |
| 1452 // The |unthrottled_task_runners_| are not actively managed by UpdatePolicy(). | |
| 1453 AutoAdvancingVirtualTimeDomain* time_domain = virtual_time_domain(); | |
| 1454 for (const scoped_refptr<TaskQueue>& task_queue : unthrottled_task_runners_) | |
| 1455 task_queue->SetTimeDomain(time_domain); | |
| 1456 | |
| 1457 throttling_helper_->EnableVirtualTime(); | |
| 1458 | |
| 1459 ForceUpdatePolicy(); | |
| 1460 } | |
| 1461 | |
| 1412 // static | 1462 // static |
| 1413 const char* RendererSchedulerImpl::UseCaseToString(UseCase use_case) { | 1463 const char* RendererSchedulerImpl::UseCaseToString(UseCase use_case) { |
| 1414 switch (use_case) { | 1464 switch (use_case) { |
| 1415 case UseCase::NONE: | 1465 case UseCase::NONE: |
| 1416 return "none"; | 1466 return "none"; |
| 1417 case UseCase::COMPOSITOR_GESTURE: | 1467 case UseCase::COMPOSITOR_GESTURE: |
| 1418 return "compositor_gesture"; | 1468 return "compositor_gesture"; |
| 1419 case UseCase::MAIN_THREAD_CUSTOM_INPUT_HANDLING: | 1469 case UseCase::MAIN_THREAD_CUSTOM_INPUT_HANDLING: |
| 1420 return "main_thread_custom_input_handling"; | 1470 return "main_thread_custom_input_handling"; |
| 1421 case UseCase::SYNCHRONIZED_GESTURE: | 1471 case UseCase::SYNCHRONIZED_GESTURE: |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1443 return "idle"; | 1493 return "idle"; |
| 1444 case v8::PERFORMANCE_LOAD: | 1494 case v8::PERFORMANCE_LOAD: |
| 1445 return "load"; | 1495 return "load"; |
| 1446 default: | 1496 default: |
| 1447 NOTREACHED(); | 1497 NOTREACHED(); |
| 1448 return nullptr; | 1498 return nullptr; |
| 1449 } | 1499 } |
| 1450 } | 1500 } |
| 1451 | 1501 |
| 1452 } // namespace scheduler | 1502 } // namespace scheduler |
| OLD | NEW |