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

Unified Diff: components/scheduler/child/idle_helper.cc

Issue 1424053002: Adds a flag to support "Virtual Time" to the blink scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/scheduler/child/idle_helper.cc
diff --git a/components/scheduler/child/idle_helper.cc b/components/scheduler/child/idle_helper.cc
index dc58c88fd7f46866758f41b65049c2f3d0a489e9..90f6d62a1c8582ae41456d38dfd993f770cd2ee6 100644
--- a/components/scheduler/child/idle_helper.cc
+++ b/components/scheduler/child/idle_helper.cc
@@ -139,7 +139,7 @@ void IdleHelper::EnableLongIdlePeriod() {
return;
}
- base::TimeTicks now(helper_->Now());
+ base::TimeTicks now(helper_->tick_clock()->NowTicks());
base::TimeDelta next_long_idle_period_delay;
IdlePeriodState new_idle_period_state =
ComputeNewLongIdlePeriodState(now, &next_long_idle_period_delay);
@@ -203,7 +203,7 @@ void IdleHelper::DidProcessTask(const base::PendingTask& pending_task) {
if (IsInIdlePeriod(state_.idle_period_state()) &&
state_.idle_period_state() !=
IdlePeriodState::IN_LONG_IDLE_PERIOD_PAUSED &&
- helper_->Now() >= state_.idle_period_deadline()) {
+ helper_->tick_clock()->NowTicks() >= state_.idle_period_deadline()) {
// If the idle period deadline has now been reached, either end the idle
// period or trigger a new long-idle period.
if (IsInLongIdlePeriod(state_.idle_period_state())) {
@@ -238,8 +238,9 @@ void IdleHelper::UpdateLongIdlePeriodStateAfterIdleTask() {
} else {
// Otherwise ensure that we kick the scheduler at the right time to
// initiate the next idle period.
- next_long_idle_period_delay = std::max(
- base::TimeDelta(), state_.idle_period_deadline() - helper_->Now());
+ next_long_idle_period_delay =
+ std::max(base::TimeDelta(), state_.idle_period_deadline() -
+ helper_->tick_clock()->NowTicks());
}
if (next_long_idle_period_delay == base::TimeDelta()) {
EnableLongIdlePeriod();
@@ -358,7 +359,9 @@ void IdleHelper::State::UpdateState(IdlePeriodState new_state,
bool is_tracing;
TRACE_EVENT_CATEGORY_GROUP_ENABLED(tracing_category_, &is_tracing);
if (is_tracing) {
- base::TimeTicks now(optional_now.is_null() ? helper_->Now() : optional_now);
+ base::TimeTicks now(optional_now.is_null()
+ ? helper_->tick_clock()->NowTicks()
+ : optional_now);
base::TraceTicks trace_now = base::TraceTicks::Now();
idle_period_deadline_for_tracing_ = trace_now + (new_deadline - now);
TraceEventIdlePeriodStateChange(
« no previous file with comments | « components/scheduler/base/task_queue_manager_unittest.cc ('k') | components/scheduler/child/idle_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698