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

Side by Side Diff: cc/test/scheduler_test_common.cc

Issue 1201573002: cc: Remove BeginFrameSourcesConstructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove refptr changes Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/scheduler_test_common.h" 5 #include "cc/test/scheduler_test_common.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 TestSyntheticBeginFrameSource::TestSyntheticBeginFrameSource( 60 TestSyntheticBeginFrameSource::TestSyntheticBeginFrameSource(
61 scoped_ptr<DelayBasedTimeSource> time_source) 61 scoped_ptr<DelayBasedTimeSource> time_source)
62 : SyntheticBeginFrameSource(time_source.Pass()) { 62 : SyntheticBeginFrameSource(time_source.Pass()) {
63 } 63 }
64 64
65 TestSyntheticBeginFrameSource::~TestSyntheticBeginFrameSource() { 65 TestSyntheticBeginFrameSource::~TestSyntheticBeginFrameSource() {
66 } 66 }
67 67
68 TestSchedulerFrameSourcesConstructor::TestSchedulerFrameSourcesConstructor( 68 scoped_ptr<TestScheduler> TestScheduler::Create(
69 OrderedSimpleTaskRunner* test_task_runner, 69 base::SimpleTestTickClock* now_src,
70 base::SimpleTestTickClock* now_src) 70 SchedulerClient* client,
71 : test_task_runner_(test_task_runner), now_src_(now_src) { 71 const SchedulerSettings& settings,
72 } 72 int layer_tree_host_id,
73 73 const scoped_refptr<OrderedSimpleTaskRunner>& task_runner,
74 TestSchedulerFrameSourcesConstructor::~TestSchedulerFrameSourcesConstructor() { 74 BeginFrameSource* external_frame_source) {
75 } 75 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source;
76 76 if (!settings.use_external_begin_frame_source) {
77 BeginFrameSource* 77 synthetic_frame_source = TestSyntheticBeginFrameSource::Create(
78 TestSchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( 78 now_src, task_runner.get(), BeginFrameArgs::DefaultInterval());
79 Scheduler* scheduler) {
80 if (scheduler->settings_.use_external_begin_frame_source) {
81 return SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource(
82 scheduler);
83 } else {
84 TRACE_EVENT1(
85 "cc",
86 "TestSchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource",
87 "source",
88 "TestSyntheticBeginFrameSource");
89 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_source =
90 TestSyntheticBeginFrameSource::Create(
91 now_src_, test_task_runner_, BeginFrameArgs::DefaultInterval());
92
93 DCHECK(!scheduler->vsync_observer_);
94 scheduler->vsync_observer_ = synthetic_source.get();
95
96 DCHECK(!scheduler->primary_frame_source_internal_);
97 scheduler->primary_frame_source_internal_ = synthetic_source.Pass();
98 return scheduler->primary_frame_source_internal_.get();
99 } 79 }
100 } 80 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source =
101 81 TestBackToBackBeginFrameSource::Create(now_src, task_runner.get());
102 BeginFrameSource* 82 return make_scoped_ptr(new TestScheduler(
103 TestSchedulerFrameSourcesConstructor::ConstructUnthrottledFrameSource( 83 now_src, client, settings, layer_tree_host_id, task_runner,
104 Scheduler* scheduler) { 84 external_frame_source, synthetic_frame_source.Pass(),
105 TRACE_EVENT1( 85 unthrottled_frame_source.Pass()));
106 "cc",
107 "TestSchedulerFrameSourcesConstructor::ConstructUnthrottledFrameSource",
108 "source", "TestBackToBackBeginFrameSource");
109 DCHECK(!scheduler->unthrottled_frame_source_internal_);
110 scheduler->unthrottled_frame_source_internal_ =
111 TestBackToBackBeginFrameSource::Create(now_src_, test_task_runner_);
112 return scheduler->unthrottled_frame_source_internal_.get();
113 } 86 }
114 87
115 TestScheduler::TestScheduler( 88 TestScheduler::TestScheduler(
116 base::SimpleTestTickClock* now_src, 89 base::SimpleTestTickClock* now_src,
117 SchedulerClient* client, 90 SchedulerClient* client,
118 const SchedulerSettings& scheduler_settings, 91 const SchedulerSettings& scheduler_settings,
119 int layer_tree_host_id, 92 int layer_tree_host_id,
120 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner, 93 const scoped_refptr<OrderedSimpleTaskRunner>& task_runner,
121 TestSchedulerFrameSourcesConstructor* frame_sources_constructor, 94 BeginFrameSource* external_frame_source,
122 scoped_ptr<BeginFrameSource> external_begin_frame_source) 95 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source,
96 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source)
123 : Scheduler(client, 97 : Scheduler(client,
124 scheduler_settings, 98 scheduler_settings,
125 layer_tree_host_id, 99 layer_tree_host_id,
126 test_task_runner, 100 task_runner,
127 external_begin_frame_source.Pass(), 101 external_frame_source,
128 frame_sources_constructor), 102 synthetic_frame_source.Pass(),
103 unthrottled_frame_source.Pass()),
129 now_src_(now_src) { 104 now_src_(now_src) {
130 } 105 }
131 106
132 base::TimeTicks TestScheduler::Now() const { 107 base::TimeTicks TestScheduler::Now() const {
133 return now_src_->NowTicks(); 108 return now_src_->NowTicks();
134 } 109 }
135 110
136 TestScheduler::~TestScheduler() { 111 TestScheduler::~TestScheduler() {
137 } 112 }
138 113
139 } // namespace cc 114 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/trees/single_thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698