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

Unified Diff: cc/test/scheduler_test_common.cc

Issue 267783004: Refactoring the way begin frame sources inside scheduler work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Major rewrite based on Brian's comments. Created 6 years, 3 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
Index: cc/test/scheduler_test_common.cc
diff --git a/cc/test/scheduler_test_common.cc b/cc/test/scheduler_test_common.cc
index 7001b59ddeadd00e0c4563aa4acdb5f4fceed335..e93c71958b82aad345862c30c50681ac941fe1e0 100644
--- a/cc/test/scheduler_test_common.cc
+++ b/cc/test/scheduler_test_common.cc
@@ -34,6 +34,19 @@ std::string TestDelayBasedTimeSource::TypeString() const {
TestDelayBasedTimeSource::~TestDelayBasedTimeSource() {
}
+bool FakeBeginFrameSource::NeedsBeginFrames() {
+ return needs_begin_frames_;
+}
+void FakeBeginFrameSource::SetNeedsBeginFrames(bool needs_begin_frames) {
+ needs_begin_frames_ = needs_begin_frames;
+}
+void FakeBeginFrameSource::FinishedFrame(size_t remaining_frames) {
+ remaining_frames_ = remaining_frames;
+}
+void FakeBeginFrameSource::AsValueInto(base::debug::TracedValue* dict) const {
+ dict->SetString("type", "FakeBeginFrameSource");
+}
+
TestScheduler::TestScheduler(
scoped_refptr<TestNowSource> now_src,
SchedulerClient* client,
@@ -46,12 +59,20 @@ TestScheduler::TestScheduler(
test_task_runner),
now_src_(now_src),
test_task_runner_(test_task_runner.get()) {
+}
+
+void TestScheduler::SetUpBackgroundFrameSource() {
+ background_frame_source_store_ = TestSyntheticBeginFrameSource::Create(
+ now_src_, test_task_runner_, base::TimeDelta::FromSeconds(1));
+}
+
+void TestScheduler::SetUpPrimaryFrameSource() {
if (!settings_.begin_frame_scheduling_enabled) {
- scoped_refptr<DelayBasedTimeSource> time_source =
- TestDelayBasedTimeSource::Create(
- now_src, VSyncInterval(), test_task_runner_);
- synthetic_begin_frame_source_.reset(
- new SyntheticBeginFrameSource(this, time_source));
+ primary_frame_source_store_ = TestSyntheticBeginFrameSource::Create(
+ now_src_, test_task_runner_, BeginFrameArgs::DefaultInterval());
+ primary_frame_source_ = primary_frame_source_store_.get();
+ } else {
+ Scheduler::SetUpPrimaryFrameSource();
}
}

Powered by Google App Engine
This is Rietveld 408576698