Index: cc/trees/layer_tree_host_impl_unittest.cc |
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc |
index 91a19139190126ab13b489e643bcb9601d7a60a6..750c20cfbe40239600bf05054bb7dfc53290f07e 100644 |
--- a/cc/trees/layer_tree_host_impl_unittest.cc |
+++ b/cc/trees/layer_tree_host_impl_unittest.cc |
@@ -119,7 +119,10 @@ class LayerTreeHostImplTest : public testing::Test, |
CreateHostImpl(DefaultSettings(), CreateOutputSurface()); |
} |
- void TearDown() override {} |
+ void TearDown() override { |
+ if (host_impl_) |
+ host_impl_->ReleaseOutputSurface(); |
+ } |
void UpdateRendererCapabilitiesOnImplThread() override {} |
void DidLoseOutputSurfaceOnImplThread() override {} |
@@ -191,6 +194,8 @@ class LayerTreeHostImplTest : public testing::Test, |
const LayerTreeSettings& settings, |
std::unique_ptr<OutputSurface> output_surface, |
TaskRunnerProvider* task_runner_provider) { |
+ if (host_impl_) |
+ host_impl_->ReleaseOutputSurface(); |
host_impl_ = LayerTreeHostImpl::Create( |
settings, this, task_runner_provider, &stats_instrumentation_, |
&shared_bitmap_manager_, &gpu_memory_buffer_manager_, |
@@ -1349,7 +1354,7 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingActiveTree) { |
child->SetBounds(gfx::Size(10, 10)); |
child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
child->SetDrawsContent(true); |
- |
+ host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
host_impl_->active_tree()->SetElementIdsForTesting(); |
// Add a translate from 6,7 to 8,9. |
@@ -1442,6 +1447,7 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingCommitToActiveTree) { |
EXPECT_FALSE(did_request_commit_); |
// Delete the LayerTreeHostImpl before the TaskRunnerProvider goes away. |
+ host_impl_->ReleaseOutputSurface(); |
host_impl_ = nullptr; |
} |
@@ -1460,6 +1466,7 @@ TEST_F(LayerTreeHostImplTest, AnimationSchedulingOnLayerDestruction) { |
child->draw_properties().visible_layer_rect = gfx::Rect(10, 10); |
child->SetDrawsContent(true); |
+ host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
host_impl_->active_tree()->SetElementIdsForTesting(); |
// Add a translate animation. |
@@ -2709,6 +2716,9 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl { |
class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { |
protected: |
void SetupLayers(LayerTreeSettings settings) { |
+ host_impl_->ReleaseOutputSurface(); |
+ host_impl_ = nullptr; |
+ |
gfx::Size content_size(100, 100); |
LayerTreeHostImplOverridePhysicalTime* host_impl_override_time = |
@@ -5884,7 +5894,8 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) { |
EXPECT_EQ(gfx::SizeF(new_size), scroll_watcher.scrollable_size()); |
// Tear down the LayerTreeHostImpl before the InputHandlerClient. |
- host_impl_.reset(); |
+ host_impl_->ReleaseOutputSurface(); |
+ host_impl_ = nullptr; |
} |
void CheckLayerScrollDelta(LayerImpl* layer, gfx::Vector2dF scroll_delta) { |
@@ -7058,6 +7069,8 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) { |
expected_swap_rect = gfx::Rect(0, 0, 10, 10); |
EXPECT_EQ(expected_swap_rect.ToString(), |
fake_output_surface->last_swap_rect().ToString()); |
+ |
+ layer_tree_host_impl->ReleaseOutputSurface(); |
} |
TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) { |
@@ -7380,6 +7393,7 @@ TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorPartialSwap) { |
my_host_impl->DrawLayers(&frame); |
my_host_impl->DidDrawAllLayers(frame); |
} |
+ my_host_impl->ReleaseOutputSurface(); |
} |
TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { |
@@ -7410,6 +7424,7 @@ TEST_F(LayerTreeHostImplTest, ContributingLayerEmptyScissorNoPartialSwap) { |
my_host_impl->DrawLayers(&frame); |
my_host_impl->DidDrawAllLayers(frame); |
} |
+ my_host_impl->ReleaseOutputSurface(); |
} |
TEST_F(LayerTreeHostImplTest, LayersFreeTextures) { |
@@ -7786,6 +7801,9 @@ TEST_F(LayerTreeHostImplTest, |
// Checks that we have a non-0 default allocation if we pass a context that |
// doesn't support memory management extensions. |
TEST_F(LayerTreeHostImplTest, DefaultMemoryAllocation) { |
+ host_impl_->ReleaseOutputSurface(); |
+ host_impl_ = nullptr; |
+ |
LayerTreeSettings settings = DefaultSettings(); |
host_impl_ = LayerTreeHostImpl::Create( |
settings, this, &task_runner_provider_, &stats_instrumentation_, |
@@ -7969,6 +7987,7 @@ TEST_F(LayerTreeHostImplTest, ShutdownReleasesContext) { |
EXPECT_FALSE(context_provider->HasOneRef()); |
EXPECT_EQ(1u, context_provider->TestContext3d()->NumTextures()); |
+ host_impl_->ReleaseOutputSurface(); |
host_impl_ = nullptr; |
// The CopyOutputResult's callback was cancelled, the CopyOutputResult |
@@ -10934,6 +10953,9 @@ TEST_F(LayerTreeHostImplTest, JitterTest) { |
// with a software OutputSurface, LayerTreeHostImpl correctly re-computes GPU |
// rasterization status. |
TEST_F(LayerTreeHostImplTest, RecomputeGpuRasterOnOutputSurfaceChange) { |
+ host_impl_->ReleaseOutputSurface(); |
+ host_impl_ = nullptr; |
+ |
LayerTreeSettings settings = DefaultSettings(); |
settings.gpu_rasterization_forced = true; |