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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2149843003: Fix MultiPictureDraw issues with GpuImageDecodeController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« cc/raster/gpu_raster_buffer_provider.cc ('K') | « cc/test/skia_common.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.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 256befef3c74a85bc1f7baddb01e2c8986d88de0..b19bb58f42864a5be81313502a7a14aaca06e5e1 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -47,6 +47,7 @@
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_internals_for_test.h"
#include "cc/test/layer_tree_test.h"
+#include "cc/test/skia_common.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/test/test_web_graphics_context_3d.h"
#include "cc/trees/effect_node.h"
@@ -6783,5 +6784,63 @@ class LayerTreeHostTestPaintedDeviceScaleFactor : public LayerTreeHostTest {
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
+// The GPU image decode controller hands images off to Skia for rasterization.
+// When used with large images, the images in question could be deleted before
+// Skia was done with them, causing a crash. This test performs an end-to-end
+// check of large image rasterization to ensure we do not hit this crash.
+// Note that this code path won't always hit the crash, even when incorrect
+// behavior occurs, so this is more of a sanity check.
+// TODO(ericrk): We should improve this so that we can reliably detect the
+// crash.
+class GpuRasterizationSucceedsWithLargeImage : public LayerTreeHostTest {
+ protected:
+ GpuRasterizationSucceedsWithLargeImage() : viewport_size_(1024, 2048) {}
+
+ void InitializeSettings(LayerTreeSettings* settings) override {
+ settings->gpu_rasterization_enabled = true;
+ settings->gpu_rasterization_forced = true;
+
+ /// Set to 0 to force at-raster GPU image decode.
+ settings->gpu_decoded_image_budget_bytes = 0;
+ }
+
+ void SetupTree() override {
+ client_.set_fill_with_nonsolid_color(true);
+
+ std::unique_ptr<FakeRecordingSource> recording =
+ FakeRecordingSource::CreateFilledRecordingSource(
+ gfx::Size(10000, 10000));
+ // Add an image that will be larger than max texture size.
+ recording->add_draw_image(CreateDiscardableImage(gfx::Size(20000, 10)),
+ gfx::Point(0, 0));
+ recording->SetGenerateDiscardableImagesMetadata(true);
+ recording->Rerecord();
+
+ scoped_refptr<FakePictureLayer> root =
+ FakePictureLayer::CreateWithRecordingSource(&client_,
+ std::move(recording));
+ root->SetBounds(gfx::Size(10000, 10000));
+ client_.set_bounds(root->bounds());
+ root->SetContentsOpaque(true);
+
+ layer_tree_host()->SetRootLayer(root);
+ LayerTreeHostTest::SetupTree();
+ layer_tree_host()->SetViewportSize(viewport_size_);
+ client_.set_bounds(root->bounds());
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void DidCommit() override { EndTest(); }
+
+ void AfterTest() override {}
+
+ private:
+ FakeContentLayerClient client_;
+ gfx::Size viewport_size_;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage);
+
} // namespace
} // namespace cc
« cc/raster/gpu_raster_buffer_provider.cc ('K') | « cc/test/skia_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698