| OLD | NEW |
| 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 #include "cc/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 ~SchedulerTest() override {} | 243 ~SchedulerTest() override {} |
| 244 | 244 |
| 245 protected: | 245 protected: |
| 246 TestScheduler* CreateScheduler() { | 246 TestScheduler* CreateScheduler() { |
| 247 BeginFrameSource* frame_source; | 247 BeginFrameSource* frame_source; |
| 248 unthrottled_frame_source_.reset( | 248 unthrottled_frame_source_.reset( |
| 249 new TestBackToBackBeginFrameSource(now_src_.get(), task_runner_.get())); | 249 new TestBackToBackBeginFrameSource(now_src_.get(), task_runner_.get())); |
| 250 fake_external_begin_frame_source_.reset( | 250 fake_external_begin_frame_source_.reset( |
| 251 new FakeExternalBeginFrameSource(client_.get())); | 251 new FakeExternalBeginFrameSource(client_.get())); |
| 252 synthetic_frame_source_.reset(new TestSyntheticBeginFrameSource( | 252 synthetic_frame_source_.reset(new SyntheticBeginFrameSource( |
| 253 now_src_.get(), task_runner_.get(), BeginFrameArgs::DefaultInterval())); | 253 base::MakeUnique<TestDelayBasedTimeSource>(now_src_.get(), |
| 254 task_runner_.get()))); |
| 254 if (!scheduler_settings_.throttle_frame_production) { | 255 if (!scheduler_settings_.throttle_frame_production) { |
| 255 frame_source = unthrottled_frame_source_.get(); | 256 frame_source = unthrottled_frame_source_.get(); |
| 256 } else if (scheduler_settings_.use_external_begin_frame_source) { | 257 } else if (scheduler_settings_.use_external_begin_frame_source) { |
| 257 frame_source = fake_external_begin_frame_source_.get(); | 258 frame_source = fake_external_begin_frame_source_.get(); |
| 258 } else { | 259 } else { |
| 259 frame_source = synthetic_frame_source_.get(); | 260 frame_source = synthetic_frame_source_.get(); |
| 260 } | 261 } |
| 261 | 262 |
| 262 std::unique_ptr<FakeCompositorTimingHistory> | 263 std::unique_ptr<FakeCompositorTimingHistory> |
| 263 fake_compositor_timing_history = FakeCompositorTimingHistory::Create( | 264 fake_compositor_timing_history = FakeCompositorTimingHistory::Create( |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 bool use_external_begin_frame_source, | 423 bool use_external_begin_frame_source, |
| 423 bool throttle_frame_production); | 424 bool throttle_frame_production); |
| 424 bool BeginMainFrameOnCriticalPath(TreePriority tree_priority, | 425 bool BeginMainFrameOnCriticalPath(TreePriority tree_priority, |
| 425 ScrollHandlerState scroll_handler_state, | 426 ScrollHandlerState scroll_handler_state, |
| 426 base::TimeDelta durations); | 427 base::TimeDelta durations); |
| 427 | 428 |
| 428 std::unique_ptr<base::SimpleTestTickClock> now_src_; | 429 std::unique_ptr<base::SimpleTestTickClock> now_src_; |
| 429 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; | 430 scoped_refptr<OrderedSimpleTaskRunner> task_runner_; |
| 430 std::unique_ptr<FakeExternalBeginFrameSource> | 431 std::unique_ptr<FakeExternalBeginFrameSource> |
| 431 fake_external_begin_frame_source_; | 432 fake_external_begin_frame_source_; |
| 432 std::unique_ptr<TestSyntheticBeginFrameSource> synthetic_frame_source_; | 433 std::unique_ptr<SyntheticBeginFrameSource> synthetic_frame_source_; |
| 433 std::unique_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source_; | 434 std::unique_ptr<TestBackToBackBeginFrameSource> unthrottled_frame_source_; |
| 434 SchedulerSettings scheduler_settings_; | 435 SchedulerSettings scheduler_settings_; |
| 435 std::unique_ptr<FakeSchedulerClient> client_; | 436 std::unique_ptr<FakeSchedulerClient> client_; |
| 436 std::unique_ptr<TestScheduler> scheduler_; | 437 std::unique_ptr<TestScheduler> scheduler_; |
| 437 FakeCompositorTimingHistory* fake_compositor_timing_history_; | 438 FakeCompositorTimingHistory* fake_compositor_timing_history_; |
| 438 }; | 439 }; |
| 439 | 440 |
| 440 TEST_F(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { | 441 TEST_F(SchedulerTest, InitializeOutputSurfaceDoesNotBeginImplFrame) { |
| 441 scheduler_settings_.use_external_begin_frame_source = true; | 442 scheduler_settings_.use_external_begin_frame_source = true; |
| 442 SetUpScheduler(false); | 443 SetUpScheduler(false); |
| (...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3695 } | 3696 } |
| 3696 | 3697 |
| 3697 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { | 3698 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { |
| 3698 EXPECT_FALSE(BeginMainFrameOnCriticalPath( | 3699 EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
| 3699 SMOOTHNESS_TAKES_PRIORITY, | 3700 SMOOTHNESS_TAKES_PRIORITY, |
| 3700 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); | 3701 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); |
| 3701 } | 3702 } |
| 3702 | 3703 |
| 3703 } // namespace | 3704 } // namespace |
| 3704 } // namespace cc | 3705 } // namespace cc |
| OLD | NEW |