summaryrefslogtreecommitdiffstats
path: root/cc/trees
diff options
context:
space:
mode:
authorDana Jansens <danakj@google.com>2015-05-19 11:55:20 -0700
committerDana Jansens <danakj@google.com>2015-05-19 18:56:08 +0000
commit8316ee0f07b8dfed94a69ca28f99aea6ad353a54 (patch)
treef60b752a862b48e72feaacaef3dbcf6843697895 /cc/trees
parent4403a066c462ec3b4a8fd516356e86c37d3de31f (diff)
downloadchromium_src-8316ee0f07b8dfed94a69ca28f99aea6ad353a54.zip
chromium_src-8316ee0f07b8dfed94a69ca28f99aea6ad353a54.tar.gz
chromium_src-8316ee0f07b8dfed94a69ca28f99aea6ad353a54.tar.bz2
cc: Don't try set RenderPasses on active tree after losing context.
DelegatedRendererLayerImpl passes the frame from the pending to the active tree, but relies on there being a child_id_ on the active layer that is known to the ResourceProvider. If the context was lost while the frame was in the pending tree, the frames resources are released, but we try to tell the resource provider to use the empty frame with an invalid child id. When the context is lost and we drop the frame, also unset the bool saying we have a frame to pass to the active tree. TBR=piman@chromium.org BUG=488366 Review URL: https://codereview.chromium.org/1128043008 Cr-Commit-Position: refs/heads/master@{#330256} (cherry picked from commit ce0d180446f7f0c78d84c0a872eefd4cddf79895) Review URL: https://codereview.chromium.org/1131383006 Cr-Commit-Position: refs/branch-heads/2403@{#17} Cr-Branched-From: f54b8097a9c45ed4ad308133d49f05325d6c5070-refs/heads/master@{#330231}
Diffstat (limited to 'cc/trees')
-rw-r--r--cc/trees/layer_tree_host_unittest_delegated.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc
index 6d0fb0a..2864eb8 100644
--- a/cc/trees/layer_tree_host_unittest_delegated.cc
+++ b/cc/trees/layer_tree_host_unittest_delegated.cc
@@ -404,6 +404,37 @@ class LayerTreeHostDelegatedTestCreateChildId
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCreateChildId);
+class LayerTreeHostDelegatedTestDontUseLostChildIdAfterCommit
+ : public LayerTreeHostDelegatedTestCaseSingleDelegatedLayer {
+ protected:
+ void BeginTest() override {
+ SetFrameData(CreateFrameData(gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1)));
+ LayerTreeHostDelegatedTestCaseSingleDelegatedLayer::BeginTest();
+ }
+
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
+ // Act like the context was lost while the layer is in the pending tree.
+ LayerImpl* root_impl = host_impl->sync_tree()->root_layer();
+ FakeDelegatedRendererLayerImpl* delegated_impl =
+ static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+ delegated_impl->ReleaseResources();
+ }
+
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
+ LayerImpl* root_impl = host_impl->active_tree()->root_layer();
+ FakeDelegatedRendererLayerImpl* delegated_impl =
+ static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]);
+
+ // Should not try to activate a frame without a child id. If we did try to
+ // activate we would crash.
+ EXPECT_FALSE(delegated_impl->ChildId());
+ EndTest();
+ }
+};
+
+MULTI_THREAD_IMPL_TEST_F(
+ LayerTreeHostDelegatedTestDontUseLostChildIdAfterCommit);
+
// Test that we can gracefully handle invalid frames after the context was lost.
// For example, we might be trying to use the previous frame in that case and
// have to make sure we don't crash because our resource accounting goes wrong.