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

Unified Diff: cc/trees/layer_tree_host_unittest_delegated.cc

Issue 1128043008: cc: Don't try set renderpasses on active tree after losing context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: drlcrash: . Created 5 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/delegated_renderer_layer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_delegated.cc
diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc
index 6d0fb0a886adec78f31fdd634580e33c088d46da..2864eb82ad6df0f2832169ec569443aa2bce23c2 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.
« no previous file with comments | « cc/layers/delegated_renderer_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698