Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: components/scheduler/renderer/renderer_scheduler_impl.cc

Issue 1652083002: Prepare for per-webview virtual time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename useVirtualTime Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 AnyThread().user_model.Reset(helper_.scheduler_tqm_delegate()->NowTicks()); 1123 AnyThread().user_model.Reset(helper_.scheduler_tqm_delegate()->NowTicks());
1124 AnyThread().have_seen_touchstart = false; 1124 AnyThread().have_seen_touchstart = false;
1125 MainThreadOnly().loading_task_cost_estimator.Clear(); 1125 MainThreadOnly().loading_task_cost_estimator.Clear();
1126 MainThreadOnly().timer_task_cost_estimator.Clear(); 1126 MainThreadOnly().timer_task_cost_estimator.Clear();
1127 MainThreadOnly().idle_time_estimator.Clear(); 1127 MainThreadOnly().idle_time_estimator.Clear();
1128 MainThreadOnly().have_seen_a_begin_main_frame = false; 1128 MainThreadOnly().have_seen_a_begin_main_frame = false;
1129 MainThreadOnly().have_reported_blocking_intervention_since_navigation = false; 1129 MainThreadOnly().have_reported_blocking_intervention_since_navigation = false;
1130 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); 1130 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED);
1131 } 1131 }
1132 1132
1133 double RendererSchedulerImpl::CurrentTimeSeconds() const { 1133 double RendererSchedulerImpl::VirtualTimeSeconds() const {
1134 return helper_.scheduler_tqm_delegate()->CurrentTimeSeconds(); 1134 TaskQueue* current_tq = helper_.CurrentlyExecutingTaskQueue();
1135 base::TimeTicks now = current_tq
1136 ? current_tq->GetTimeDomain()->Now()
1137 : helper_.scheduler_tqm_delegate()->NowTicks();
1138 return (now - base::TimeTicks::UnixEpoch()).InSecondsF();
1135 } 1139 }
1136 1140
1137 double RendererSchedulerImpl::MonotonicallyIncreasingTimeSeconds() const { 1141 double RendererSchedulerImpl::MonotonicallyIncreasingVirtualTimeSeconds()
1138 return helper_.scheduler_tqm_delegate()->NowTicks().ToInternalValue() / 1142 const {
1143 TaskQueue* current_tq = helper_.CurrentlyExecutingTaskQueue();
1144 base::TimeTicks now = current_tq
1145 ? current_tq->GetTimeDomain()->Now()
1146 : helper_.scheduler_tqm_delegate()->NowTicks();
1147 return now.ToInternalValue() /
1139 static_cast<double>(base::Time::kMicrosecondsPerSecond); 1148 static_cast<double>(base::Time::kMicrosecondsPerSecond);
1140 } 1149 }
1141 1150
1142 void RendererSchedulerImpl::RegisterTimeDomain(TimeDomain* time_domain) { 1151 void RendererSchedulerImpl::RegisterTimeDomain(TimeDomain* time_domain) {
1143 helper_.RegisterTimeDomain(time_domain); 1152 helper_.RegisterTimeDomain(time_domain);
1144 } 1153 }
1145 1154
1146 void RendererSchedulerImpl::UnregisterTimeDomain(TimeDomain* time_domain) { 1155 void RendererSchedulerImpl::UnregisterTimeDomain(TimeDomain* time_domain) {
1147 helper_.UnregisterTimeDomain(time_domain); 1156 helper_.UnregisterTimeDomain(time_domain);
1148 } 1157 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 } 1200 }
1192 MainThreadOnly().have_reported_blocking_intervention_since_navigation = 1201 MainThreadOnly().have_reported_blocking_intervention_since_navigation =
1193 true; 1202 true;
1194 BroadcastConsoleWarning( 1203 BroadcastConsoleWarning(
1195 "Deferred long-running timer task(s) to improve scrolling smoothness. " 1204 "Deferred long-running timer task(s) to improve scrolling smoothness. "
1196 "See crbug.com/574343."); 1205 "See crbug.com/574343.");
1197 } 1206 }
1198 } 1207 }
1199 1208
1200 } // namespace scheduler 1209 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698