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

Side by Side Diff: cc/scheduler/scheduler_state_machine_unittest.cc

Issue 2659123004: cc: Add scheduler support for invalidating content on impl thread. (Closed)
Patch Set: addressed comments. Created 3 years, 10 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
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 #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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 sm->WillBeginCompositorFrameSinkCreation(); 193 sm->WillBeginCompositorFrameSinkCreation();
194 return; 194 return;
195 195
196 case SchedulerStateMachine::ACTION_PREPARE_TILES: 196 case SchedulerStateMachine::ACTION_PREPARE_TILES:
197 sm->WillPrepareTiles(); 197 sm->WillPrepareTiles();
198 return; 198 return;
199 199
200 case SchedulerStateMachine::ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK: 200 case SchedulerStateMachine::ACTION_INVALIDATE_COMPOSITOR_FRAME_SINK:
201 sm->WillInvalidateCompositorFrameSink(); 201 sm->WillInvalidateCompositorFrameSink();
202 return; 202 return;
203
204 case SchedulerStateMachine::ACTION_RUN_IMPL_SIDE_INVALIDATION:
205 sm->WillRunImplSideInvalidation();
206 return;
203 } 207 }
204 } 208 }
205 209
206 TEST(SchedulerStateMachineTest, BeginFrameNeeded) { 210 TEST(SchedulerStateMachineTest, BeginFrameNeeded) {
207 SchedulerSettings default_scheduler_settings; 211 SchedulerSettings default_scheduler_settings;
208 StateMachine state(default_scheduler_settings); 212 StateMachine state(default_scheduler_settings);
209 state.SetVisible(true); 213 state.SetVisible(true);
210 EXPECT_ACTION_UPDATE_STATE( 214 EXPECT_ACTION_UPDATE_STATE(
211 SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); 215 SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION);
212 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 216 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 // to release the CompositorFrameSink. 2120 // to release the CompositorFrameSink.
2117 state.NotifyBeginMainFrameStarted(); 2121 state.NotifyBeginMainFrameStarted();
2118 state.BeginMainFrameAborted( 2122 state.BeginMainFrameAborted(
2119 CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST); 2123 CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST);
2120 2124
2121 // The scheduler should begin the CompositorFrameSink creation now. 2125 // The scheduler should begin the CompositorFrameSink creation now.
2122 EXPECT_ACTION_UPDATE_STATE( 2126 EXPECT_ACTION_UPDATE_STATE(
2123 SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION); 2127 SchedulerStateMachine::ACTION_BEGIN_COMPOSITOR_FRAME_SINK_CREATION);
2124 } 2128 }
2125 2129
2130 TEST(SchedulerStateMachineTest, ImplSideInvalidations) {
2131 SchedulerSettings settings;
2132 StateMachine state(settings);
2133 SET_UP_STATE(state);
2134
2135 // Set up request for the main frame and commit to create a pending tree.
2136 state.SetNeedsBeginMainFrame();
2137 state.OnBeginImplFrame();
2138 state.OnBeginImplFrame();
2139 EXPECT_ACTION_UPDATE_STATE(
2140 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
2141 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
2142
2143 state.NotifyBeginMainFrameStarted();
2144 state.NotifyReadyToCommit();
2145 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_COMMIT);
2146 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
2147
2148 // Request an impl-side invalidation after the commit. The request should wait
2149 // till the current pending tree is activated.
2150 state.SetNeedsImplSideInvalidation();
2151 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
2152
2153 // Activate the pending tree.
2154 state.NotifyReadyToActivate();
2155 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE);
2156
2157 // Since there is no main frame request, activating the pending tree should
2158 // run impl-side invalidations.
2159 EXPECT_ACTION_UPDATE_STATE(
2160 SchedulerStateMachine::ACTION_RUN_IMPL_SIDE_INVALIDATION);
2161
2162 // Request a main frame, followed by another impl-side invalidation request.
2163 }
2164
2126 } // namespace 2165 } // namespace
2127 } // namespace cc 2166 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698