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

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

Issue 1411843008: Make blink platform time consistent with the timer virtual time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CachingCorrectnessTest 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 5808cd6ecb3adce6af3485a40d1608c794f6b942..84f61712e0baf52782ee53f443facbef2200fa4d 100644
--- a/components/scheduler/child/idle_helper.cc
+++ b/components/scheduler/child/idle_helper.cc
@@ -10,6 +10,7 @@
#include "components/scheduler/base/task_queue.h"
#include "components/scheduler/base/task_queue_manager.h"
#include "components/scheduler/child/scheduler_helper.h"
+#include "components/scheduler/child/scheduler_tqm_delegate.h"
namespace scheduler {
@@ -139,7 +140,7 @@ void IdleHelper::EnableLongIdlePeriod() {
return;
}
- base::TimeTicks now(helper_->tick_clock()->NowTicks());
+ base::TimeTicks now(helper_->scheduler_tqm_delegate()->NowTicks());
base::TimeDelta next_long_idle_period_delay;
IdlePeriodState new_idle_period_state =
ComputeNewLongIdlePeriodState(now, &next_long_idle_period_delay);
@@ -203,7 +204,8 @@ 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_->tick_clock()->NowTicks() >= state_.idle_period_deadline()) {
+ helper_->scheduler_tqm_delegate()->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,9 +240,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_->tick_clock()->NowTicks());
+ next_long_idle_period_delay = std::max(
+ base::TimeDelta(), state_.idle_period_deadline() -
+ helper_->scheduler_tqm_delegate()->NowTicks());
}
if (next_long_idle_period_delay == base::TimeDelta()) {
EnableLongIdlePeriod();
@@ -360,7 +362,7 @@ void IdleHelper::State::UpdateState(IdlePeriodState new_state,
TRACE_EVENT_CATEGORY_GROUP_ENABLED(tracing_category_, &is_tracing);
if (is_tracing) {
base::TimeTicks now(optional_now.is_null()
- ? helper_->tick_clock()->NowTicks()
+ ? helper_->scheduler_tqm_delegate()->NowTicks()
: optional_now);
TraceEventIdlePeriodStateChange(
new_state, running_idle_task_for_tracing_, idle_period_deadline_, now);
« no previous file with comments | « components/scheduler/base/task_queue_manager_delegate_for_test.cc ('k') | components/scheduler/child/scheduler_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698