| 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/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 DCHECK_GE(MainThreadOnly().timer_queue_suspend_count, 0); | 952 DCHECK_GE(MainThreadOnly().timer_queue_suspend_count, 0); |
| 953 ForceUpdatePolicy(); | 953 ForceUpdatePolicy(); |
| 954 } | 954 } |
| 955 | 955 |
| 956 void RendererSchedulerImpl::SetTimerQueueSuspensionWhenBackgroundedEnabled( | 956 void RendererSchedulerImpl::SetTimerQueueSuspensionWhenBackgroundedEnabled( |
| 957 bool enabled) { | 957 bool enabled) { |
| 958 // Note that this will only take effect for the next backgrounded signal. | 958 // Note that this will only take effect for the next backgrounded signal. |
| 959 MainThreadOnly().timer_queue_suspension_when_backgrounded_enabled = enabled; | 959 MainThreadOnly().timer_queue_suspension_when_backgrounded_enabled = enabled; |
| 960 } | 960 } |
| 961 | 961 |
| 962 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 962 scoped_ptr<base::trace_event::ConvertableToTraceFormat> |
| 963 RendererSchedulerImpl::AsValue(base::TimeTicks optional_now) const { | 963 RendererSchedulerImpl::AsValue(base::TimeTicks optional_now) const { |
| 964 base::AutoLock lock(any_thread_lock_); | 964 base::AutoLock lock(any_thread_lock_); |
| 965 return AsValueLocked(optional_now); | 965 return AsValueLocked(optional_now); |
| 966 } | 966 } |
| 967 | 967 |
| 968 scoped_refptr<base::trace_event::ConvertableToTraceFormat> | 968 scoped_ptr<base::trace_event::ConvertableToTraceFormat> |
| 969 RendererSchedulerImpl::AsValueLocked(base::TimeTicks optional_now) const { | 969 RendererSchedulerImpl::AsValueLocked(base::TimeTicks optional_now) const { |
| 970 helper_.CheckOnValidThread(); | 970 helper_.CheckOnValidThread(); |
| 971 any_thread_lock_.AssertAcquired(); | 971 any_thread_lock_.AssertAcquired(); |
| 972 | 972 |
| 973 if (optional_now.is_null()) | 973 if (optional_now.is_null()) |
| 974 optional_now = helper_.scheduler_tqm_delegate()->NowTicks(); | 974 optional_now = helper_.scheduler_tqm_delegate()->NowTicks(); |
| 975 scoped_refptr<base::trace_event::TracedValue> state = | 975 scoped_ptr<base::trace_event::TracedValue> state( |
| 976 new base::trace_event::TracedValue(); | 976 new base::trace_event::TracedValue()); |
| 977 | |
| 978 state->SetBoolean( | 977 state->SetBoolean( |
| 979 "has_visible_render_widget_with_touch_handler", | 978 "has_visible_render_widget_with_touch_handler", |
| 980 MainThreadOnly().has_visible_render_widget_with_touch_handler); | 979 MainThreadOnly().has_visible_render_widget_with_touch_handler); |
| 981 state->SetString("current_use_case", | 980 state->SetString("current_use_case", |
| 982 UseCaseToString(MainThreadOnly().current_use_case)); | 981 UseCaseToString(MainThreadOnly().current_use_case)); |
| 983 state->SetBoolean("loading_tasks_seem_expensive", | 982 state->SetBoolean("loading_tasks_seem_expensive", |
| 984 MainThreadOnly().loading_tasks_seem_expensive); | 983 MainThreadOnly().loading_tasks_seem_expensive); |
| 985 state->SetBoolean("timer_tasks_seem_expensive", | 984 state->SetBoolean("timer_tasks_seem_expensive", |
| 986 MainThreadOnly().timer_tasks_seem_expensive); | 985 MainThreadOnly().timer_tasks_seem_expensive); |
| 987 state->SetBoolean("begin_frame_not_expected_soon", | 986 state->SetBoolean("begin_frame_not_expected_soon", |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 "compositor_frame_interval", | 1041 "compositor_frame_interval", |
| 1043 MainThreadOnly().compositor_frame_interval.InMillisecondsF()); | 1042 MainThreadOnly().compositor_frame_interval.InMillisecondsF()); |
| 1044 state->SetDouble( | 1043 state->SetDouble( |
| 1045 "estimated_next_frame_begin", | 1044 "estimated_next_frame_begin", |
| 1046 (MainThreadOnly().estimated_next_frame_begin - base::TimeTicks()) | 1045 (MainThreadOnly().estimated_next_frame_begin - base::TimeTicks()) |
| 1047 .InMillisecondsF()); | 1046 .InMillisecondsF()); |
| 1048 state->SetBoolean("in_idle_period", AnyThread().in_idle_period); | 1047 state->SetBoolean("in_idle_period", AnyThread().in_idle_period); |
| 1049 AnyThread().user_model.AsValueInto(state.get()); | 1048 AnyThread().user_model.AsValueInto(state.get()); |
| 1050 render_widget_scheduler_signals_.AsValueInto(state.get()); | 1049 render_widget_scheduler_signals_.AsValueInto(state.get()); |
| 1051 | 1050 |
| 1052 return state; | 1051 return std::move(state); |
| 1053 } | 1052 } |
| 1054 | 1053 |
| 1055 void RendererSchedulerImpl::OnIdlePeriodStarted() { | 1054 void RendererSchedulerImpl::OnIdlePeriodStarted() { |
| 1056 base::AutoLock lock(any_thread_lock_); | 1055 base::AutoLock lock(any_thread_lock_); |
| 1057 AnyThread().in_idle_period = true; | 1056 AnyThread().in_idle_period = true; |
| 1058 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); | 1057 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); |
| 1059 } | 1058 } |
| 1060 | 1059 |
| 1061 void RendererSchedulerImpl::OnIdlePeriodEnded() { | 1060 void RendererSchedulerImpl::OnIdlePeriodEnded() { |
| 1062 base::AutoLock lock(any_thread_lock_); | 1061 base::AutoLock lock(any_thread_lock_); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 } | 1179 } |
| 1181 MainThreadOnly().have_reported_blocking_intervention_since_navigation = | 1180 MainThreadOnly().have_reported_blocking_intervention_since_navigation = |
| 1182 true; | 1181 true; |
| 1183 BroadcastConsoleWarning( | 1182 BroadcastConsoleWarning( |
| 1184 "Deferred long-running timer task(s) to improve scrolling smoothness. " | 1183 "Deferred long-running timer task(s) to improve scrolling smoothness. " |
| 1185 "See crbug.com/574343."); | 1184 "See crbug.com/574343."); |
| 1186 } | 1185 } |
| 1187 } | 1186 } |
| 1188 | 1187 |
| 1189 } // namespace scheduler | 1188 } // namespace scheduler |
| OLD | NEW |