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 "base/time/time.h" | 5 #include "base/time/time.h" |
6 #include "cc/debug/lap_timer.h" | 6 #include "cc/debug/lap_timer.h" |
7 #include "cc/resources/raster_buffer.h" | 7 #include "cc/resources/raster_buffer.h" |
8 #include "cc/resources/tile.h" | 8 #include "cc/resources/tile.h" |
9 #include "cc/resources/tile_priority.h" | 9 #include "cc/resources/tile_priority.h" |
10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 SetupPendingTree(pending_pile); | 152 SetupPendingTree(pending_pile); |
153 } | 153 } |
154 | 154 |
155 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) { | 155 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) { |
156 host_impl_.CreatePendingTree(); | 156 host_impl_.CreatePendingTree(); |
157 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | 157 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); |
158 // Clear recycled tree. | 158 // Clear recycled tree. |
159 pending_tree->DetachLayerTree(); | 159 pending_tree->DetachLayerTree(); |
160 | 160 |
161 scoped_ptr<FakePictureLayerImpl> pending_layer = | 161 scoped_ptr<FakePictureLayerImpl> pending_layer = |
162 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); | 162 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, pile); |
163 pending_layer->SetDrawsContent(true); | 163 pending_layer->SetDrawsContent(true); |
164 pending_tree->SetRootLayer(pending_layer.Pass()); | 164 pending_tree->SetRootLayer(pending_layer.Pass()); |
165 | 165 |
166 pending_root_layer_ = static_cast<FakePictureLayerImpl*>( | 166 pending_root_layer_ = static_cast<FakePictureLayerImpl*>( |
167 host_impl_.pending_tree()->LayerById(id_)); | 167 host_impl_.pending_tree()->LayerById(id_)); |
168 pending_root_layer_->DoPostCommitInitializationIfNeeded(); | 168 pending_root_layer_->DoPostCommitInitializationIfNeeded(); |
169 } | 169 } |
170 | 170 |
171 void CreateHighLowResAndSetAllTilesVisible() { | 171 void CreateHighLowResAndSetAllTilesVisible() { |
172 // Active layer must get updated first so pending layer can share from it. | 172 // Active layer must get updated first so pending layer can share from it. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 354 |
355 // Pending layer counts as one layer. | 355 // Pending layer counts as one layer. |
356 layers.push_back(pending_root_layer_); | 356 layers.push_back(pending_root_layer_); |
357 int next_id = id_ + 1; | 357 int next_id = id_ + 1; |
358 | 358 |
359 // Create the rest of the layers as children of the root layer. | 359 // Create the rest of the layers as children of the root layer. |
360 scoped_refptr<FakePicturePileImpl> pile = | 360 scoped_refptr<FakePicturePileImpl> pile = |
361 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); | 361 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); |
362 while (static_cast<int>(layers.size()) < layer_count) { | 362 while (static_cast<int>(layers.size()) < layer_count) { |
363 scoped_ptr<FakePictureLayerImpl> layer = | 363 scoped_ptr<FakePictureLayerImpl> layer = |
364 FakePictureLayerImpl::CreateWithPile(host_impl_.pending_tree(), | 364 FakePictureLayerImpl::CreateWithRasterSource( |
365 next_id, pile); | 365 host_impl_.pending_tree(), next_id, pile); |
366 layer->SetBounds(layer_bounds); | 366 layer->SetBounds(layer_bounds); |
367 layers.push_back(layer.get()); | 367 layers.push_back(layer.get()); |
368 pending_root_layer_->AddChild(layer.Pass()); | 368 pending_root_layer_->AddChild(layer.Pass()); |
369 | 369 |
370 FakePictureLayerImpl* fake_layer = | 370 FakePictureLayerImpl* fake_layer = |
371 static_cast<FakePictureLayerImpl*>(layers.back()); | 371 static_cast<FakePictureLayerImpl*>(layers.back()); |
372 | 372 |
373 fake_layer->SetDrawsContent(true); | 373 fake_layer->SetDrawsContent(true); |
374 fake_layer->DoPostCommitInitializationIfNeeded(); | 374 fake_layer->DoPostCommitInitializationIfNeeded(); |
375 fake_layer->CreateDefaultTilingsAndTiles(); | 375 fake_layer->CreateDefaultTilingsAndTiles(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 488 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
489 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 489 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
490 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 490 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
491 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 491 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
492 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 492 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
493 } | 493 } |
494 | 494 |
495 } // namespace | 495 } // namespace |
496 | 496 |
497 } // namespace cc | 497 } // namespace cc |
OLD | NEW |