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

Unified Diff: cc/trees/layer_tree_host_unittest_copyrequest.cc

Issue 478703002: Remove cc::LayerTreeHostImpl::IsContextLost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ctx4
Patch Set: Fix style: bracing, no (void) Created 6 years, 4 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/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/layer_tree_host_unittest_delegated.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_copyrequest.cc
diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc
index 12fc63128f060cae65b923a4a6ce081728da9a4b..e3eed76e530729cf50a5e0a84485a7bb5cb4f56c 100644
--- a/cc/trees/layer_tree_host_unittest_copyrequest.cc
+++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc
@@ -586,25 +586,33 @@ class LayerTreeHostCopyRequestTestLostOutputSurface
base::Unretained(this))));
break;
case 4:
- // With SingleThreadProxy it takes two commits to finally swap after a
- // context loss.
+ if (HasImplThread())
+ CheckAndReleaseCopyOutput();
+ break;
case 5:
- // Now destroy the CopyOutputResult, releasing the texture inside back
- // to the compositor.
- EXPECT_TRUE(result_);
- result_.reset();
-
- // Check that it is released.
- ImplThreadTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&LayerTreeHostCopyRequestTestLostOutputSurface::
- CheckNumTextures,
- base::Unretained(this),
- num_textures_after_loss_ - 1));
+ // With SingleThreadProxy it takes two commits to finally swap after a
+ // context loss.
+ if (!HasImplThread())
+ CheckAndReleaseCopyOutput();
break;
}
}
+ void CheckAndReleaseCopyOutput() {
+ // Now destroy the CopyOutputResult, releasing the texture inside back
+ // to the compositor.
+ EXPECT_TRUE(result_);
+ result_.reset();
+
+ // Check that it is released.
+ ImplThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &LayerTreeHostCopyRequestTestLostOutputSurface::CheckNumTextures,
+ base::Unretained(this),
+ num_textures_after_loss_ - 1));
+ }
+
virtual void SwapBuffersOnThread(LayerTreeHostImpl* impl,
bool result) OVERRIDE {
switch (impl->active_tree()->source_frame_number()) {
@@ -628,18 +636,26 @@ class LayerTreeHostCopyRequestTestLostOutputSurface
GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
break;
case 3:
- // With SingleThreadProxy it takes two commits to finally swap after a
- // context loss.
+ if (HasImplThread())
+ CheckSecondContextCreated();
+ break;
case 4:
- // The output surface has been recreated.
- EXPECT_TRUE(second_context_provider_.get());
-
- num_textures_after_loss_ =
- first_context_provider_->TestContext3d()->NumTextures();
+ // With SingleThreadProxy it takes two commits to finally swap after a
+ // context loss.
+ if (!HasImplThread())
+ CheckSecondContextCreated();
break;
}
}
+ void CheckSecondContextCreated() {
+ // The output surface has been recreated.
+ EXPECT_TRUE(second_context_provider_.get());
+
+ num_textures_after_loss_ =
+ first_context_provider_->TestContext3d()->NumTextures();
+ }
+
void CheckNumTextures(size_t expected_num_textures) {
EXPECT_EQ(expected_num_textures,
first_context_provider_->TestContext3d()->NumTextures());
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | cc/trees/layer_tree_host_unittest_delegated.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698