From bd2c8968d05dacc4f159682e36f33e4aa487bdf1 Mon Sep 17 00:00:00 2001 From: sunnyps Date: Thu, 19 Mar 2015 17:13:12 -0700 Subject: [PATCH] cc: Do not pass BeginFrameArgs to state machine. The scheduler state machine should not rely on BeginFrameArgs for any decision. The state machine is the "digital" part of the system while the scheduler is the "analog" part of the system. BUG=439275 Review URL: https://codereview.chromium.org/1020993002 Cr-Commit-Position: refs/heads/master@{#321476} --- cc/scheduler/scheduler.cc | 21 +++- cc/scheduler/scheduler_state_machine.cc | 34 +----- cc/scheduler/scheduler_state_machine.h | 8 +- cc/scheduler/scheduler_state_machine_unittest.cc | 128 +++++++++++------------ 4 files changed, 87 insertions(+), 104 deletions(-) diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc index d4c549849d0a..4224ba07d0b7 100644 --- a/cc/scheduler/scheduler.cc +++ b/cc/scheduler/scheduler.cc @@ -534,7 +534,7 @@ void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { state_machine_.SetSkipNextBeginMainFrameToReduceLatency(); } - state_machine_.OnBeginImplFrame(begin_impl_frame_args_); + state_machine_.OnBeginImplFrame(); devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); client_->WillBeginImplFrame(begin_impl_frame_args_); @@ -803,7 +803,7 @@ scoped_refptr Scheduler::AsValue() void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const { state->BeginDictionary("state_machine"); - state_machine_.AsValueInto(state, Now()); + state_machine_.AsValueInto(state); state->EndDictionary(); // Only trace frame sources when explicitly enabled - http://crbug.com/420607 @@ -837,6 +837,23 @@ void Scheduler::AsValueInto(base::trace_event::TracedValue* state) const { begin_impl_frame_args_.AsValueInto(state); state->EndDictionary(); + base::TimeTicks now = Now(); + base::TimeTicks frame_time = begin_impl_frame_args_.frame_time; + base::TimeTicks deadline = begin_impl_frame_args_.deadline; + base::TimeDelta interval = begin_impl_frame_args_.interval; + state->BeginDictionary("major_timestamps_in_ms"); + state->SetDouble("0_interval", interval.InMillisecondsF()); + state->SetDouble("1_now_to_deadline", (deadline - now).InMillisecondsF()); + state->SetDouble("2_frame_time_to_now", (now - frame_time).InMillisecondsF()); + state->SetDouble("3_frame_time_to_deadline", + (deadline - frame_time).InMillisecondsF()); + state->SetDouble("4_now", (now - base::TimeTicks()).InMillisecondsF()); + state->SetDouble("5_frame_time", + (frame_time - base::TimeTicks()).InMillisecondsF()); + state->SetDouble("6_deadline", + (deadline - base::TimeTicks()).InMillisecondsF()); + state->EndDictionary(); + state->EndDictionary(); state->BeginDictionary("client_state"); diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc index 5b5b386adb50..f6b438f4af21 100644 --- a/cc/scheduler/scheduler_state_machine.cc +++ b/cc/scheduler/scheduler_state_machine.cc @@ -151,12 +151,12 @@ scoped_refptr SchedulerStateMachine::AsValue() const { scoped_refptr state = new base::trace_event::TracedValue(); - AsValueInto(state.get(), gfx::FrameTime::Now()); + AsValueInto(state.get()); return state; } -void SchedulerStateMachine::AsValueInto(base::trace_event::TracedValue* state, - base::TimeTicks now) const { +void SchedulerStateMachine::AsValueInto( + base::trace_event::TracedValue* state) const { state->BeginDictionary("major_state"); state->SetString("next_action", ActionToString(NextAction())); state->SetString("begin_impl_frame_state", @@ -168,31 +168,6 @@ void SchedulerStateMachine::AsValueInto(base::trace_event::TracedValue* state, ForcedRedrawOnTimeoutStateToString(forced_redraw_state_)); state->EndDictionary(); - state->BeginDictionary("major_timestamps_in_ms"); - state->SetDouble("0_interval", - begin_impl_frame_args_.interval.InMicroseconds() / 1000.0L); - state->SetDouble( - "1_now_to_deadline", - (begin_impl_frame_args_.deadline - now).InMicroseconds() / 1000.0L); - state->SetDouble( - "2_frame_time_to_now", - (now - begin_impl_frame_args_.frame_time).InMicroseconds() / 1000.0L); - state->SetDouble("3_frame_time_to_deadline", - (begin_impl_frame_args_.deadline - - begin_impl_frame_args_.frame_time).InMicroseconds() / - 1000.0L); - state->SetDouble("4_now", - (now - base::TimeTicks()).InMicroseconds() / 1000.0L); - state->SetDouble( - "5_frame_time", - (begin_impl_frame_args_.frame_time - base::TimeTicks()).InMicroseconds() / - 1000.0L); - state->SetDouble( - "6_deadline", - (begin_impl_frame_args_.deadline - base::TimeTicks()).InMicroseconds() / - 1000.0L); - state->EndDictionary(); - state->BeginDictionary("minor_state"); state->SetInteger("commit_count", commit_count_); state->SetInteger("current_frame_number", current_frame_number_); @@ -798,9 +773,8 @@ bool SchedulerStateMachine::ProactiveBeginFrameWanted() const { return false; } -void SchedulerStateMachine::OnBeginImplFrame(const BeginFrameArgs& args) { +void SchedulerStateMachine::OnBeginImplFrame() { AdvanceCurrentFrameNumber(); - begin_impl_frame_args_ = args; DCHECK_EQ(begin_impl_frame_state_, BEGIN_IMPL_FRAME_STATE_IDLE) << AsValue()->ToString(); begin_impl_frame_state_ = BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING; diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h index 00802e1f3fc4..ee8075f57ab0 100644 --- a/cc/scheduler/scheduler_state_machine.h +++ b/cc/scheduler/scheduler_state_machine.h @@ -9,7 +9,6 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" -#include "base/time/time.h" #include "cc/base/cc_export.h" #include "cc/output/begin_frame_args.h" #include "cc/scheduler/commit_earlyout_reason.h" @@ -115,8 +114,7 @@ class CC_EXPORT SchedulerStateMachine { static const char* ActionToString(Action action); scoped_refptr AsValue() const; - void AsValueInto(base::trace_event::TracedValue* dict, - base::TimeTicks now) const; + void AsValueInto(base::trace_event::TracedValue* dict) const; Action NextAction() const; void UpdateState(Action action); @@ -134,7 +132,7 @@ class CC_EXPORT SchedulerStateMachine { // Indicates that the system has entered and left a BeginImplFrame callback. // The scheduler will not draw more than once in a given BeginImplFrame // callback nor send more than one BeginMainFrame message. - void OnBeginImplFrame(const BeginFrameArgs& args); + void OnBeginImplFrame(); void OnBeginImplFrameDeadlinePending(); void OnBeginImplFrameDeadline(); void OnBeginImplFrameIdle(); @@ -297,8 +295,6 @@ class CC_EXPORT SchedulerStateMachine { CommitState commit_state_; ForcedRedrawOnTimeoutState forced_redraw_state_; - BeginFrameArgs begin_impl_frame_args_; - int commit_count_; int current_frame_number_; int last_frame_number_animate_performed_; diff --git a/cc/scheduler/scheduler_state_machine_unittest.cc b/cc/scheduler/scheduler_state_machine_unittest.cc index 98d5b18cf9ff..0846fabb047f 100644 --- a/cc/scheduler/scheduler_state_machine_unittest.cc +++ b/cc/scheduler/scheduler_state_machine_unittest.cc @@ -152,8 +152,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) { EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); EXPECT_FALSE(state.BeginFrameNeeded()); - state.OnBeginImplFrame( - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); @@ -171,8 +170,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) { EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); EXPECT_FALSE(state.BeginFrameNeeded()); - state.OnBeginImplFrame( - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); } @@ -190,8 +188,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsMainFrameIfNeeded) { EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame( - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); } @@ -224,7 +221,7 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) { EXPECT_TRUE(state.BeginFrameNeeded()); // Commit to the pending tree. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -240,7 +237,7 @@ TEST(SchedulerStateMachineTest, MainFrameBeforeActivationEnabled) { // Verify that the next commit starts while there is still a pending tree. state.SetNeedsCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -277,7 +274,7 @@ TEST(SchedulerStateMachineTest, state.SetNeedsRedraw(true); EXPECT_TRUE(state.RedrawPending()); EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); @@ -294,7 +291,7 @@ TEST(SchedulerStateMachineTest, // Failing the draw makes us require a commit. state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -310,7 +307,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawForMissingHighResNeedsCommit) { EXPECT_TRUE(state.RedrawPending()); EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); @@ -324,7 +321,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawForMissingHighResNeedsCommit) { // Missing high res content requires a commit (but not a redraw) state.DidDrawIfPossibleCompleted(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_FALSE(state.RedrawPending()); @@ -339,7 +336,7 @@ TEST(SchedulerStateMachineTest, state.SetNeedsRedraw(true); EXPECT_TRUE(state.RedrawPending()); EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); @@ -360,7 +357,7 @@ TEST(SchedulerStateMachineTest, // Failing the draw for animation checkerboards makes us require a commit. state.DidDrawIfPossibleCompleted(DRAW_ABORTED_CHECKERBOARD_ANIMATIONS); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -377,7 +374,7 @@ TEST(SchedulerStateMachineTest, // Start a commit. state.SetNeedsCommit(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -407,7 +404,7 @@ TEST(SchedulerStateMachineTest, EXPECT_TRUE(state.RedrawPending()); // The redraw should be forced at the end of the next BeginImplFrame. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -431,7 +428,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawsDoNotRestartForcedDraw) { // Start a commit. state.SetNeedsCommit(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -484,7 +481,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedInNextBeginImplFrame) { // Start a draw. state.SetNeedsRedraw(true); EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); @@ -501,7 +498,7 @@ TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedInNextBeginImplFrame) { // We should not be trying to draw again now, but we have a commit pending. EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -523,7 +520,7 @@ TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) { // Draw the first frame. EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -542,7 +539,7 @@ TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) { // Move to another frame. This should now draw. EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -677,8 +674,7 @@ TEST(SchedulerStateMachineTest, TestCanRedraw_StopsDraw) { state.SetVisible(false); state.SetNeedsRedraw(true); if (j == 1) - state.OnBeginImplFrame( - CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); state.SetCanDraw(false); EXPECT_NE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE, @@ -700,7 +696,7 @@ TEST(SchedulerStateMachineTest, state.SetNeedsRedraw(true); state.SetVisible(true); state.SetCanDraw(false); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT); EXPECT_ACTION_UPDATE_STATE( @@ -724,7 +720,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) { EXPECT_TRUE(state.BeginFrameNeeded()); // Begin the frame. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_COMMIT_STATE( @@ -758,7 +754,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) { EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_IMPL_FRAME_STATE( SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING); EXPECT_ACTION(SchedulerStateMachine::ACTION_COMMIT); @@ -791,7 +787,7 @@ TEST(SchedulerStateMachineTest, TestFullCycle) { state.SetNeedsCommit(); // Begin the frame. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_COMMIT_STATE( @@ -837,7 +833,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithMainThreadLowLatencyMode) { state.SetNeedsCommit(); // Begin the frame. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_COMMIT_STATE( @@ -867,7 +863,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithMainThreadLowLatencyMode) { // Haven't draw since last commit, do not begin new main frame. state.SetNeedsCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -898,7 +894,7 @@ TEST(SchedulerStateMachineTest, state.SetNeedsCommit(); // Begin the frame. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_COMMIT_STATE( @@ -929,7 +925,7 @@ TEST(SchedulerStateMachineTest, EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Cannot BeginMainFrame yet since last commit is not yet activated and drawn. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_COMMIT_STATE( SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_ACTIVATION); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -950,7 +946,7 @@ TEST(SchedulerStateMachineTest, state.DidSwapBuffersComplete(); // Haven't draw since last commit, do not begin new main frame. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -978,7 +974,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) { state.SetNeedsCommit(); // Begin the frame. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_COMMIT_STATE( @@ -1018,7 +1014,7 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) { EXPECT_FALSE(state.needs_redraw()); // Next BeginImplFrame should initiate second commit. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); } @@ -1044,7 +1040,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) { state.SetNeedsCommit(); // Begin the frame while visible. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_COMMIT_STATE( @@ -1078,7 +1074,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseInvisible) { EXPECT_TRUE(state.NeedsCommit()); // Start a new frame. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -1100,7 +1096,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { // Get into a begin frame / commit state. state.SetNeedsCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_COMMIT_STATE( @@ -1129,7 +1125,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { EXPECT_FALSE(state.NeedsCommit()); EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -1137,7 +1133,7 @@ TEST(SchedulerStateMachineTest, TestAbortBeginMainFrameBecauseCommitNotNeeded) { // Verify another commit can start if requested, though. state.SetNeedsCommit(); EXPECT_COMMIT_STATE(SchedulerStateMachine::COMMIT_STATE_IDLE); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); } @@ -1154,14 +1150,14 @@ TEST(SchedulerStateMachineTest, TestFirstContextCreation) { EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Check that the first init does not SetNeedsCommit. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Check that a needs commit initiates a BeginMainFrame. state.SetNeedsCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); } @@ -1185,7 +1181,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) { state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); // When the context is recreated, we should begin a commit. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); } @@ -1209,14 +1205,14 @@ TEST(SchedulerStateMachineTest, EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // Once context recreation begins, nothing should happen. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // While context is recreating, commits shouldn't begin. state.SetNeedsCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -1232,7 +1228,7 @@ TEST(SchedulerStateMachineTest, EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); // When the BeginFrame comes in we should begin a commit - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -1258,7 +1254,7 @@ TEST(SchedulerStateMachineTest, // Finishing the first commit after initializing an output surface should // automatically cause a redraw. EXPECT_TRUE(state.RedrawPending()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); @@ -1268,7 +1264,7 @@ TEST(SchedulerStateMachineTest, EXPECT_FALSE(state.RedrawPending()); // Next frame as no work to do. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -1276,7 +1272,7 @@ TEST(SchedulerStateMachineTest, // Once the context is recreated, whether we draw should be based on // SetCanDraw if waiting on first draw after activate. state.SetNeedsRedraw(true); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); @@ -1292,7 +1288,7 @@ TEST(SchedulerStateMachineTest, // SetCanDraw if waiting on first draw after activate. state.SetNeedsRedraw(true); state.SetNeedsCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -1326,7 +1322,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) { // Set damage and expect a draw. state.SetNeedsRedraw(true); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -1359,7 +1355,7 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) { EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_IMPL_FRAME_STATE( SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING); EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); @@ -1387,7 +1383,7 @@ TEST(SchedulerStateMachineTest, // Set damage and expect a draw. state.SetNeedsRedraw(true); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -1420,7 +1416,7 @@ TEST(SchedulerStateMachineTest, EXPECT_IMPL_FRAME_STATE(SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); EXPECT_ACTION(SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_IMPL_FRAME_STATE( SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_BEGIN_FRAME_STARTING); EXPECT_ACTION(SchedulerStateMachine::ACTION_NONE); @@ -1441,7 +1437,7 @@ TEST(SchedulerStateMachineTest, // After we get a new output surface, the commit flow should start. state.CreateAndInitializeOutputSurfaceWithActivatedCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -1472,7 +1468,7 @@ TEST(SchedulerStateMachineTest, DontDrawBeforeCommitAfterLostOutputSurface) { state.DidCreateAndInitializeOutputSurface(); EXPECT_FALSE(state.RedrawPending()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION(SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); } @@ -1586,7 +1582,7 @@ TEST(SchedulerStateMachineTest, // This test mirrors what happens during the first frame of a scroll gesture. // First we get the input event and a BeginFrame. - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); // As a response the compositor requests a redraw and a commit to tell the // main thread about the new scroll offset. @@ -1621,7 +1617,7 @@ void FinishPreviousCommitAndDrawWithoutExitingDeadline( EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -1642,7 +1638,7 @@ TEST(SchedulerStateMachineTest, TestImplLatencyTakesPriority) { // in prefer impl latency mode. state.SetNeedsRedraw(true); state.SetNeedsCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -1679,7 +1675,7 @@ TEST(SchedulerStateMachineTest, TestImplLatencyTakesPriority) { // and did not just swap. state.SetNeedsCommit(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately()); state.OnBeginImplFrameDeadline(); @@ -1694,7 +1690,7 @@ TEST(SchedulerStateMachineTest, state.SetNeedsCommit(); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); @@ -1717,7 +1713,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsAnimate) { EXPECT_TRUE(state.BeginFrameNeeded()); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); state.OnBeginImplFrameDeadlinePending(); @@ -1739,7 +1735,7 @@ TEST(SchedulerStateMachineTest, TestAnimateBeforeCommit) { EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -1763,7 +1759,7 @@ TEST(SchedulerStateMachineTest, TestAnimateAfterCommitBeforeDraw) { EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); EXPECT_TRUE(state.BeginFrameNeeded()); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); @@ -1791,7 +1787,7 @@ TEST(SchedulerStateMachineTest, TestSetNeedsAnimateAfterAnimate) { EXPECT_TRUE(state.BeginFrameNeeded()); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_ANIMATE); state.SetNeedsAnimate(); @@ -1823,14 +1819,14 @@ TEST(SchedulerStateMachineTest, TestDeferCommit) { EXPECT_TRUE(state.BeginFrameNeeded()); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.OnBeginImplFrameDeadline(); EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE); state.SetDeferCommits(false); - state.OnBeginImplFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE)); + state.OnBeginImplFrame(); EXPECT_ACTION_UPDATE_STATE( SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME); } -- 2.11.4.GIT