| 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_state_machine.h" | 5 #include "cc/scheduler/scheduler_state_machine.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/scheduler/scheduler.h" | 10 #include "cc/scheduler/scheduler.h" |
| (...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2116 // to release the CompositorFrameSink. | 2116 // to release the CompositorFrameSink. |
| 2117 state.NotifyBeginMainFrameStarted(); | 2117 state.NotifyBeginMainFrameStarted(); |
| 2118 state.BeginMainFrameAborted( | 2118 state.BeginMainFrameAborted( |
| 2119 CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST); | 2119 CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST); |
| 2120 | 2120 |
| 2121 // The scheduler should begin the CompositorFrameSink creation now. | 2121 // The scheduler should begin the CompositorFrameSink creation now. |
| 2122 EXPECT_ACTION_UPDATE_STATE( | 2122 EXPECT_ACTION_UPDATE_STATE( |
| 2123 SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); | 2123 SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); |
| 2124 } | 2124 } |
| 2125 | 2125 |
| 2126 TEST(SchedulerStateMachineTest, CompositorFrameSinkCreationWhileCommitPending) { | |
| 2127 SchedulerSettings settings; | |
| 2128 settings.abort_commit_before_compositor_frame_sink_creation = false; | |
| 2129 StateMachine state(settings); | |
| 2130 SET_UP_STATE(state); | |
| 2131 | |
| 2132 // Set up the request for a commit and start a frame. | |
| 2133 state.SetNeedsBeginMainFrame(); | |
| 2134 state.OnBeginImplFrame(); | |
| 2135 PerformAction(&state, SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); | |
| 2136 | |
| 2137 // Lose the CompositorFrameSink. | |
| 2138 state.DidLoseCompositorFrameSink(); | |
| 2139 | |
| 2140 // The scheduler shouldn't trigger the CompositorFrameSink creation till the | |
| 2141 // previous begin impl frame state is cleared from the pipeline. | |
| 2142 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); | |
| 2143 | |
| 2144 // Cycle through the frame stages to clear the scheduler state. | |
| 2145 state.OnBeginImplFrameDeadline(); | |
| 2146 state.OnBeginImplFrameIdle(); | |
| 2147 | |
| 2148 // The scheduler should begin the CompositorFrameSink creation now. | |
| 2149 EXPECT_ACTION_UPDATE_STATE( | |
| 2150 SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); | |
| 2151 } | |
| 2152 | |
| 2153 } // namespace | 2126 } // namespace |
| 2154 } // namespace cc | 2127 } // namespace cc |
| OLD | NEW |