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

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: rebase and update 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
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.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 <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 3752 matching lines...) Expand 10 before | Expand all | Expand 10 after
4926 4925
4927 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 4926 scoped_refptr<Layer> root = Layer::Create(layer_settings());
4928 root->SetBounds(gfx::Size(500, 500)); 4927 root->SetBounds(gfx::Size(500, 500));
4929 4928
4930 scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); 4929 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
4931 pinch->SetBounds(gfx::Size(500, 500)); 4930 pinch->SetBounds(gfx::Size(500, 500));
4932 pinch->SetScrollClipLayerId(root->id()); 4931 pinch->SetScrollClipLayerId(root->id());
4933 pinch->SetIsContainerForFixedPositionLayers(true); 4932 pinch->SetIsContainerForFixedPositionLayers(true);
4934 root->AddChild(pinch); 4933 root->AddChild(pinch);
4935 4934
4936 scoped_ptr<FakePicturePile> pile( 4935 scoped_ptr<FakeDisplayListRecordingSource> recording(
4937 new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 4936 new FakeDisplayListRecordingSource(
4938 LayerTreeSettings().default_tile_grid_size)); 4937 LayerTreeSettings().default_tile_grid_size));
4939 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 4938 recording->SetPlaybackAllowedEvent(&playback_allowed_event_);
4940 scoped_refptr<FakePictureLayer> layer = 4939 scoped_refptr<FakePictureLayer> layer =
4941 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 4940 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
4942 pile.Pass()); 4941 recording.Pass());
4943 layer->SetBounds(gfx::Size(500, 500)); 4942 layer->SetBounds(gfx::Size(500, 500));
4944 layer->SetContentsOpaque(true); 4943 layer->SetContentsOpaque(true);
4945 // Avoid LCD text on the layer so we don't cause extra commits when we 4944 // Avoid LCD text on the layer so we don't cause extra commits when we
4946 // pinch. 4945 // pinch.
4947 pinch->AddChild(layer); 4946 pinch->AddChild(layer);
4948 4947
4949 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 4948 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
4950 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 4949 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
4951 layer_tree_host()->SetRootLayer(root); 4950 layer_tree_host()->SetRootLayer(root);
4952 LayerTreeHostTest::SetupTree(); 4951 LayerTreeHostTest::SetupTree();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
5130 void InitializeSettings(LayerTreeSettings* settings) override { 5129 void InitializeSettings(LayerTreeSettings* settings) override {
5131 settings->gpu_rasterization_forced = true; 5130 settings->gpu_rasterization_forced = true;
5132 } 5131 }
5133 5132
5134 void SetupTree() override { 5133 void SetupTree() override {
5135 client_.set_fill_with_nonsolid_color(true); 5134 client_.set_fill_with_nonsolid_color(true);
5136 5135
5137 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 5136 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5138 root->SetBounds(gfx::Size(500, 500)); 5137 root->SetBounds(gfx::Size(500, 500));
5139 5138
5140 scoped_ptr<FakePicturePile> pile( 5139 scoped_ptr<FakeDisplayListRecordingSource> recording(
5141 new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 5140 new FakeDisplayListRecordingSource(
5142 LayerTreeSettings().default_tile_grid_size)); 5141 LayerTreeSettings().default_tile_grid_size));
5143 scoped_refptr<FakePictureLayer> layer = 5142 scoped_refptr<FakePictureLayer> layer =
5144 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 5143 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5145 pile.Pass()); 5144 recording.Pass());
5146 layer->SetBounds(gfx::Size(500, 500)); 5145 layer->SetBounds(gfx::Size(500, 500));
5147 layer->SetContentsOpaque(true); 5146 layer->SetContentsOpaque(true);
5148 root->AddChild(layer); 5147 root->AddChild(layer);
5149 5148
5150 layer_tree_host()->SetRootLayer(root); 5149 layer_tree_host()->SetRootLayer(root);
5151 LayerTreeHostTest::SetupTree(); 5150 LayerTreeHostTest::SetupTree();
5152 } 5151 }
5153 5152
5154 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5153 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5155 5154
(...skipping 16 matching lines...) Expand all
5172 GpuRasterizationRasterizesBorderTiles() : viewport_size_(1024, 2048) {} 5171 GpuRasterizationRasterizesBorderTiles() : viewport_size_(1024, 2048) {}
5173 5172
5174 void InitializeSettings(LayerTreeSettings* settings) override { 5173 void InitializeSettings(LayerTreeSettings* settings) override {
5175 settings->gpu_rasterization_enabled = true; 5174 settings->gpu_rasterization_enabled = true;
5176 settings->gpu_rasterization_forced = true; 5175 settings->gpu_rasterization_forced = true;
5177 } 5176 }
5178 5177
5179 void SetupTree() override { 5178 void SetupTree() override {
5180 client_.set_fill_with_nonsolid_color(true); 5179 client_.set_fill_with_nonsolid_color(true);
5181 5180
5182 scoped_ptr<FakePicturePile> pile( 5181 scoped_ptr<FakeDisplayListRecordingSource> recording(
5183 new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 5182 new FakeDisplayListRecordingSource(
5184 LayerTreeSettings().default_tile_grid_size)); 5183 LayerTreeSettings().default_tile_grid_size));
5185 scoped_refptr<FakePictureLayer> root = 5184 scoped_refptr<FakePictureLayer> root =
5186 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 5185 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5187 pile.Pass()); 5186 recording.Pass());
5188 root->SetBounds(gfx::Size(10000, 10000)); 5187 root->SetBounds(gfx::Size(10000, 10000));
5189 root->SetContentsOpaque(true); 5188 root->SetContentsOpaque(true);
5190 5189
5191 layer_tree_host()->SetRootLayer(root); 5190 layer_tree_host()->SetRootLayer(root);
5192 LayerTreeHostTest::SetupTree(); 5191 LayerTreeHostTest::SetupTree();
5193 layer_tree_host()->SetViewportSize(viewport_size_); 5192 layer_tree_host()->SetViewportSize(viewport_size_);
5194 } 5193 }
5195 5194
5196 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 5195 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
5197 5196
(...skipping 27 matching lines...) Expand all
5225 5224
5226 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 5225 scoped_refptr<Layer> root = Layer::Create(layer_settings());
5227 root->SetBounds(gfx::Size(500, 500)); 5226 root->SetBounds(gfx::Size(500, 500));
5228 5227
5229 scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); 5228 scoped_refptr<Layer> pinch = Layer::Create(layer_settings());
5230 pinch->SetBounds(gfx::Size(500, 500)); 5229 pinch->SetBounds(gfx::Size(500, 500));
5231 pinch->SetScrollClipLayerId(root->id()); 5230 pinch->SetScrollClipLayerId(root->id());
5232 pinch->SetIsContainerForFixedPositionLayers(true); 5231 pinch->SetIsContainerForFixedPositionLayers(true);
5233 root->AddChild(pinch); 5232 root->AddChild(pinch);
5234 5233
5235 scoped_ptr<FakePicturePile> pile( 5234 scoped_ptr<FakeDisplayListRecordingSource> recording(
5236 new FakePicturePile(LayerTreeSettings().minimum_contents_scale, 5235 new FakeDisplayListRecordingSource(
5237 LayerTreeSettings().default_tile_grid_size)); 5236 LayerTreeSettings().default_tile_grid_size));
5238 pile->SetPlaybackAllowedEvent(&playback_allowed_event_); 5237 recording->SetPlaybackAllowedEvent(&playback_allowed_event_);
5239 scoped_refptr<FakePictureLayer> layer = 5238 scoped_refptr<FakePictureLayer> layer =
5240 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_, 5239 FakePictureLayer::CreateWithRecordingSource(layer_settings(), &client_,
5241 pile.Pass()); 5240 recording.Pass());
5242 layer->SetBounds(gfx::Size(500, 500)); 5241 layer->SetBounds(gfx::Size(500, 500));
5243 layer->SetContentsOpaque(true); 5242 layer->SetContentsOpaque(true);
5244 // Avoid LCD text on the layer so we don't cause extra commits when we 5243 // Avoid LCD text on the layer so we don't cause extra commits when we
5245 // pinch. 5244 // pinch.
5246 pinch->AddChild(layer); 5245 pinch->AddChild(layer);
5247 5246
5248 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch); 5247 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch, pinch);
5249 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 5248 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
5250 layer_tree_host()->SetRootLayer(root); 5249 layer_tree_host()->SetRootLayer(root);
5251 LayerTreeHostTest::SetupTree(); 5250 LayerTreeHostTest::SetupTree();
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
6253 ScrollAndScaleSet scale_info_; 6252 ScrollAndScaleSet scale_info_;
6254 ScrollAndScaleSet no_op_info_; 6253 ScrollAndScaleSet no_op_info_;
6255 bool requested_update_layers_; 6254 bool requested_update_layers_;
6256 int commit_count_; 6255 int commit_count_;
6257 }; 6256 };
6258 6257
6259 MULTI_THREAD_TEST_F(LayerTreeHostScrollingAndScalingUpdatesLayers); 6258 MULTI_THREAD_TEST_F(LayerTreeHostScrollingAndScalingUpdatesLayers);
6260 6259
6261 } // namespace 6260 } // namespace
6262 } // namespace cc 6261 } // namespace cc
OLDNEW
« no previous file with comments | « 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