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

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

Issue 792803008: cc: Split out BeginFrame needed verse proactive for commits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/scheduler/scheduler.h" 8 #include "cc/scheduler/scheduler.h"
9 #include "cc/test/begin_frame_args_test.h" 9 #include "cc/test/begin_frame_args_test.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 EXPECT_FALSE(state.BeginFrameNeeded()); 163 EXPECT_FALSE(state.BeginFrameNeeded());
164 164
165 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 165 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
166 EXPECT_FALSE(state.BeginFrameNeeded()); 166 EXPECT_FALSE(state.BeginFrameNeeded());
167 state.OnBeginImplFrame( 167 state.OnBeginImplFrame(
168 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); 168 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
169 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); 169 EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
170 state.OnBeginImplFrameDeadline(); 170 state.OnBeginImplFrameDeadline();
171 } 171 }
172 172
173 // If commit requested but can_draw is false, begin a main frame.
174 {
175 SchedulerSettings scheduler_settings;
176 // This only happens when proactive begin frames are false.
177 scheduler_settings.using_synchronous_renderer_compositor = true;
178 StateMachine state(scheduler_settings);
179 state.SetCanStart();
180 state.SetNeedsRedraw(false);
181 state.SetVisible(true);
182 state.SetNeedsCommit();
183 state.SetCanDraw(false);
184
185 EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION);
186 state.UpdateState(state.NextAction());
187 state.DidCreateAndInitializeOutputSurface();
188
189 // Expect nothing to happen until the IMPL frame comes in.
190 EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE);
191 EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
192 EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE);
193
194 // Despite not being able to draw, we do need a BeginImplFrame.
195 EXPECT_TRUE(state.BeginFrameNeeded());
196
197 state.OnBeginImplFrame(
198 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
199 EXPECT_ACTION_UPDATE_STATE(
200 SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
201 }
202
173 // If commit requested, begin a main frame. 203 // If commit requested, begin a main frame.
174 { 204 {
175 StateMachine state(default_scheduler_settings); 205 StateMachine state(default_scheduler_settings);
176 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); 206 state.SetCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE);
177 state.SetCanStart(); 207 state.SetCanStart();
178 state.UpdateState(state.NextAction()); 208 state.UpdateState(state.NextAction());
179 state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); 209 state.CreateAndInitializeOutputSurfaceWithActivatedCommit();
180 state.SetNeedsRedraw(false); 210 state.SetNeedsRedraw(false);
181 state.SetVisible(true); 211 state.SetVisible(true);
182 state.SetNeedsCommit(); 212 state.SetNeedsCommit();
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1924 state.SetVisible(true); 1954 state.SetVisible(true);
1925 state.SetCanDraw(true); 1955 state.SetCanDraw(true);
1926 1956
1927 EXPECT_FALSE(state.BeginFrameNeeded()); 1957 EXPECT_FALSE(state.BeginFrameNeeded());
1928 state.SetChildrenNeedBeginFrames(true); 1958 state.SetChildrenNeedBeginFrames(true);
1929 EXPECT_TRUE(state.BeginFrameNeeded()); 1959 EXPECT_TRUE(state.BeginFrameNeeded());
1930 } 1960 }
1931 1961
1932 } // namespace 1962 } // namespace
1933 } // namespace cc 1963 } // namespace cc
OLDNEW
« cc/scheduler/scheduler_state_machine.cc ('K') | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698