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

Unified Diff: content/child/scheduler/scheduler_helper.cc

Issue 1098033002: Remove dependency on cc::TestNowSource from scheduler code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/scheduler/scheduler_helper.h ('k') | content/child/scheduler/scheduler_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/scheduler/scheduler_helper.cc
diff --git a/content/child/scheduler/scheduler_helper.cc b/content/child/scheduler/scheduler_helper.cc
index cc77b279ca89ceff29db167a79da9af442070d0b..91f4abbd3f1320d905d5bdcb2fa33d5893dc4a78 100644
--- a/content/child/scheduler/scheduler_helper.cc
+++ b/content/child/scheduler/scheduler_helper.cc
@@ -8,6 +8,7 @@
#include "base/trace_event/trace_event_argument.h"
#include "content/child/scheduler/nestable_single_thread_task_runner.h"
#include "content/child/scheduler/prioritizing_task_queue_selector.h"
+#include "content/child/scheduler/time_source.h"
namespace content {
@@ -40,6 +41,7 @@ SchedulerHelper::SchedulerHelper(
~(1ull << QueueId::CONTROL_TASK_AFTER_WAKEUP_QUEUE)),
required_quiescence_duration_before_long_idle_period_(
required_quiescence_duration_before_long_idle_period),
+ time_source_(new TimeSource),
tracing_category_(tracing_category),
disabled_by_default_tracing_category_(
disabled_by_default_tracing_category),
@@ -312,10 +314,9 @@ bool SchedulerHelper::CanExceedIdleDeadlineIfRequired() const {
}
void SchedulerHelper::SetTimeSourceForTesting(
- scoped_refptr<cc::TestNowSource> time_source) {
+ scoped_ptr<TimeSource> time_source) {
CheckOnValidThread();
- time_source_ = time_source;
- task_queue_manager_->SetTimeSourceForTesting(time_source);
+ time_source_ = time_source.Pass();
}
void SchedulerHelper::SetWorkBatchSizeForTesting(size_t work_batch_size) {
@@ -323,8 +324,13 @@ void SchedulerHelper::SetWorkBatchSizeForTesting(size_t work_batch_size) {
task_queue_manager_->SetWorkBatchSize(work_batch_size);
}
+TaskQueueManager* SchedulerHelper::GetTaskQueueManagerForTesting() {
+ CheckOnValidThread();
+ return task_queue_manager_.get();
+}
+
base::TimeTicks SchedulerHelper::Now() const {
- return UNLIKELY(time_source_) ? time_source_->Now() : base::TimeTicks::Now();
+ return time_source_->Now();
}
SchedulerHelper::IdlePeriodState
« no previous file with comments | « content/child/scheduler/scheduler_helper.h ('k') | content/child/scheduler/scheduler_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698