summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen <jochen@chromium.org>2015-04-21 03:28:49 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-21 10:29:05 +0000
commita3635a7de383a295e52a35c1ae4e72aecab14d77 (patch)
treecb2377acf1e84ba1aef39b34ae1704b291f809fa
parenta98a4db15b9affbd2d03cd8a2809ca2f0c1fdbac (diff)
downloadchromium_src-a3635a7de383a295e52a35c1ae4e72aecab14d77.zip
chromium_src-a3635a7de383a295e52a35c1ae4e72aecab14d77.tar.gz
chromium_src-a3635a7de383a295e52a35c1ae4e72aecab14d77.tar.bz2
Remove dependency on cc::TestNowSource from scheduler code
BUG=478736 R=skyostil@chromium.org Review URL: https://codereview.chromium.org/1098033002 Cr-Commit-Position: refs/heads/master@{#326006}
-rw-r--r--content/child/scheduler/scheduler_helper.cc14
-rw-r--r--content/child/scheduler/scheduler_helper.h7
-rw-r--r--content/child/scheduler/scheduler_helper_unittest.cc8
-rw-r--r--content/child/scheduler/task_queue_manager.cc10
-rw-r--r--content/child/scheduler/task_queue_manager.h12
-rw-r--r--content/child/scheduler/task_queue_manager_unittest.cc9
-rw-r--r--content/child/scheduler/time_source.cc19
-rw-r--r--content/child/scheduler/time_source.h26
-rw-r--r--content/child/scheduler/worker_scheduler_impl.cc5
-rw-r--r--content/child/scheduler/worker_scheduler_impl.h2
-rw-r--r--content/child/scheduler/worker_scheduler_impl_unittest.cc8
-rw-r--r--content/content_child.gypi2
-rw-r--r--content/content_tests.gypi2
-rw-r--r--content/renderer/scheduler/renderer_scheduler_impl.cc5
-rw-r--r--content/renderer/scheduler/renderer_scheduler_impl.h2
-rw-r--r--content/renderer/scheduler/renderer_scheduler_impl_unittest.cc44
-rw-r--r--content/test/test_time_source.cc22
-rw-r--r--content/test/test_time_source.h32
-rw-r--r--tools/ubsan/blacklist.txt3
19 files changed, 190 insertions, 42 deletions
diff --git a/content/child/scheduler/scheduler_helper.cc b/content/child/scheduler/scheduler_helper.cc
index cc77b27..91f4abb 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
diff --git a/content/child/scheduler/scheduler_helper.h b/content/child/scheduler/scheduler_helper.h
index ef88b39..0e03aa9 100644
--- a/content/child/scheduler/scheduler_helper.h
+++ b/content/child/scheduler/scheduler_helper.h
@@ -5,10 +5,10 @@
#ifndef CONTENT_CHILD_SCHEDULER_SCHEDULER_HELPER_H_
#define CONTENT_CHILD_SCHEDULER_SCHEDULER_HELPER_H_
-#include "cc/test/test_now_source.h"
#include "content/child/scheduler/cancelable_closure_holder.h"
#include "content/child/scheduler/single_thread_idle_task_runner.h"
#include "content/child/scheduler/task_queue_manager.h"
+#include "content/child/scheduler/time_source.h"
namespace content {
@@ -165,8 +165,9 @@ class CONTENT_EXPORT SchedulerHelper {
bool IsQueueEmpty(size_t queue_index) const;
// Test helpers.
- void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source);
+ void SetTimeSourceForTesting(scoped_ptr<TimeSource> time_source);
void SetWorkBatchSizeForTesting(size_t work_batch_size);
+ TaskQueueManager* GetTaskQueueManagerForTesting();
private:
friend class SchedulerHelperTest;
@@ -196,7 +197,7 @@ class CONTENT_EXPORT SchedulerHelper {
base::TimeDelta required_quiescence_duration_before_long_idle_period_;
base::TimeTicks idle_period_deadline_;
- scoped_refptr<cc::TestNowSource> time_source_;
+ scoped_ptr<TimeSource> time_source_;
const char* tracing_category_;
const char* disabled_by_default_tracing_category_;
diff --git a/content/child/scheduler/scheduler_helper_unittest.cc b/content/child/scheduler/scheduler_helper_unittest.cc
index faeba6b..d3e9bda 100644
--- a/content/child/scheduler/scheduler_helper_unittest.cc
+++ b/content/child/scheduler/scheduler_helper_unittest.cc
@@ -6,8 +6,11 @@
#include "base/callback.h"
#include "cc/test/ordered_simple_task_runner.h"
+#include "cc/test/test_now_source.h"
#include "content/child/scheduler/nestable_task_runner_for_test.h"
#include "content/child/scheduler/scheduler_message_loop_delegate.h"
+#include "content/child/scheduler/task_queue_manager.h"
+#include "content/test/test_time_source.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -151,7 +154,10 @@ class BaseSchedulerHelperTest : public testing::Test {
required_quiescence_duration_before_long_idle_period)),
default_task_runner_(scheduler_helper_->DefaultTaskRunner()),
idle_task_runner_(scheduler_helper_->IdleTaskRunner()) {
- scheduler_helper_->SetTimeSourceForTesting(clock_);
+ scheduler_helper_->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
+ scheduler_helper_->GetTaskQueueManagerForTesting()->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
}
~BaseSchedulerHelperTest() override {}
diff --git a/content/child/scheduler/task_queue_manager.cc b/content/child/scheduler/task_queue_manager.cc
index 440da4c..646c859 100644
--- a/content/child/scheduler/task_queue_manager.cc
+++ b/content/child/scheduler/task_queue_manager.cc
@@ -10,9 +10,9 @@
#include "base/bind.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
-#include "cc/test/test_now_source.h"
#include "content/child/scheduler/nestable_single_thread_task_runner.h"
#include "content/child/scheduler/task_queue_selector.h"
+#include "content/child/scheduler/time_source.h"
namespace {
const int64_t kMaxTimeTicks = std::numeric_limits<int64>::max();
@@ -461,7 +461,7 @@ TaskQueueManager::TaskQueueManager(
task_was_run_bitmap_(0),
pending_dowork_count_(0),
work_batch_size_(1),
- time_source_(nullptr),
+ time_source_(new TimeSource),
disabled_by_default_tracing_category_(
disabled_by_default_tracing_category),
deletion_sentinel_(new DeletionSentinel()),
@@ -703,9 +703,9 @@ void TaskQueueManager::RemoveTaskObserver(
}
void TaskQueueManager::SetTimeSourceForTesting(
- scoped_refptr<cc::TestNowSource> time_source) {
+ scoped_ptr<TimeSource> time_source) {
DCHECK(main_thread_checker_.CalledOnValidThread());
- time_source_ = time_source;
+ time_source_ = time_source.Pass();
}
uint64 TaskQueueManager::GetAndClearTaskWasRunOnQueueBitmap() {
@@ -715,7 +715,7 @@ uint64 TaskQueueManager::GetAndClearTaskWasRunOnQueueBitmap() {
}
base::TimeTicks TaskQueueManager::Now() const {
- return UNLIKELY(time_source_) ? time_source_->Now() : base::TimeTicks::Now();
+ return time_source_->Now();
}
scoped_refptr<base::trace_event::ConvertableToTraceFormat>
diff --git a/content/child/scheduler/task_queue_manager.h b/content/child/scheduler/task_queue_manager.h
index 2fb3550..4858819 100644
--- a/content/child/scheduler/task_queue_manager.h
+++ b/content/child/scheduler/task_queue_manager.h
@@ -15,6 +15,7 @@
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "content/child/scheduler/task_queue_selector.h"
+#include "content/child/scheduler/time_source.h"
#include "content/common/content_export.h"
namespace base {
@@ -24,17 +25,14 @@ class TracedValue;
}
}
-namespace cc {
-class TestNowSource;
-}
-
namespace content {
namespace internal {
class LazyNow;
class TaskQueue;
}
-class TaskQueueSelector;
class NestableSingleThreadTaskRunner;
+class TaskQueueSelector;
+class TimeSource;
// The task queue manager provides N task queues and a selector interface for
// choosing which task queue to service next. Each task queue consists of two
@@ -124,7 +122,7 @@ class CONTENT_EXPORT TaskQueueManager
void AddTaskObserver(base::MessageLoop::TaskObserver* task_observer);
void RemoveTaskObserver(base::MessageLoop::TaskObserver* task_observer);
- void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source);
+ void SetTimeSourceForTesting(scoped_ptr<TimeSource> time_source);
// Returns a bitmap where a bit is set iff a task on the corresponding queue
// was run since the last call to GetAndClearTaskWasRunOnQueueBitmap.
@@ -211,7 +209,7 @@ class CONTENT_EXPORT TaskQueueManager
int work_batch_size_;
- scoped_refptr<cc::TestNowSource> time_source_;
+ scoped_ptr<TimeSource> time_source_;
ObserverList<base::MessageLoop::TaskObserver> task_observers_;
diff --git a/content/child/scheduler/task_queue_manager_unittest.cc b/content/child/scheduler/task_queue_manager_unittest.cc
index 17a206b..5a57320 100644
--- a/content/child/scheduler/task_queue_manager_unittest.cc
+++ b/content/child/scheduler/task_queue_manager_unittest.cc
@@ -10,6 +10,7 @@
#include "content/child/scheduler/nestable_task_runner_for_test.h"
#include "content/child/scheduler/scheduler_message_loop_delegate.h"
#include "content/child/scheduler/task_queue_selector.h"
+#include "content/test/test_time_source.h"
#include "testing/gmock/include/gmock/gmock.h"
using testing::ElementsAre;
@@ -123,7 +124,8 @@ class TaskQueueManagerTest : public testing::Test {
manager_ = make_scoped_ptr(new TaskQueueManager(
num_queues, NestableTaskRunnerForTest::Create(test_task_runner_.get()),
selector_.get(), "test.scheduler"));
- manager_->SetTimeSourceForTesting(now_src_);
+ manager_->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(now_src_)));
EXPECT_EQ(num_queues, selector_->work_queues().size());
}
@@ -223,7 +225,8 @@ TEST_F(TaskQueueManagerTest, NowNotCalledWhenThereAreNoDelayedTasks) {
Initialize(3u, SelectorType::Explicit);
scoped_refptr<cc::TestNowSource> now_src = cc::TestNowSource::Create(1000);
- manager_->SetTimeSourceForTesting(now_src);
+ manager_->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(now_src)));
scoped_refptr<base::SingleThreadTaskRunner> runners[3] = {
manager_->TaskRunnerForQueue(0),
@@ -987,7 +990,7 @@ TEST_F(TaskQueueManagerTest, ThreadCheckAfterTermination) {
TEST_F(TaskQueueManagerTest, NextPendingDelayedTaskRunTime) {
scoped_refptr<cc::TestNowSource> clock(cc::TestNowSource::Create());
Initialize(2u, SelectorType::Explicit);
- manager_->SetTimeSourceForTesting(clock);
+ manager_->SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock)));
scoped_refptr<base::SingleThreadTaskRunner> runners[2] = {
manager_->TaskRunnerForQueue(0), manager_->TaskRunnerForQueue(1)};
diff --git a/content/child/scheduler/time_source.cc b/content/child/scheduler/time_source.cc
new file mode 100644
index 0000000..ce64df8
--- /dev/null
+++ b/content/child/scheduler/time_source.cc
@@ -0,0 +1,19 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/child/scheduler/time_source.h"
+
+namespace content {
+
+TimeSource::TimeSource() {
+}
+
+TimeSource::~TimeSource() {
+}
+
+base::TimeTicks TimeSource::Now() const {
+ return base::TimeTicks::Now();
+}
+
+} // namespace content
diff --git a/content/child/scheduler/time_source.h b/content/child/scheduler/time_source.h
new file mode 100644
index 0000000..e5d8606
--- /dev/null
+++ b/content/child/scheduler/time_source.h
@@ -0,0 +1,26 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_CHILD_SCHEDULER_TIME_SOURCE_H_
+#define CONTENT_CHILD_SCHEDULER_TIME_SOURCE_H_
+
+#include "base/time/time.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+class CONTENT_EXPORT TimeSource {
+ public:
+ TimeSource();
+ virtual ~TimeSource();
+
+ virtual base::TimeTicks Now() const;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TimeSource);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_SCHEDULER_TIME_SOURCE_H_
diff --git a/content/child/scheduler/worker_scheduler_impl.cc b/content/child/scheduler/worker_scheduler_impl.cc
index f638868..c22c0c3 100644
--- a/content/child/scheduler/worker_scheduler_impl.cc
+++ b/content/child/scheduler/worker_scheduler_impl.cc
@@ -75,9 +75,8 @@ void WorkerSchedulerImpl::Shutdown() {
helper_.Shutdown();
}
-void WorkerSchedulerImpl::SetTimeSourceForTesting(
- scoped_refptr<cc::TestNowSource> time_source) {
- helper_.SetTimeSourceForTesting(time_source);
+SchedulerHelper* WorkerSchedulerImpl::GetSchedulerHelperForTesting() {
+ return &helper_;
}
void WorkerSchedulerImpl::SetWorkBatchSizeForTesting(size_t work_batch_size) {
diff --git a/content/child/scheduler/worker_scheduler_impl.h b/content/child/scheduler/worker_scheduler_impl.h
index 043476d..06e9d58 100644
--- a/content/child/scheduler/worker_scheduler_impl.h
+++ b/content/child/scheduler/worker_scheduler_impl.h
@@ -37,7 +37,7 @@ class CONTENT_EXPORT WorkerSchedulerImpl
void Init() override;
void Shutdown() override;
- void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source);
+ SchedulerHelper* GetSchedulerHelperForTesting();
void SetWorkBatchSizeForTesting(size_t work_batch_size);
base::TimeTicks CurrentIdleTaskDeadlineForTesting() const;
diff --git a/content/child/scheduler/worker_scheduler_impl_unittest.cc b/content/child/scheduler/worker_scheduler_impl_unittest.cc
index eed8f55..edeaa36 100644
--- a/content/child/scheduler/worker_scheduler_impl_unittest.cc
+++ b/content/child/scheduler/worker_scheduler_impl_unittest.cc
@@ -7,8 +7,10 @@
#include "base/callback.h"
#include "base/strings/stringprintf.h"
#include "cc/test/ordered_simple_task_runner.h"
+#include "cc/test/test_now_source.h"
#include "content/child/scheduler/nestable_task_runner_for_test.h"
#include "content/child/scheduler/scheduler_message_loop_delegate.h"
+#include "content/test/test_time_source.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -103,7 +105,11 @@ class WorkerSchedulerImplTest : public testing::Test {
scheduler_(
new WorkerSchedulerImplForTest(nestable_task_runner_, clock_)),
timeline_(nullptr) {
- scheduler_->SetTimeSourceForTesting(clock_);
+ scheduler_->GetSchedulerHelperForTesting()->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
+ scheduler_->GetSchedulerHelperForTesting()
+ ->GetTaskQueueManagerForTesting()
+ ->SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock_)));
}
~WorkerSchedulerImplTest() override {}
diff --git a/content/content_child.gypi b/content/content_child.gypi
index df58526..297c40d 100644
--- a/content/content_child.gypi
+++ b/content/content_child.gypi
@@ -209,6 +209,8 @@
'child/scheduler/task_queue_selector.h',
'child/scheduler/task_queue_manager.cc',
'child/scheduler/task_queue_manager.h',
+ 'child/scheduler/time_source.cc',
+ 'child/scheduler/time_source.h',
'child/scheduler/webthread_impl_for_worker_scheduler.cc',
'child/scheduler/webthread_impl_for_worker_scheduler.h',
'child/scheduler/web_scheduler_impl.cc',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 5f097f3..a9938c2 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -163,6 +163,8 @@
'test/test_render_view_host.h',
'test/test_render_view_host_factory.cc',
'test/test_render_view_host_factory.h',
+ 'test/test_time_source.cc',
+ 'test/test_time_source.h',
'test/test_web_contents.cc',
'test/test_web_contents.h',
'test/test_web_contents_factory.cc',
diff --git a/content/renderer/scheduler/renderer_scheduler_impl.cc b/content/renderer/scheduler/renderer_scheduler_impl.cc
index be1eaf4..7ca3eb7 100644
--- a/content/renderer/scheduler/renderer_scheduler_impl.cc
+++ b/content/renderer/scheduler/renderer_scheduler_impl.cc
@@ -485,9 +485,8 @@ bool RendererSchedulerImpl::CanEnterLongIdlePeriod(
return true;
}
-void RendererSchedulerImpl::SetTimeSourceForTesting(
- scoped_refptr<cc::TestNowSource> time_source) {
- helper_.SetTimeSourceForTesting(time_source);
+SchedulerHelper* RendererSchedulerImpl::GetSchedulerHelperForTesting() {
+ return &helper_;
}
void RendererSchedulerImpl::SetWorkBatchSizeForTesting(size_t work_batch_size) {
diff --git a/content/renderer/scheduler/renderer_scheduler_impl.h b/content/renderer/scheduler/renderer_scheduler_impl.h
index 588bb9b..04c9ab8 100644
--- a/content/renderer/scheduler/renderer_scheduler_impl.h
+++ b/content/renderer/scheduler/renderer_scheduler_impl.h
@@ -51,7 +51,7 @@ class CONTENT_EXPORT RendererSchedulerImpl
void SuspendTimerQueue() override;
void ResumeTimerQueue() override;
- void SetTimeSourceForTesting(scoped_refptr<cc::TestNowSource> time_source);
+ SchedulerHelper* GetSchedulerHelperForTesting();
void SetWorkBatchSizeForTesting(size_t work_batch_size);
base::TimeTicks CurrentIdleTaskDeadlineForTesting() const;
diff --git a/content/renderer/scheduler/renderer_scheduler_impl_unittest.cc b/content/renderer/scheduler/renderer_scheduler_impl_unittest.cc
index b3f6aff..150be2e 100644
--- a/content/renderer/scheduler/renderer_scheduler_impl_unittest.cc
+++ b/content/renderer/scheduler/renderer_scheduler_impl_unittest.cc
@@ -7,8 +7,10 @@
#include "base/callback.h"
#include "cc/output/begin_frame_args.h"
#include "cc/test/ordered_simple_task_runner.h"
+#include "cc/test/test_now_source.h"
#include "content/child/scheduler/nestable_task_runner_for_test.h"
#include "content/child/scheduler/scheduler_message_loop_delegate.h"
+#include "content/test/test_time_source.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -136,7 +138,11 @@ class RendererSchedulerImplTest : public testing::Test {
loading_task_runner_(scheduler_->LoadingTaskRunner()),
idle_task_runner_(scheduler_->IdleTaskRunner()),
timer_task_runner_(scheduler_->TimerTaskRunner()) {
- scheduler_->SetTimeSourceForTesting(clock_);
+ scheduler_->GetSchedulerHelperForTesting()->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
+ scheduler_->GetSchedulerHelperForTesting()
+ ->GetTaskQueueManagerForTesting()
+ ->SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock_)));
}
RendererSchedulerImplTest(base::MessageLoop* message_loop)
@@ -150,7 +156,11 @@ class RendererSchedulerImplTest : public testing::Test {
loading_task_runner_(scheduler_->LoadingTaskRunner()),
idle_task_runner_(scheduler_->IdleTaskRunner()),
timer_task_runner_(scheduler_->TimerTaskRunner()) {
- scheduler_->SetTimeSourceForTesting(clock_);
+ scheduler_->GetSchedulerHelperForTesting()->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
+ scheduler_->GetSchedulerHelperForTesting()
+ ->GetTaskQueueManagerForTesting()
+ ->SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock_)));
}
~RendererSchedulerImplTest() override {}
@@ -954,7 +964,11 @@ TEST_F(RendererSchedulerImplTest, OnePendingDelayedAndOneUrgentUpdatePolicy) {
RendererSchedulerImplForTest* mock_scheduler =
new RendererSchedulerImplForTest(nestable_task_runner_);
scheduler_.reset(mock_scheduler);
- scheduler_->SetTimeSourceForTesting(clock_);
+ scheduler_->GetSchedulerHelperForTesting()->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
+ scheduler_->GetSchedulerHelperForTesting()
+ ->GetTaskQueueManagerForTesting()
+ ->SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock_)));
mock_task_runner_->SetAutoAdvanceNowToPendingTasks(true);
ScheduleDelayedPolicyUpdate(base::TimeDelta::FromMilliseconds(1));
@@ -970,7 +984,11 @@ TEST_F(RendererSchedulerImplTest, OneUrgentAndOnePendingDelayedUpdatePolicy) {
RendererSchedulerImplForTest* mock_scheduler =
new RendererSchedulerImplForTest(nestable_task_runner_);
scheduler_.reset(mock_scheduler);
- scheduler_->SetTimeSourceForTesting(clock_);
+ scheduler_->GetSchedulerHelperForTesting()->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
+ scheduler_->GetSchedulerHelperForTesting()
+ ->GetTaskQueueManagerForTesting()
+ ->SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock_)));
mock_task_runner_->SetAutoAdvanceNowToPendingTasks(true);
EnsureUrgentPolicyUpdatePostedOnMainThread();
@@ -986,7 +1004,11 @@ TEST_F(RendererSchedulerImplTest, UpdatePolicyCountTriggeredByOneInputEvent) {
RendererSchedulerImplForTest* mock_scheduler =
new RendererSchedulerImplForTest(nestable_task_runner_);
scheduler_.reset(mock_scheduler);
- scheduler_->SetTimeSourceForTesting(clock_);
+ scheduler_->GetSchedulerHelperForTesting()->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
+ scheduler_->GetSchedulerHelperForTesting()
+ ->GetTaskQueueManagerForTesting()
+ ->SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock_)));
mock_task_runner_->SetAutoAdvanceNowToPendingTasks(true);
scheduler_->DidReceiveInputEventOnCompositorThread(
@@ -1002,7 +1024,11 @@ TEST_F(RendererSchedulerImplTest, UpdatePolicyCountTriggeredByTwoInputEvents) {
RendererSchedulerImplForTest* mock_scheduler =
new RendererSchedulerImplForTest(nestable_task_runner_);
scheduler_.reset(mock_scheduler);
- scheduler_->SetTimeSourceForTesting(clock_);
+ scheduler_->GetSchedulerHelperForTesting()->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
+ scheduler_->GetSchedulerHelperForTesting()
+ ->GetTaskQueueManagerForTesting()
+ ->SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock_)));
mock_task_runner_->SetAutoAdvanceNowToPendingTasks(true);
scheduler_->DidReceiveInputEventOnCompositorThread(
@@ -1020,7 +1046,11 @@ TEST_F(RendererSchedulerImplTest, EnsureUpdatePolicyNotTriggeredTooOften) {
RendererSchedulerImplForTest* mock_scheduler =
new RendererSchedulerImplForTest(nestable_task_runner_);
scheduler_.reset(mock_scheduler);
- scheduler_->SetTimeSourceForTesting(clock_);
+ scheduler_->GetSchedulerHelperForTesting()->SetTimeSourceForTesting(
+ make_scoped_ptr(new TestTimeSource(clock_)));
+ scheduler_->GetSchedulerHelperForTesting()
+ ->GetTaskQueueManagerForTesting()
+ ->SetTimeSourceForTesting(make_scoped_ptr(new TestTimeSource(clock_)));
mock_task_runner_->SetAutoAdvanceNowToPendingTasks(true);
scheduler_->DidReceiveInputEventOnCompositorThread(
diff --git a/content/test/test_time_source.cc b/content/test/test_time_source.cc
new file mode 100644
index 0000000..ad602fd
--- /dev/null
+++ b/content/test/test_time_source.cc
@@ -0,0 +1,22 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/test/test_time_source.h"
+
+#include "cc/test/test_now_source.h"
+
+namespace content {
+
+TestTimeSource::TestTimeSource(scoped_refptr<cc::TestNowSource> time_source)
+ : time_source_(time_source) {
+}
+
+TestTimeSource::~TestTimeSource() {
+}
+
+base::TimeTicks TestTimeSource::Now() const {
+ return time_source_->Now();
+}
+
+} // namespace content
diff --git a/content/test/test_time_source.h b/content/test/test_time_source.h
new file mode 100644
index 0000000..04270ec
--- /dev/null
+++ b/content/test/test_time_source.h
@@ -0,0 +1,32 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_TEST_TEST_TIME_SOURCE_H_
+#define CONTENT_TEST_TEST_TIME_SOURCE_H_
+
+#include "base/memory/ref_counted.h"
+#include "content/child/scheduler/time_source.h"
+
+namespace cc {
+class TestNowSource;
+}
+
+namespace content {
+
+class TestTimeSource : public TimeSource {
+ public:
+ explicit TestTimeSource(scoped_refptr<cc::TestNowSource> time_source);
+ ~TestTimeSource() override;
+
+ base::TimeTicks Now() const override;
+
+ private:
+ scoped_refptr<cc::TestNowSource> time_source_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestTimeSource);
+};
+
+} // namespace content
+
+#endif // CONTENT_TEST_TEST_TIME_SOURCE_H_
diff --git a/tools/ubsan/blacklist.txt b/tools/ubsan/blacklist.txt
index 1082748..2db4e18 100644
--- a/tools/ubsan/blacklist.txt
+++ b/tools/ubsan/blacklist.txt
@@ -95,9 +95,6 @@ src:*/third_party/pdfium/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
# obj/third_party/libwebm/libwebm.a(obj/third_party/libwebm/source/libwebm.mkvmuxer.o)(.data.rel..L__unnamed_2+0x18): error: undefined reference to 'typeinfo for mkvparser::IMkvReader'
src:*/third_party/libwebm/source/mkvmuxer.cpp
-# obj/content/libcontent_renderer.a(obj/content/renderer/scheduler/content_renderer.renderer_scheduler_impl.o)(.data.rel..L__unnamed_399+0x18): error: undefined reference to ' typeinfo for cc::TestNowSource'
-type:*TestNowSource*
-
#############################################################################
# UBSan seems to be emit false positives when virtual base classes are
# involved, see e.g. crbug.com/448102.