Commit 9f35bd24 authored by enne@chromium.org's avatar enne@chromium.org

Update source frame number even when commits abort

If a commit aborts, then PictureLayer::update_source_frame_number_ will
be stale since only a finished commit would update the
LTH::source_frame_number_.  This could lead to an issue where a commit
aborts and then on the next frame a layer's size is updated *and* it is
set to not draw.  This causes it to skip being updated (meaning the pile
size is not updated) but the layer bounds have changed and trips an
assert in PushPropertiesTo that tries to make sure that the pile and
layer bounds are the same when a layer has been updated that frame.

The fix here is to update the source frame number even for aborted
commits.  This causes the PushPropertiesTo assert to properly be
ignored.

BUG=375675

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274540 0039d316-1c4b-4281-b951-d872f2087c98
parent 9a397992
......@@ -1107,6 +1107,7 @@ class TextureLayerNoExtraCommitForMailboxTest
scoped_ptr<SingleReleaseCallback>* release_callback,
bool use_shared_memory) OVERRIDE {
if (layer_tree_host()->source_frame_number() == 1) {
// Once this has been committed, the mailbox will be released.
*texture_mailbox = TextureMailbox();
return true;
}
......@@ -1119,7 +1120,9 @@ class TextureLayerNoExtraCommitForMailboxTest
}
void MailboxReleased(uint32 sync_point, bool lost_resource) {
EXPECT_EQ(2, layer_tree_host()->source_frame_number());
// Source frame number during callback is the same as the source frame
// on which it was released.
EXPECT_EQ(1, layer_tree_host()->source_frame_number());
EndTest();
}
......
......@@ -395,8 +395,6 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
}
micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl);
source_frame_number_++;
}
void LayerTreeHost::WillCommit() {
......@@ -417,6 +415,7 @@ void LayerTreeHost::UpdateHudLayer() {
}
void LayerTreeHost::CommitComplete() {
source_frame_number_++;
client_->DidCommit();
}
......
......@@ -241,7 +241,8 @@ class LayerTreeHostScrollTestScrollAbortedCommit
case 3:
// This commit will not be aborted because of the scroll change.
EXPECT_EQ(2, num_impl_scrolls_);
EXPECT_EQ(1, layer_tree_host()->source_frame_number());
// The source frame number still increases even with the abort.
EXPECT_EQ(2, layer_tree_host()->source_frame_number());
EXPECT_VECTOR_EQ(root_scroll_layer->scroll_offset(),
initial_scroll_ + impl_scroll_ + impl_scroll_);
EXPECT_EQ(impl_scale_ * impl_scale_,
......@@ -252,7 +253,7 @@ class LayerTreeHostScrollTestScrollAbortedCommit
case 4:
// This commit will also be aborted.
EXPECT_EQ(3, num_impl_scrolls_);
EXPECT_EQ(2, layer_tree_host()->source_frame_number());
EXPECT_EQ(3, layer_tree_host()->source_frame_number());
EXPECT_VECTOR_EQ(root_scroll_layer->scroll_offset(),
initial_scroll_ + impl_scroll_ + impl_scroll_ +
impl_scroll_ + second_main_scroll_);
......@@ -311,7 +312,10 @@ class LayerTreeHostScrollTestScrollAbortedCommit
impl->active_tree()->total_page_scale_factor());
impl->SetNeedsCommit();
} else if (impl->active_tree()->source_frame_number() == 1 &&
} else if (impl->active_tree()->source_frame_number() == 1) {
// Commit for source frame 1 is aborted.
NOTREACHED();
} else if (impl->active_tree()->source_frame_number() == 2 &&
impl->SourceAnimationFrameNumber() == 3) {
// Third draw after the second full commit.
EXPECT_EQ(root_scroll_layer->ScrollDelta(), gfx::Vector2d());
......@@ -321,7 +325,7 @@ class LayerTreeHostScrollTestScrollAbortedCommit
EXPECT_VECTOR_EQ(
root_scroll_layer->scroll_offset(),
initial_scroll_ + impl_scroll_ + impl_scroll_ + second_main_scroll_);
} else if (impl->active_tree()->source_frame_number() == 1 &&
} else if (impl->active_tree()->source_frame_number() == 2 &&
impl->SourceAnimationFrameNumber() == 4) {
// Final draw after the second aborted commit.
EXPECT_VECTOR_EQ(root_scroll_layer->ScrollDelta(), gfx::Vector2d());
......@@ -329,6 +333,9 @@ class LayerTreeHostScrollTestScrollAbortedCommit
initial_scroll_ + impl_scroll_ + impl_scroll_ +
impl_scroll_ + second_main_scroll_);
EndTest();
} else {
// Commit for source frame 3 is aborted.
NOTREACHED();
}
}
......
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