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

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

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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/layer_tree_host.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 OrderedSimpleTaskRunner* test_task_runner, 67 OrderedSimpleTaskRunner* test_task_runner,
68 TestNowSource* now_src) 68 TestNowSource* now_src)
69 : test_task_runner_(test_task_runner), now_src_(now_src) { 69 : test_task_runner_(test_task_runner), now_src_(now_src) {
70 } 70 }
71 TestSchedulerFrameSourcesConstructor::~TestSchedulerFrameSourcesConstructor() { 71 TestSchedulerFrameSourcesConstructor::~TestSchedulerFrameSourcesConstructor() {
72 } 72 }
73 73
74 BeginFrameSource* 74 BeginFrameSource*
75 TestSchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( 75 TestSchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource(
76 Scheduler* scheduler) { 76 Scheduler* scheduler) {
77 if (!scheduler->settings_.throttle_frame_production) { 77 if (scheduler->settings_.use_external_begin_frame_source) {
78 TRACE_EVENT1(
79 "cc",
80 "TestSchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource",
81 "source",
82 "TestBackToBackBeginFrameSource");
83 DCHECK(!scheduler->primary_frame_source_internal_);
84 scheduler->primary_frame_source_internal_ =
85 TestBackToBackBeginFrameSource::Create(now_src_, test_task_runner_);
86 return scheduler->primary_frame_source_internal_.get();
87 } else if (scheduler->settings_.use_external_begin_frame_source) {
88 return SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource( 78 return SchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource(
89 scheduler); 79 scheduler);
90 } else { 80 } else {
91 TRACE_EVENT1( 81 TRACE_EVENT1(
92 "cc", 82 "cc",
93 "TestSchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource", 83 "TestSchedulerFrameSourcesConstructor::ConstructPrimaryFrameSource",
94 "source", 84 "source",
95 "TestSyntheticBeginFrameSource"); 85 "TestSyntheticBeginFrameSource");
96 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_source = 86 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_source =
97 TestSyntheticBeginFrameSource::Create( 87 TestSyntheticBeginFrameSource::Create(
(...skipping 16 matching lines...) Expand all
114 "TestSchedulerFrameSourcesConstructor::ConstructBackgroundFrameSource", 104 "TestSchedulerFrameSourcesConstructor::ConstructBackgroundFrameSource",
115 "source", 105 "source",
116 "TestSyntheticBeginFrameSource"); 106 "TestSyntheticBeginFrameSource");
117 DCHECK(!(scheduler->background_frame_source_internal_)); 107 DCHECK(!(scheduler->background_frame_source_internal_));
118 scheduler->background_frame_source_internal_ = 108 scheduler->background_frame_source_internal_ =
119 TestSyntheticBeginFrameSource::Create( 109 TestSyntheticBeginFrameSource::Create(
120 now_src_, test_task_runner_, base::TimeDelta::FromSeconds(1)); 110 now_src_, test_task_runner_, base::TimeDelta::FromSeconds(1));
121 return scheduler->background_frame_source_internal_.get(); 111 return scheduler->background_frame_source_internal_.get();
122 } 112 }
123 113
114 BeginFrameSource*
115 TestSchedulerFrameSourcesConstructor::ConstructUnthrottledFrameSource(
116 Scheduler* scheduler) {
117 TRACE_EVENT1(
118 "cc",
119 "TestSchedulerFrameSourcesConstructor::ConstructUnthrottledFrameSource",
120 "source", "TestBackToBackBeginFrameSource");
121 DCHECK(!scheduler->unthrottled_frame_source_internal_);
122 scheduler->unthrottled_frame_source_internal_ =
123 TestBackToBackBeginFrameSource::Create(now_src_, test_task_runner_);
124 return scheduler->unthrottled_frame_source_internal_.get();
125 }
126
124 TestScheduler::TestScheduler( 127 TestScheduler::TestScheduler(
125 scoped_refptr<TestNowSource> now_src, 128 scoped_refptr<TestNowSource> now_src,
126 SchedulerClient* client, 129 SchedulerClient* client,
127 const SchedulerSettings& scheduler_settings, 130 const SchedulerSettings& scheduler_settings,
128 int layer_tree_host_id, 131 int layer_tree_host_id,
129 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner, 132 const scoped_refptr<OrderedSimpleTaskRunner>& test_task_runner,
130 base::PowerMonitor* power_monitor, 133 base::PowerMonitor* power_monitor,
131 TestSchedulerFrameSourcesConstructor* frame_sources_constructor, 134 TestSchedulerFrameSourcesConstructor* frame_sources_constructor,
132 scoped_ptr<BeginFrameSource> external_begin_frame_source) 135 scoped_ptr<BeginFrameSource> external_begin_frame_source)
133 : Scheduler(client, 136 : Scheduler(client,
134 scheduler_settings, 137 scheduler_settings,
135 layer_tree_host_id, 138 layer_tree_host_id,
136 test_task_runner, 139 test_task_runner,
137 power_monitor, 140 power_monitor,
138 external_begin_frame_source.Pass(), 141 external_begin_frame_source.Pass(),
139 frame_sources_constructor), 142 frame_sources_constructor),
140 now_src_(now_src) { 143 now_src_(now_src) {
141 } 144 }
142 145
143 base::TimeTicks TestScheduler::Now() const { 146 base::TimeTicks TestScheduler::Now() const {
144 return now_src_->Now(); 147 return now_src_->Now();
145 } 148 }
146 149
147 TestScheduler::~TestScheduler() { 150 TestScheduler::~TestScheduler() {
148 } 151 }
149 152
150 } // namespace cc 153 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/scheduler_test_common.h ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698