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

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

Issue 1425973003: cc: Don't attempt main thread synchronization if it is slow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase; change names; use enum class Created 5 years, 1 month 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/scheduler/scheduler_unittest.cc ('k') | cc/test/scheduler_test_common.cc » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 #ifndef CC_TEST_SCHEDULER_TEST_COMMON_H_ 5 #ifndef CC_TEST_SCHEDULER_TEST_COMMON_H_
6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_ 6 #define CC_TEST_SCHEDULER_TEST_COMMON_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 }; 162 };
163 163
164 class FakeCompositorTimingHistory : public CompositorTimingHistory { 164 class FakeCompositorTimingHistory : public CompositorTimingHistory {
165 public: 165 public:
166 static scoped_ptr<FakeCompositorTimingHistory> Create(); 166 static scoped_ptr<FakeCompositorTimingHistory> Create();
167 ~FakeCompositorTimingHistory() override; 167 ~FakeCompositorTimingHistory() override;
168 168
169 void SetAllEstimatesTo(base::TimeDelta duration); 169 void SetAllEstimatesTo(base::TimeDelta duration);
170 170
171 void SetBeginMainFrameToCommitDurationEstimate(base::TimeDelta duration); 171 void SetBeginMainFrameToCommitDurationEstimate(base::TimeDelta duration);
172 void SetBeginMainFrameQueueDurationCriticalEstimate(base::TimeDelta duration);
173 void SetBeginMainFrameQueueDurationNotCriticalEstimate(
174 base::TimeDelta duration);
175 void SetBeginMainFrameStartToCommitDurationEstimate(base::TimeDelta duration);
172 void SetCommitToReadyToActivateDurationEstimate(base::TimeDelta duration); 176 void SetCommitToReadyToActivateDurationEstimate(base::TimeDelta duration);
173 void SetPrepareTilesDurationEstimate(base::TimeDelta duration); 177 void SetPrepareTilesDurationEstimate(base::TimeDelta duration);
174 void SetActivateDurationEstimate(base::TimeDelta duration); 178 void SetActivateDurationEstimate(base::TimeDelta duration);
175 void SetDrawDurationEstimate(base::TimeDelta duration); 179 void SetDrawDurationEstimate(base::TimeDelta duration);
176 180
177 base::TimeDelta BeginMainFrameToCommitDurationEstimate() const override; 181 base::TimeDelta BeginMainFrameToCommitDurationEstimate() const override;
182 base::TimeDelta BeginMainFrameQueueDurationCriticalEstimate() const override;
183 base::TimeDelta BeginMainFrameQueueDurationNotCriticalEstimate()
184 const override;
185 base::TimeDelta BeginMainFrameStartToCommitDurationEstimate() const override;
178 base::TimeDelta CommitToReadyToActivateDurationEstimate() const override; 186 base::TimeDelta CommitToReadyToActivateDurationEstimate() const override;
179 base::TimeDelta PrepareTilesDurationEstimate() const override; 187 base::TimeDelta PrepareTilesDurationEstimate() const override;
180 base::TimeDelta ActivateDurationEstimate() const override; 188 base::TimeDelta ActivateDurationEstimate() const override;
181 base::TimeDelta DrawDurationEstimate() const override; 189 base::TimeDelta DrawDurationEstimate() const override;
182 190
183 protected: 191 protected:
184 FakeCompositorTimingHistory(scoped_ptr<RenderingStatsInstrumentation> 192 FakeCompositorTimingHistory(scoped_ptr<RenderingStatsInstrumentation>
185 rendering_stats_instrumentation_owned); 193 rendering_stats_instrumentation_owned);
186 194
187 scoped_ptr<RenderingStatsInstrumentation> 195 scoped_ptr<RenderingStatsInstrumentation>
188 rendering_stats_instrumentation_owned_; 196 rendering_stats_instrumentation_owned_;
189 197
190 base::TimeDelta begin_main_frame_to_commit_duration_; 198 base::TimeDelta begin_main_frame_to_commit_duration_;
199 base::TimeDelta begin_main_frame_queue_duration_critical_;
200 base::TimeDelta begin_main_frame_queue_duration_not_critical_;
201 base::TimeDelta begin_main_frame_start_to_commit_duration_;
191 base::TimeDelta commit_to_ready_to_activate_duration_; 202 base::TimeDelta commit_to_ready_to_activate_duration_;
192 base::TimeDelta prepare_tiles_duration_; 203 base::TimeDelta prepare_tiles_duration_;
193 base::TimeDelta activate_duration_; 204 base::TimeDelta activate_duration_;
194 base::TimeDelta draw_duration_; 205 base::TimeDelta draw_duration_;
195 206
196 private: 207 private:
197 DISALLOW_COPY_AND_ASSIGN(FakeCompositorTimingHistory); 208 DISALLOW_COPY_AND_ASSIGN(FakeCompositorTimingHistory);
198 }; 209 };
199 210
200 class TestScheduler : public Scheduler { 211 class TestScheduler : public Scheduler {
(...skipping 24 matching lines...) Expand all
225 bool MainThreadMissedLastDeadline() const { 236 bool MainThreadMissedLastDeadline() const {
226 return state_machine_.main_thread_missed_last_deadline(); 237 return state_machine_.main_thread_missed_last_deadline();
227 } 238 }
228 239
229 ~TestScheduler() override; 240 ~TestScheduler() override;
230 241
231 base::TimeDelta BeginImplFrameInterval() { 242 base::TimeDelta BeginImplFrameInterval() {
232 return begin_impl_frame_tracker_.Interval(); 243 return begin_impl_frame_tracker_.Interval();
233 } 244 }
234 245
246 // Note: This setting will be overriden on the next BeginFrame in the
247 // scheduler. To control the value it gets on the next BeginFrame
248 // Pass in a fake CompositorTimingHistory that indicates BeginMainFrame
249 // to Activation is fast.
250 void SetCriticalBeginMainFrameToActivateIsFast(bool is_fast) {
251 state_machine_.SetCriticalBeginMainFrameToActivateIsFast(is_fast);
252 }
253
235 protected: 254 protected:
236 // Overridden from Scheduler. 255 // Overridden from Scheduler.
237 base::TimeTicks Now() const override; 256 base::TimeTicks Now() const override;
238 257
239 private: 258 private:
240 TestScheduler( 259 TestScheduler(
241 base::SimpleTestTickClock* now_src, 260 base::SimpleTestTickClock* now_src,
242 SchedulerClient* client, 261 SchedulerClient* client,
243 const SchedulerSettings& scheduler_settings, 262 const SchedulerSettings& scheduler_settings,
244 int layer_tree_host_id, 263 int layer_tree_host_id,
245 OrderedSimpleTaskRunner* task_runner, 264 OrderedSimpleTaskRunner* task_runner,
246 BeginFrameSource* external_frame_source, 265 BeginFrameSource* external_frame_source,
247 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source, 266 scoped_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source,
248 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source, 267 scoped_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source,
249 scoped_ptr<CompositorTimingHistory> compositor_timing_history); 268 scoped_ptr<CompositorTimingHistory> compositor_timing_history);
250 269
251 base::SimpleTestTickClock* now_src_; 270 base::SimpleTestTickClock* now_src_;
252 271
253 DISALLOW_COPY_AND_ASSIGN(TestScheduler); 272 DISALLOW_COPY_AND_ASSIGN(TestScheduler);
254 }; 273 };
255 274
256 } // namespace cc 275 } // namespace cc
257 276
258 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_ 277 #endif // CC_TEST_SCHEDULER_TEST_COMMON_H_
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_unittest.cc ('k') | cc/test/scheduler_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698