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

Side by Side Diff: cc/layers/picture_layer_impl_perftest.cc

Issue 742343002: cc: Move LayerRasterTileIterator to a separate file and make it a queue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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/layers/picture_layer_impl.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include "cc/debug/lap_timer.h" 7 #include "cc/debug/lap_timer.h"
8 #include "cc/test/fake_impl_proxy.h" 8 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host_impl.h" 9 #include "cc/test/fake_layer_tree_host_impl.h"
10 #include "cc/test/fake_output_surface.h" 10 #include "cc/test/fake_output_surface.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 scoped_ptr<FakePictureLayerImpl> pending_layer = 60 scoped_ptr<FakePictureLayerImpl> pending_layer =
61 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, 7, pile); 61 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, 7, pile);
62 pending_layer->SetDrawsContent(true); 62 pending_layer->SetDrawsContent(true);
63 pending_tree->SetRootLayer(pending_layer.Pass()); 63 pending_tree->SetRootLayer(pending_layer.Pass());
64 64
65 pending_layer_ = static_cast<FakePictureLayerImpl*>( 65 pending_layer_ = static_cast<FakePictureLayerImpl*>(
66 host_impl_.pending_tree()->LayerById(7)); 66 host_impl_.pending_tree()->LayerById(7));
67 pending_layer_->DoPostCommitInitializationIfNeeded(); 67 pending_layer_->DoPostCommitInitializationIfNeeded();
68 } 68 }
69 69
70 void RunRasterIteratorConstructAndIterateTest( 70 void RunRasterQueueConstructAndIterateTest(const std::string& test_name,
71 const std::string& test_name, 71 int num_tiles,
72 int num_tiles, 72 const gfx::Size& viewport_size) {
73 const gfx::Size& viewport_size) {
74 host_impl_.SetViewportSize(viewport_size); 73 host_impl_.SetViewportSize(viewport_size);
75 host_impl_.pending_tree()->UpdateDrawProperties(); 74 host_impl_.pending_tree()->UpdateDrawProperties();
76 75
77 timer_.Reset(); 76 timer_.Reset();
78 do { 77 do {
79 int count = num_tiles; 78 int count = num_tiles;
80 PictureLayerImpl::LayerRasterTileIterator it(pending_layer_, false); 79 scoped_ptr<TilingSetRasterQueue> queue =
80 pending_layer_->CreateRasterQueue(false);
81 while (count--) { 81 while (count--) {
82 ASSERT_TRUE(it) << "count: " << count; 82 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count;
83 ASSERT_TRUE(*it != nullptr) << "count: " << count; 83 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count;
84 ++it; 84 queue->Pop();
85 } 85 }
86 timer_.NextLap(); 86 timer_.NextLap();
87 } while (!timer_.HasTimeLimitExpired()); 87 } while (!timer_.HasTimeLimitExpired());
88 88
89 perf_test::PrintResult("layer_raster_tile_iterator_construct_and_iterate", 89 perf_test::PrintResult("layer_raster_tile_iterator_construct_and_iterate",
90 "", 90 "",
91 test_name, 91 test_name,
92 timer_.LapsPerSecond(), 92 timer_.LapsPerSecond(),
93 "runs/s", 93 "runs/s",
94 true); 94 true);
95 } 95 }
96 96
97 void RunRasterIteratorConstructTest(const std::string& test_name, 97 void RunRasterQueueConstructTest(const std::string& test_name,
98 const gfx::Rect& viewport) { 98 const gfx::Rect& viewport) {
99 host_impl_.SetViewportSize(viewport.size()); 99 host_impl_.SetViewportSize(viewport.size());
100 pending_layer_->SetScrollOffset( 100 pending_layer_->SetScrollOffset(
101 gfx::ScrollOffset(viewport.x(), viewport.y())); 101 gfx::ScrollOffset(viewport.x(), viewport.y()));
102 host_impl_.pending_tree()->UpdateDrawProperties(); 102 host_impl_.pending_tree()->UpdateDrawProperties();
103 103
104 timer_.Reset(); 104 timer_.Reset();
105 do { 105 do {
106 PictureLayerImpl::LayerRasterTileIterator it(pending_layer_, false); 106 scoped_ptr<TilingSetRasterQueue> queue =
107 pending_layer_->CreateRasterQueue(false);
107 timer_.NextLap(); 108 timer_.NextLap();
108 } while (!timer_.HasTimeLimitExpired()); 109 } while (!timer_.HasTimeLimitExpired());
109 110
110 perf_test::PrintResult("layer_raster_tile_iterator_construct", 111 perf_test::PrintResult("layer_raster_tile_iterator_construct",
111 "", 112 "",
112 test_name, 113 test_name,
113 timer_.LapsPerSecond(), 114 timer_.LapsPerSecond(),
114 "runs/s", 115 "runs/s",
115 true); 116 true);
116 } 117 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 TestSharedBitmapManager shared_bitmap_manager_; 180 TestSharedBitmapManager shared_bitmap_manager_;
180 FakeImplProxy proxy_; 181 FakeImplProxy proxy_;
181 FakeLayerTreeHostImpl host_impl_; 182 FakeLayerTreeHostImpl host_impl_;
182 FakePictureLayerImpl* pending_layer_; 183 FakePictureLayerImpl* pending_layer_;
183 LapTimer timer_; 184 LapTimer timer_;
184 185
185 private: 186 private:
186 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest); 187 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplPerfTest);
187 }; 188 };
188 189
190 // TODO(vmpstr): Rename these tests once the perf numbers are in.
189 TEST_F(PictureLayerImplPerfTest, LayerRasterTileIteratorConstructAndIterate) { 191 TEST_F(PictureLayerImplPerfTest, LayerRasterTileIteratorConstructAndIterate) {
190 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); 192 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
191 193
192 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 194 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
193 195
194 pending_layer_->AddTiling(low_res_factor); 196 pending_layer_->AddTiling(low_res_factor);
195 pending_layer_->AddTiling(0.3f); 197 pending_layer_->AddTiling(0.3f);
196 pending_layer_->AddTiling(0.7f); 198 pending_layer_->AddTiling(0.7f);
197 pending_layer_->AddTiling(1.0f); 199 pending_layer_->AddTiling(1.0f);
198 pending_layer_->AddTiling(2.0f); 200 pending_layer_->AddTiling(2.0f);
199 201
200 RunRasterIteratorConstructAndIterateTest( 202 RunRasterQueueConstructAndIterateTest("32_100x100", 32, gfx::Size(100, 100));
201 "32_100x100", 32, gfx::Size(100, 100)); 203 RunRasterQueueConstructAndIterateTest("32_500x500", 32, gfx::Size(500, 500));
202 RunRasterIteratorConstructAndIterateTest( 204 RunRasterQueueConstructAndIterateTest("64_100x100", 64, gfx::Size(100, 100));
203 "32_500x500", 32, gfx::Size(500, 500)); 205 RunRasterQueueConstructAndIterateTest("64_500x500", 64, gfx::Size(500, 500));
204 RunRasterIteratorConstructAndIterateTest(
205 "64_100x100", 64, gfx::Size(100, 100));
206 RunRasterIteratorConstructAndIterateTest(
207 "64_500x500", 64, gfx::Size(500, 500));
208 } 206 }
209 207
208 // TODO(vmpstr): Rename these tests once the perf numbers are in.
210 TEST_F(PictureLayerImplPerfTest, LayerRasterTileIteratorConstruct) { 209 TEST_F(PictureLayerImplPerfTest, LayerRasterTileIteratorConstruct) {
211 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); 210 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
212 211
213 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 212 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
214 213
215 pending_layer_->AddTiling(low_res_factor); 214 pending_layer_->AddTiling(low_res_factor);
216 pending_layer_->AddTiling(0.3f); 215 pending_layer_->AddTiling(0.3f);
217 pending_layer_->AddTiling(0.7f); 216 pending_layer_->AddTiling(0.7f);
218 pending_layer_->AddTiling(1.0f); 217 pending_layer_->AddTiling(1.0f);
219 pending_layer_->AddTiling(2.0f); 218 pending_layer_->AddTiling(2.0f);
220 219
221 RunRasterIteratorConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); 220 RunRasterQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
222 RunRasterIteratorConstructTest("5000_0_100x100", 221 RunRasterQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100));
223 gfx::Rect(5000, 0, 100, 100)); 222 RunRasterQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100));
224 RunRasterIteratorConstructTest("9999_0_100x100",
225 gfx::Rect(9999, 0, 100, 100));
226 } 223 }
227 224
228 // TODO(e_hakkinen): Rename these tests once the perf numbers are in. 225 // TODO(e_hakkinen): Rename these tests once the perf numbers are in.
229 TEST_F(PictureLayerImplPerfTest, LayerEvictionTileIteratorConstructAndIterate) { 226 TEST_F(PictureLayerImplPerfTest, LayerEvictionTileIteratorConstructAndIterate) {
230 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256)); 227 SetupPendingTree(gfx::Size(10000, 10000), gfx::Size(256, 256));
231 228
232 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; 229 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor;
233 230
234 std::vector<Tile*> all_tiles; 231 std::vector<Tile*> all_tiles;
235 AddTiling(low_res_factor, pending_layer_, &all_tiles); 232 AddTiling(low_res_factor, pending_layer_, &all_tiles);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); 264 ASSERT_TRUE(host_impl_.tile_manager() != nullptr);
268 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); 265 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles);
269 266
270 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); 267 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100));
271 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); 268 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100));
272 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); 269 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100));
273 } 270 }
274 271
275 } // namespace 272 } // namespace
276 } // namespace cc 273 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.cc ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698