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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1362663002: cc: Remove PicturePile and PicturePileImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 20 matching lines...) Expand all
31 #include "cc/quads/io_surface_draw_quad.h" 31 #include "cc/quads/io_surface_draw_quad.h"
32 #include "cc/quads/render_pass_draw_quad.h" 32 #include "cc/quads/render_pass_draw_quad.h"
33 #include "cc/quads/tile_draw_quad.h" 33 #include "cc/quads/tile_draw_quad.h"
34 #include "cc/test/fake_content_layer_client.h" 34 #include "cc/test/fake_content_layer_client.h"
35 #include "cc/test/fake_display_list_recording_source.h" 35 #include "cc/test/fake_display_list_recording_source.h"
36 #include "cc/test/fake_layer_tree_host_client.h" 36 #include "cc/test/fake_layer_tree_host_client.h"
37 #include "cc/test/fake_output_surface.h" 37 #include "cc/test/fake_output_surface.h"
38 #include "cc/test/fake_painted_scrollbar_layer.h" 38 #include "cc/test/fake_painted_scrollbar_layer.h"
39 #include "cc/test/fake_picture_layer.h" 39 #include "cc/test/fake_picture_layer.h"
40 #include "cc/test/fake_picture_layer_impl.h" 40 #include "cc/test/fake_picture_layer_impl.h"
41 #include "cc/test/fake_picture_pile.h"
42 #include "cc/test/fake_proxy.h" 41 #include "cc/test/fake_proxy.h"
43 #include "cc/test/fake_scoped_ui_resource.h" 42 #include "cc/test/fake_scoped_ui_resource.h"
44 #include "cc/test/fake_video_frame_provider.h" 43 #include "cc/test/fake_video_frame_provider.h"
45 #include "cc/test/geometry_test_utils.h" 44 #include "cc/test/geometry_test_utils.h"
46 #include "cc/test/layer_tree_test.h" 45 #include "cc/test/layer_tree_test.h"
47 #include "cc/test/test_shared_bitmap_manager.h" 46 #include "cc/test/test_shared_bitmap_manager.h"
48 #include "cc/test/test_web_graphics_context_3d.h" 47 #include "cc/test/test_web_graphics_context_3d.h"
49 #include "cc/trees/layer_tree_host_impl.h" 48 #include "cc/trees/layer_tree_host_impl.h"
50 #include "cc/trees/layer_tree_impl.h" 49 #include "cc/trees/layer_tree_impl.h"
51 #include "cc/trees/single_thread_proxy.h" 50 #include "cc/trees/single_thread_proxy.h"
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 1142
1144 // Tests that if a layer is not drawn because of some reason in the parent then 1143 // Tests that if a layer is not drawn because of some reason in the parent then
1145 // its damage is preserved until the next time it is drawn. 1144 // its damage is preserved until the next time it is drawn.
1146 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { 1145 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest {
1147 public: 1146 public:
1148 LayerTreeHostTestDamageWithScale() {} 1147 LayerTreeHostTestDamageWithScale() {}
1149 1148
1150 void SetupTree() override { 1149 void SetupTree() override {
1151 client_.set_fill_with_nonsolid_color(true); 1150 client_.set_fill_with_nonsolid_color(true);
1152 1151
1153 scoped_ptr<FakePicturePile> pile( 1152 scoped_ptr<FakeDisplayListRecordingSource> recording(
1154 new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 1153 new FakeDisplayListRecordingSource(
1155 LayerTreeSettings().default_tile_grid_size)); 1154 LayerTreeSettings().default_tile_grid_size));
1156 root_layer_ = FakePictureLayer::CreateWithRecordingSource( 1155 root_layer_ = FakePictureLayer::CreateWithRecordingSource(
1157 layer_settings(), &client_, pile.Pass()); 1156 layer_settings(), &client_, recording.Pass());
1158 root_layer_->SetBounds(gfx::Size(50, 50)); 1157 root_layer_->SetBounds(gfx::Size(50, 50));
1159 1158
1160 pile.reset(new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 1159 recording.reset(new FakeDisplayListRecordingSource(
1161 LayerTreeSettings().default_tile_grid_size)); 1160 LayerTreeSettings().default_tile_grid_size));
1162 child_layer_ = FakePictureLayer::CreateWithRecordingSource( 1161 child_layer_ = FakePictureLayer::CreateWithRecordingSource(
1163 layer_settings(), &client_, pile.Pass()); 1162 layer_settings(), &client_, recording.Pass());
1164 child_layer_->SetBounds(gfx::Size(25, 25)); 1163 child_layer_->SetBounds(gfx::Size(25, 25));
1165 child_layer_->SetIsDrawable(true); 1164 child_layer_->SetIsDrawable(true);
1166 child_layer_->SetContentsOpaque(true); 1165 child_layer_->SetContentsOpaque(true);
1167 root_layer_->AddChild(child_layer_); 1166 root_layer_->AddChild(child_layer_);
1168 1167
1169 layer_tree_host()->SetRootLayer(root_layer_); 1168 layer_tree_host()->SetRootLayer(root_layer_);
1170 LayerTreeHostTest::SetupTree(); 1169 LayerTreeHostTest::SetupTree();
1171 } 1170 }
1172 1171
1173 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 1172 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
(...skipping 3680 matching lines...) Expand 10 before | Expand all | Expand 10 after
4854 4853
4855 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 4854 scoped_refptr<Layer> root = Layer::Create(layer_settings());
4856 root->SetBounds(gfx::Size(500, 500)); 4855 root->SetBounds(gfx::Size(500, 500));
4857 4856
4858 scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); 4857 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
4859 pinch->SetBounds(gfx::Size(500, 500)); 4858 pinch->SetBounds(gfx::Size(500, 500));
4860 pinch->SetScrollClipLayerId(root->id()); 4859 pinch->SetScrollClipLayerId(root->id());
4861 pinch->SetIsContainerForFixedPositionLayers(true); 4860 pinch->SetIsContainerForFixedPositionLayers(true);
4862 root->AddChild(pinch); 4861 root->AddChild(pinch);
4863 4862
4864 scoped_ptr<FakePicturePile> pile( 4863 scoped_ptr<FakeDisplayListRecordingSource> recording(
4865 new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 4864 new FakeDisplayListRecordingSource(
4866 LayerTreeSettings().default_tile_grid_size)); 4865 LayerTreeSettings().default_tile_grid_size));
4867 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 4866 recording->SetPlaybackAllowedEvent(&playback_allowed_event_);
4868 scoped_refptr<FakePictureLayer> layer = 4867 scoped_refptr<FakePictureLayer> layer =
4869 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 4868 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
4870 pile.Pass()); 4869 recording.Pass());
4871 layer->SetBounds(gfx::Size(500, 500)); 4870 layer->SetBounds(gfx::Size(500, 500));
4872 layer->SetContentsOpaque(true); 4871 layer->SetContentsOpaque(true);
4873 // Avoid LCD text on the layer so we don't cause extra commits when we 4872 // Avoid LCD text on the layer so we don't cause extra commits when we
4874 // pinch. 4873 // pinch.
4875 pinch->AddChild(layer); 4874 pinch->AddChild(layer);
4876 4875
4877 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 4876 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
4878 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 4877 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
4879 layer_tree_host()->SetRootLayer(root); 4878 layer_tree_host()->SetRootLayer(root);
4880 LayerTreeHostTest::SetupTree(); 4879 LayerTreeHostTest::SetupTree();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
5058 void InitializeSettings(LayerTreeSettings* settings) override { 5057 void InitializeSettings(LayerTreeSettings* settings) override {
5059 settings->gpu_rasterization_forced = true; 5058 settings->gpu_rasterization_forced = true;
5060 } 5059 }
5061 5060
5062 void SetupTree() override { 5061 void SetupTree() override {
5063 client_.set_fill_with_nonsolid_color(true); 5062 client_.set_fill_with_nonsolid_color(true);
5064 5063
5065 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 5064 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5066 root->SetBounds(gfx::Size(500, 500)); 5065 root->SetBounds(gfx::Size(500, 500));
5067 5066
5068 scoped_ptr<FakePicturePile> pile( 5067 scoped_ptr<FakeDisplayListRecordingSource> recording(
5069 new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 5068 new FakeDisplayListRecordingSource(
5070 LayerTreeSettings().default_tile_grid_size)); 5069 LayerTreeSettings().default_tile_grid_size));
5071 scoped_refptr<FakePictureLayer> layer = 5070 scoped_refptr<FakePictureLayer> layer =
5072 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 5071 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5073 pile.Pass()); 5072 recording.Pass());
5074 layer->SetBounds(gfx::Size(500, 500)); 5073 layer->SetBounds(gfx::Size(500, 500));
5075 layer->SetContentsOpaque(true); 5074 layer->SetContentsOpaque(true);
5076 root->AddChild(layer); 5075 root->AddChild(layer);
5077 5076
5078 layer_tree_host()->SetRootLayer(root); 5077 layer_tree_host()->SetRootLayer(root);
5079 LayerTreeHostTest::SetupTree(); 5078 LayerTreeHostTest::SetupTree();
5080 } 5079 }
5081 5080
5082 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5081 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5083 5082
(...skipping 16 matching lines...) Expand all
5100 GpuRasterizationRasterizesBorderTiles() : viewport_size_(1024, 2048) {} 5099 GpuRasterizationRasterizesBorderTiles() : viewport_size_(1024, 2048) {}
5101 5100
5102 void InitializeSettings(LayerTreeSettings* settings) override { 5101 void InitializeSettings(LayerTreeSettings* settings) override {
5103 settings->gpu_rasterization_enabled = true; 5102 settings->gpu_rasterization_enabled = true;
5104 settings->gpu_rasterization_forced = true; 5103 settings->gpu_rasterization_forced = true;
5105 } 5104 }
5106 5105
5107 void SetupTree() override { 5106 void SetupTree() override {
5108 client_.set_fill_with_nonsolid_color(true); 5107 client_.set_fill_with_nonsolid_color(true);
5109 5108
5110 scoped_ptr<FakePicturePile> pile( 5109 scoped_ptr<FakeDisplayListRecordingSource> recording(
5111 new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 5110 new FakeDisplayListRecordingSource(
5112 LayerTreeSettings().default_tile_grid_size)); 5111 LayerTreeSettings().default_tile_grid_size));
5113 scoped_refptr<FakePictureLayer> root = 5112 scoped_refptr<FakePictureLayer> root =
5114 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 5113 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5115 pile.Pass()); 5114 recording.Pass());
5116 root->SetBounds(gfx::Size(10000, 10000)); 5115 root->SetBounds(gfx::Size(10000, 10000));
5117 root->SetContentsOpaque(true); 5116 root->SetContentsOpaque(true);
5118 5117
5119 layer_tree_host()->SetRootLayer(root); 5118 layer_tree_host()->SetRootLayer(root);
5120 LayerTreeHostTest::SetupTree(); 5119 LayerTreeHostTest::SetupTree();
5121 layer_tree_host()->SetViewportSize(viewport_size_); 5120 layer_tree_host()->SetViewportSize(viewport_size_);
5122 } 5121 }
5123 5122
5124 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5123 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5125 5124
(...skipping 27 matching lines...) Expand all
5153 5152
5154 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 5153 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5155 root->SetBounds(gfx::Size(500, 500)); 5154 root->SetBounds(gfx::Size(500, 500));
5156 5155
5157 scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); 5156 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
5158 pinch->SetBounds(gfx::Size(500, 500)); 5157 pinch->SetBounds(gfx::Size(500, 500));
5159 pinch->SetScrollClipLayerId(root->id()); 5158 pinch->SetScrollClipLayerId(root->id());
5160 pinch->SetIsContainerForFixedPositionLayers(true); 5159 pinch->SetIsContainerForFixedPositionLayers(true);
5161 root->AddChild(pinch); 5160 root->AddChild(pinch);
5162 5161
5163 scoped_ptr<FakePicturePile> pile( 5162 scoped_ptr<FakeDisplayListRecordingSource> recording(
5164 new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 5163 new FakeDisplayListRecordingSource(
5165 LayerTreeSettings().default_tile_grid_size)); 5164 LayerTreeSettings().default_tile_grid_size));
5166 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 5165 recording->SetPlaybackAllowedEvent(&playback_allowed_event_);
5167 scoped_refptr<FakePictureLayer> layer = 5166 scoped_refptr<FakePictureLayer> layer =
5168 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 5167 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5169 pile.Pass()); 5168 recording.Pass());
5170 layer->SetBounds(gfx::Size(500, 500)); 5169 layer->SetBounds(gfx::Size(500, 500));
5171 layer->SetContentsOpaque(true); 5170 layer->SetContentsOpaque(true);
5172 // Avoid LCD text on the layer so we don't cause extra commits when we 5171 // Avoid LCD text on the layer so we don't cause extra commits when we
5173 // pinch. 5172 // pinch.
5174 pinch->AddChild(layer); 5173 pinch->AddChild(layer);
5175 5174
5176 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 5175 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
5177 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 5176 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
5178 layer_tree_host()->SetRootLayer(root); 5177 layer_tree_host()->SetRootLayer(root);
5179 LayerTreeHostTest::SetupTree(); 5178 LayerTreeHostTest::SetupTree();
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
6181 ScrollAndScaleSet scale_info_; 6180 ScrollAndScaleSet scale_info_;
6182 ScrollAndScaleSet no_op_info_; 6181 ScrollAndScaleSet no_op_info_;
6183 bool requested_update_layers_; 6182 bool requested_update_layers_;
6184 int commit_count_; 6183 int commit_count_;
6185 }; 6184 };
6186 6185
6187 MULTI_THREAD_TEST_F(LayerTreeHostScrollingAndScalingUpdatesLayers); 6186 MULTI_THREAD_TEST_F(LayerTreeHostScrollingAndScalingUpdatesLayers);
6188 6187
6189 } // namespace 6188 } // namespace
6190 } // namespace cc 6189 } // namespace cc
OLDNEW
« cc/tiles/tile_manager_unittest.cc ('K') | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698