Commit 5f4e78e2 authored by mithro's avatar mithro Committed by Commit bot

cc: Trigger BeginImplFrameDeadline immediately when invisible.

When becoming invisible we are going to abort any pending draw / activate. We
should do that right now rather then waking up sometime in the future and doing
it. This increases the speed at which we become idle after going invisible.

A minor side effect is we will do more work if we become invisible and then
visible within a single frame, but this case is extremely unlikely while the
case compared to becoming invisible for a longer period.

Related to http://crrev.com/1050833002

BUG=371747
R=brianderson,jdduke

Committed: https://crrev.com/c7c617b8619518568d2267015a5ee32aed7df883
Cr-Commit-Position: refs/heads/master@{#323397}

Review URL: https://codereview.chromium.org/1051123002

Cr-Commit-Position: refs/heads/master@{#324383}
parent d041a28b
......@@ -874,9 +874,9 @@ bool SchedulerStateMachine::ShouldTriggerBeginImplFrameDeadlineImmediately()
if (begin_impl_frame_state_ != BEGIN_IMPL_FRAME_STATE_INSIDE_BEGIN_FRAME)
return false;
// If we've lost the output surface, end the current BeginImplFrame ASAP
// so we can start creating the next output surface.
if (output_surface_state_ == OUTPUT_SURFACE_LOST)
// If things are being aborted, end the current BeginImplFrame ASAP so we can
// unblock creating the next output surface.
if (PendingDrawsShouldBeAborted())
return true;
// SwapAck throttle the deadline since we wont draw and swap anyway.
......
......@@ -1791,6 +1791,25 @@ TEST(SchedulerStateMachineTest,
EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
}
TEST(SchedulerStateMachineTest, TestTriggerDeadlineImmediatelyWhenInvisible) {
SchedulerSettings settings;
settings.impl_side_painting = true;
StateMachine state(settings);
SET_UP_STATE(state)
state.SetNeedsCommit();
state.OnBeginImplFrame();
EXPECT_ACTION_UPDATE_STATE(
SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_FALSE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
state.SetVisible(false);
EXPECT_ACTION_UPDATE_STATE(SchedulerStateMachine::ACTION_NONE);
EXPECT_TRUE(state.ShouldTriggerBeginImplFrameDeadlineImmediately());
}
TEST(SchedulerStateMachineTest, TestSetNeedsAnimate) {
SchedulerSettings settings;
settings.impl_side_painting = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment