OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/layers/append_quads_data.h" | 5 #include "cc/layers/append_quads_data.h" |
6 #include "cc/layers/content_layer_client.h" | 6 #include "cc/layers/content_layer_client.h" |
7 #include "cc/layers/picture_layer.h" | 7 #include "cc/layers/picture_layer.h" |
8 #include "cc/layers/picture_layer_impl.h" | 8 #include "cc/layers/picture_layer_impl.h" |
9 #include "cc/quads/draw_quad.h" | 9 #include "cc/quads/draw_quad.h" |
10 #include "cc/test/layer_tree_pixel_test.h" | 10 #include "cc/test/layer_tree_pixel_test.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 | 47 |
48 AppendQuadsData data; | 48 AppendQuadsData data; |
49 picture_layer->AppendQuads(&quad_culler, &data); | 49 picture_layer->AppendQuads(&quad_culler, &data); |
50 | 50 |
51 for (size_t i = 0; i < render_pass->quad_list.size(); ++i) | 51 for (size_t i = 0; i < render_pass->quad_list.size(); ++i) |
52 EXPECT_EQ(render_pass->quad_list[i]->material, DrawQuad::PICTURE_CONTENT); | 52 EXPECT_EQ(render_pass->quad_list[i]->material, DrawQuad::PICTURE_CONTENT); |
53 | 53 |
54 // Triggers pixel readback and ends the test. | 54 // Triggers pixel readback and ends the test. |
55 LayerTreePixelTest::SwapBuffersOnThread(host_impl, result); | 55 LayerTreePixelTest::SwapBuffersOnThread(host_impl, result); |
56 } | 56 } |
57 | |
58 void RunOnDemandRasterPixelTest(); | |
57 }; | 59 }; |
58 | 60 |
59 class BlueYellowLayerClient : public ContentLayerClient { | 61 class BlueYellowLayerClient : public ContentLayerClient { |
60 public: | 62 public: |
61 explicit BlueYellowLayerClient(gfx::Rect layer_rect) | 63 explicit BlueYellowLayerClient(gfx::Rect layer_rect) |
62 : layer_rect_(layer_rect) {} | 64 : layer_rect_(layer_rect) {} |
63 | 65 |
64 virtual void DidChangeLayerCanUseLCDText() OVERRIDE { } | 66 virtual void DidChangeLayerCanUseLCDText() OVERRIDE { } |
65 | 67 |
66 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } | 68 virtual bool FillsBoundsCompletely() const OVERRIDE { return false; } |
(...skipping 17 matching lines...) Expand all Loading... | |
84 layer_rect_.height() / 2, | 86 layer_rect_.height() / 2, |
85 layer_rect_.width(), | 87 layer_rect_.width(), |
86 layer_rect_.height() / 2), | 88 layer_rect_.height() / 2), |
87 paint); | 89 paint); |
88 } | 90 } |
89 | 91 |
90 private: | 92 private: |
91 gfx::Rect layer_rect_; | 93 gfx::Rect layer_rect_; |
92 }; | 94 }; |
93 | 95 |
94 TEST_F(LayerTreeHostOnDemandRasterPixelTest, RasterPictureLayer) { | 96 void LayerTreeHostOnDemandRasterPixelTest::RunOnDemandRasterPixelTest() { |
95 // Use multiple colors in a single layer to prevent bypassing on-demand | 97 // Use multiple colors in a single layer to prevent bypassing on-demand |
96 // rasterization if a single solid color is detected in picture analysis. | 98 // rasterization if a single solid color is detected in picture analysis. |
97 gfx::Rect layer_rect(200, 200); | 99 gfx::Rect layer_rect(200, 200); |
98 BlueYellowLayerClient client(layer_rect); | 100 BlueYellowLayerClient client(layer_rect); |
99 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 101 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
100 | 102 |
101 layer->SetIsDrawable(true); | 103 layer->SetIsDrawable(true); |
102 layer->SetBounds(layer_rect.size()); | 104 layer->SetBounds(layer_rect.size()); |
103 layer->SetPosition(layer_rect.origin()); | 105 layer->SetPosition(layer_rect.origin()); |
104 | 106 |
105 RunPixelTest(GL_WITH_BITMAP, | 107 RunPixelTest(GL_WITH_BITMAP, |
106 layer, | 108 layer, |
107 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png"))); | 109 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png"))); |
108 } | 110 } |
109 | 111 |
112 TEST_F(LayerTreeHostOnDemandRasterPixelTest, RasterPictureLayer) { | |
113 RunOnDemandRasterPixelTest(); | |
114 } | |
115 | |
116 class LayerTreeHostOnDemandRasterPixelTestWithoutTaskGraphRunner | |
reveman
2014/06/20 00:38:41
s/WithoutTaskGraphRunner/WithGpuRasterizationForce
boliu
2014/06/20 00:43:39
Any thoughts on the crash in the global TaskGraphR
reveman
2014/06/20 01:01:38
Do you mean that the TaskGraphRunner instance is c
boliu
2014/06/20 01:27:06
Yep. The cc thread in the two threads are not the
| |
117 : public LayerTreeHostOnDemandRasterPixelTest { | |
118 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | |
119 LayerTreeHostOnDemandRasterPixelTest::InitializeSettings(settings); | |
120 settings->gpu_rasterization_forced = true; | |
121 } | |
122 }; | |
123 | |
124 TEST_F(LayerTreeHostOnDemandRasterPixelTestWithoutTaskGraphRunner, | |
125 RasterPictureLayer) { | |
126 RunOnDemandRasterPixelTest(); | |
127 } | |
128 | |
110 } // namespace | 129 } // namespace |
111 } // namespace cc | 130 } // namespace cc |
112 | 131 |
113 #endif // OS_ANDROID | 132 #endif // OS_ANDROID |
OLD | NEW |