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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 AnyThread().user_model.Reset(helper_.scheduler_tqm_delegate()->NowTicks()); | 1124 AnyThread().user_model.Reset(helper_.scheduler_tqm_delegate()->NowTicks()); |
1125 AnyThread().have_seen_touchstart = false; | 1125 AnyThread().have_seen_touchstart = false; |
1126 MainThreadOnly().loading_task_cost_estimator.Clear(); | 1126 MainThreadOnly().loading_task_cost_estimator.Clear(); |
1127 MainThreadOnly().timer_task_cost_estimator.Clear(); | 1127 MainThreadOnly().timer_task_cost_estimator.Clear(); |
1128 MainThreadOnly().idle_time_estimator.Clear(); | 1128 MainThreadOnly().idle_time_estimator.Clear(); |
1129 MainThreadOnly().have_seen_a_begin_main_frame = false; | 1129 MainThreadOnly().have_seen_a_begin_main_frame = false; |
1130 MainThreadOnly().have_reported_blocking_intervention_since_navigation = false; | 1130 MainThreadOnly().have_reported_blocking_intervention_since_navigation = false; |
1131 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); | 1131 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); |
1132 } | 1132 } |
1133 | 1133 |
1134 double RendererSchedulerImpl::CurrentTimeSeconds() const { | 1134 double RendererSchedulerImpl::VirtualTimeSeconds() const { |
1135 return helper_.scheduler_tqm_delegate()->CurrentTimeSeconds(); | 1135 TaskQueue* current_tq = helper_.CurrentlyExecutingTaskQueue(); |
| 1136 if (current_tq && current_tq->GetTimeDomain()) { |
| 1137 return (current_tq->GetTimeDomain()->Now() - |
| 1138 base::TimeTicks::UnixEpoch()).InSecondsF(); |
| 1139 } |
| 1140 return (helper_.scheduler_tqm_delegate()->NowTicks() - |
| 1141 base::TimeTicks::UnixEpoch()).InSecondsF(); |
1136 } | 1142 } |
1137 | 1143 |
1138 double RendererSchedulerImpl::MonotonicallyIncreasingTimeSeconds() const { | 1144 double RendererSchedulerImpl::MonotonicallyIncreasingVirtualTimeSeconds() |
| 1145 const { |
| 1146 TaskQueue* current_tq = helper_.CurrentlyExecutingTaskQueue(); |
| 1147 if (current_tq && current_tq->GetTimeDomain()) { |
| 1148 return current_tq->GetTimeDomain()->Now().ToInternalValue() / |
| 1149 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
| 1150 } |
1139 return helper_.scheduler_tqm_delegate()->NowTicks().ToInternalValue() / | 1151 return helper_.scheduler_tqm_delegate()->NowTicks().ToInternalValue() / |
1140 static_cast<double>(base::Time::kMicrosecondsPerSecond); | 1152 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
1141 } | 1153 } |
1142 | 1154 |
1143 void RendererSchedulerImpl::RegisterTimeDomain(TimeDomain* time_domain) { | 1155 void RendererSchedulerImpl::RegisterTimeDomain(TimeDomain* time_domain) { |
1144 helper_.RegisterTimeDomain(time_domain); | 1156 helper_.RegisterTimeDomain(time_domain); |
1145 } | 1157 } |
1146 | 1158 |
1147 void RendererSchedulerImpl::UnregisterTimeDomain(TimeDomain* time_domain) { | 1159 void RendererSchedulerImpl::UnregisterTimeDomain(TimeDomain* time_domain) { |
1148 helper_.UnregisterTimeDomain(time_domain); | 1160 helper_.UnregisterTimeDomain(time_domain); |
1149 } | 1161 } |
1150 | 1162 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 } | 1204 } |
1193 MainThreadOnly().have_reported_blocking_intervention_since_navigation = | 1205 MainThreadOnly().have_reported_blocking_intervention_since_navigation = |
1194 true; | 1206 true; |
1195 BroadcastConsoleWarning( | 1207 BroadcastConsoleWarning( |
1196 "Deferred long-running timer task(s) to improve scrolling smoothness. " | 1208 "Deferred long-running timer task(s) to improve scrolling smoothness. " |
1197 "See crbug.com/574343."); | 1209 "See crbug.com/574343."); |
1198 } | 1210 } |
1199 } | 1211 } |
1200 | 1212 |
1201 } // namespace scheduler | 1213 } // namespace scheduler |
OLD | NEW |