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

Unified Diff: cc/layers/texture_layer_impl_unittest.cc

Issue 2480533002: Don't free non-tile resources on GPU rasterization toggle (Closed)
Patch Set: Created 4 years, 1 month 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/picture_layer_impl_unittest.cc ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/texture_layer_impl_unittest.cc
diff --git a/cc/layers/texture_layer_impl_unittest.cc b/cc/layers/texture_layer_impl_unittest.cc
index 0551951c12d95118f7a8bdda3e6643178f2dbedf..f901cdad52bf06a6f2e267b340b1c0282f9cf35e 100644
--- a/cc/layers/texture_layer_impl_unittest.cc
+++ b/cc/layers/texture_layer_impl_unittest.cc
@@ -147,5 +147,50 @@ TEST(TextureLayerImplTest, OutputIsSecure) {
}
}
+TEST(TextureLayerImplTest, ResourceNotFreedOnGpuRasterToggle) {
+ LayerTreeSettings settings;
+ settings.gpu_rasterization_enabled = true;
+ LayerTestCommon::LayerImplTest impl(settings);
+ impl.host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
+
+ gfx::Size layer_size(1000, 1000);
+ gfx::Size viewport_size(1000, 1000);
+
+ gpu::Mailbox mailbox;
+ impl.compositor_frame_sink()
+ ->context_provider()
+ ->ContextGL()
+ ->GenMailboxCHROMIUM(mailbox.name);
+ TextureMailbox texture_mailbox(
+ mailbox,
+ gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO, 0x123,
+ gpu::CommandBufferId::FromUnsafeValue(0x234), 0x456),
+ GL_TEXTURE_2D);
+
+ TextureLayerImpl* texture_layer_impl =
+ impl.AddChildToRoot<TextureLayerImpl>();
+ texture_layer_impl->SetBounds(layer_size);
+ texture_layer_impl->SetDrawsContent(true);
+ bool released = false;
+ texture_layer_impl->SetTextureMailbox(
+ texture_mailbox,
+ SingleReleaseCallbackImpl::Create(base::Bind(
+ [](bool* released, const gpu::SyncToken& sync_token, bool lost,
+ BlockingTaskRunner* main_thread_task_runner) { *released = true; },
+ base::Unretained(&released))));
+
+ impl.CalcDrawProps(viewport_size);
+
+ // Gpu rasterization is disabled by default.
+ EXPECT_FALSE(impl.host_impl()->use_gpu_rasterization());
+ EXPECT_FALSE(released);
+ // Toggling the gpu rasterization clears all tilings on both trees.
+ impl.host_impl()->SetHasGpuRasterizationTrigger(true);
+ impl.host_impl()->SetContentIsSuitableForGpuRasterization(true);
+ impl.host_impl()->CommitComplete();
+ EXPECT_TRUE(impl.host_impl()->use_gpu_rasterization());
+ EXPECT_FALSE(released);
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/layers/picture_layer_impl_unittest.cc ('k') | cc/test/fake_picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698