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

Side by Side 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: feedback 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 unified diff | Download patch
« no previous file with comments | « cc/test/skia_common.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 29 matching lines...) Expand all
40 #include "cc/test/fake_painted_scrollbar_layer.h" 40 #include "cc/test/fake_painted_scrollbar_layer.h"
41 #include "cc/test/fake_picture_layer.h" 41 #include "cc/test/fake_picture_layer.h"
42 #include "cc/test/fake_picture_layer_impl.h" 42 #include "cc/test/fake_picture_layer_impl.h"
43 #include "cc/test/fake_proxy.h" 43 #include "cc/test/fake_proxy.h"
44 #include "cc/test/fake_recording_source.h" 44 #include "cc/test/fake_recording_source.h"
45 #include "cc/test/fake_scoped_ui_resource.h" 45 #include "cc/test/fake_scoped_ui_resource.h"
46 #include "cc/test/fake_video_frame_provider.h" 46 #include "cc/test/fake_video_frame_provider.h"
47 #include "cc/test/geometry_test_utils.h" 47 #include "cc/test/geometry_test_utils.h"
48 #include "cc/test/layer_internals_for_test.h" 48 #include "cc/test/layer_internals_for_test.h"
49 #include "cc/test/layer_tree_test.h" 49 #include "cc/test/layer_tree_test.h"
50 #include "cc/test/skia_common.h"
50 #include "cc/test/test_shared_bitmap_manager.h" 51 #include "cc/test/test_shared_bitmap_manager.h"
51 #include "cc/test/test_web_graphics_context_3d.h" 52 #include "cc/test/test_web_graphics_context_3d.h"
52 #include "cc/trees/effect_node.h" 53 #include "cc/trees/effect_node.h"
53 #include "cc/trees/layer_tree_host_impl.h" 54 #include "cc/trees/layer_tree_host_impl.h"
54 #include "cc/trees/layer_tree_impl.h" 55 #include "cc/trees/layer_tree_impl.h"
55 #include "cc/trees/single_thread_proxy.h" 56 #include "cc/trees/single_thread_proxy.h"
56 #include "cc/trees/transform_node.h" 57 #include "cc/trees/transform_node.h"
57 #include "gpu/GLES2/gl2extchromium.h" 58 #include "gpu/GLES2/gl2extchromium.h"
58 #include "testing/gmock/include/gmock/gmock.h" 59 #include "testing/gmock/include/gmock/gmock.h"
59 #include "third_party/khronos/GLES2/gl2.h" 60 #include "third_party/khronos/GLES2/gl2.h"
(...skipping 6716 matching lines...) Expand 10 before | Expand all | Expand 10 after
6776 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor()); 6777 EXPECT_EQ(2.0f, host_impl->active_tree()->painted_device_scale_factor());
6777 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor()); 6778 EXPECT_EQ(1.0f, host_impl->active_tree()->device_scale_factor());
6778 EndTest(); 6779 EndTest();
6779 } 6780 }
6780 6781
6781 void AfterTest() override {} 6782 void AfterTest() override {}
6782 }; 6783 };
6783 6784
6784 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); 6785 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
6785 6786
6787 // The GPU image decode controller hands images off to Skia for rasterization.
6788 // When used with large images, the images in question could be deleted before
6789 // Skia was done with them, causing a crash. This test performs an end-to-end
6790 // check of large image rasterization to ensure we do not hit this crash.
6791 // Note that this code path won't always hit the crash, even when incorrect
6792 // behavior occurs, so this is more of a sanity check.
6793 // TODO(ericrk): We should improve this so that we can reliably detect the
6794 // crash.
6795 class GpuRasterizationSucceedsWithLargeImage : public LayerTreeHostTest {
6796 protected:
6797 GpuRasterizationSucceedsWithLargeImage() : viewport_size_(1024, 2048) {}
6798
6799 void InitializeSettings(LayerTreeSettings* settings) override {
6800 settings->gpu_rasterization_enabled = true;
6801 settings->gpu_rasterization_forced = true;
6802
6803 /// Set to 0 to force at-raster GPU image decode.
6804 settings->gpu_decoded_image_budget_bytes = 0;
6805 }
6806
6807 void SetupTree() override {
6808 client_.set_fill_with_nonsolid_color(true);
6809
6810 std::unique_ptr<FakeRecordingSource> recording =
6811 FakeRecordingSource::CreateFilledRecordingSource(
6812 gfx::Size(10000, 10000));
6813 // Add an image that will be larger than max texture size.
vmpstr 2016/07/14 22:07:48 Is there a way to assert that this size is bigger
ericrk 2016/07/14 23:15:46 Added.
6814 recording->add_draw_image(CreateDiscardableImage(gfx::Size(20000, 10)),
6815 gfx::Point(0, 0));
6816 recording->SetGenerateDiscardableImagesMetadata(true);
6817 recording->Rerecord();
6818
6819 scoped_refptr<FakePictureLayer> root =
6820 FakePictureLayer::CreateWithRecordingSource(&client_,
6821 std::move(recording));
6822 root->SetBounds(gfx::Size(10000, 10000));
6823 client_.set_bounds(root->bounds());
6824 root->SetContentsOpaque(true);
6825
6826 layer_tree_host()->SetRootLayer(root);
6827 LayerTreeHostTest::SetupTree();
6828 layer_tree_host()->SetViewportSize(viewport_size_);
6829 client_.set_bounds(root->bounds());
6830 }
6831
6832 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
6833
6834 void DidCommit() override { EndTest(); }
6835
6836 void AfterTest() override {}
6837
6838 private:
6839 FakeContentLayerClient client_;
6840 gfx::Size viewport_size_;
6841 };
6842
6843 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage);
6844
6786 } // namespace 6845 } // namespace
6787 } // namespace cc 6846 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/skia_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698