| 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 3165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3176 | 3176 |
| 3177 // Abort the commit. | 3177 // Abort the commit. |
| 3178 client_->Reset(); | 3178 client_->Reset(); |
| 3179 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks::Now()); | 3179 scheduler_->NotifyBeginMainFrameStarted(base::TimeTicks::Now()); |
| 3180 scheduler_->BeginMainFrameAborted( | 3180 scheduler_->BeginMainFrameAborted( |
| 3181 CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST); | 3181 CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST); |
| 3182 EXPECT_SINGLE_ACTION("ScheduledActionBeginCompositorFrameSinkCreation", | 3182 EXPECT_SINGLE_ACTION("ScheduledActionBeginCompositorFrameSinkCreation", |
| 3183 client_); | 3183 client_); |
| 3184 } | 3184 } |
| 3185 | 3185 |
| 3186 TEST_F(SchedulerTest, CompositorFrameSinkCreationWhileCommitPending) { | |
| 3187 scheduler_settings_.abort_commit_before_compositor_frame_sink_creation = | |
| 3188 false; | |
| 3189 SetUpScheduler(THROTTLED_BFS); | |
| 3190 | |
| 3191 // SetNeedsBeginMainFrame should begin the frame. | |
| 3192 scheduler_->SetNeedsBeginMainFrame(); | |
| 3193 client_->Reset(); | |
| 3194 EXPECT_SCOPED(AdvanceFrame()); | |
| 3195 EXPECT_ACTION("WillBeginImplFrame", client_, 0, 2); | |
| 3196 EXPECT_ACTION("ScheduledActionSendBeginMainFrame", client_, 1, 2); | |
| 3197 | |
| 3198 // Lose the CompositorFrameSink and trigger the deadline. | |
| 3199 client_->Reset(); | |
| 3200 scheduler_->DidLoseCompositorFrameSink(); | |
| 3201 EXPECT_TRUE(client_->IsInsideBeginImplFrame()); | |
| 3202 EXPECT_NO_ACTION(client_); | |
| 3203 | |
| 3204 // The scheduler should trigger the CompositorFrameSink creation immediately | |
| 3205 // after | |
| 3206 // the begin_impl_frame_state_ is cleared. | |
| 3207 task_runner_->RunTasksWhile(client_->InsideBeginImplFrame(true)); | |
| 3208 EXPECT_FALSE(client_->IsInsideBeginImplFrame()); | |
| 3209 EXPECT_ACTION("ScheduledActionBeginCompositorFrameSinkCreation", client_, 0, | |
| 3210 2); | |
| 3211 EXPECT_ACTION("SendBeginMainFrameNotExpectedSoon", client_, 1, 2); | |
| 3212 } | |
| 3213 | |
| 3214 // The three letters appeneded to each version of this test mean the following:s | 3186 // The three letters appeneded to each version of this test mean the following:s |
| 3215 // tree_priority: B = both trees same priority; A = active tree priority; | 3187 // tree_priority: B = both trees same priority; A = active tree priority; |
| 3216 // scroll_handler_state: H = affects scroll handler; N = does not affect scroll | 3188 // scroll_handler_state: H = affects scroll handler; N = does not affect scroll |
| 3217 // handler; | 3189 // handler; |
| 3218 // durations: F = fast durations; S = slow durations | 3190 // durations: F = fast durations; S = slow durations |
| 3219 bool SchedulerTest::BeginMainFrameOnCriticalPath( | 3191 bool SchedulerTest::BeginMainFrameOnCriticalPath( |
| 3220 TreePriority tree_priority, | 3192 TreePriority tree_priority, |
| 3221 ScrollHandlerState scroll_handler_state, | 3193 ScrollHandlerState scroll_handler_state, |
| 3222 base::TimeDelta durations) { | 3194 base::TimeDelta durations) { |
| 3223 SetUpScheduler(EXTERNAL_BFS); | 3195 SetUpScheduler(EXTERNAL_BFS); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3279 } | 3251 } |
| 3280 | 3252 |
| 3281 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { | 3253 TEST_F(SchedulerTest, BeginMainFrameOnCriticalPath_AHS) { |
| 3282 EXPECT_FALSE(BeginMainFrameOnCriticalPath( | 3254 EXPECT_FALSE(BeginMainFrameOnCriticalPath( |
| 3283 SMOOTHNESS_TAKES_PRIORITY, | 3255 SMOOTHNESS_TAKES_PRIORITY, |
| 3284 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); | 3256 ScrollHandlerState::SCROLL_AFFECTS_SCROLL_HANDLER, kSlowDuration)); |
| 3285 } | 3257 } |
| 3286 | 3258 |
| 3287 } // namespace | 3259 } // namespace |
| 3288 } // namespace cc | 3260 } // namespace cc |
| OLD | NEW |