| 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::CreateWithRasterSource(pending_tree, id_, pile); | 162 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, pile, |
| 163 false); |
| 163 pending_layer->SetDrawsContent(true); | 164 pending_layer->SetDrawsContent(true); |
| 164 pending_tree->SetRootLayer(pending_layer.Pass()); | 165 pending_tree->SetRootLayer(pending_layer.Pass()); |
| 165 | 166 |
| 166 pending_root_layer_ = static_cast<FakePictureLayerImpl*>( | 167 pending_root_layer_ = static_cast<FakePictureLayerImpl*>( |
| 167 host_impl_.pending_tree()->LayerById(id_)); | 168 host_impl_.pending_tree()->LayerById(id_)); |
| 168 pending_root_layer_->DoPostCommitInitializationIfNeeded(); | 169 pending_root_layer_->DoPostCommitInitializationIfNeeded(); |
| 169 } | 170 } |
| 170 | 171 |
| 171 void CreateHighLowResAndSetAllTilesVisible() { | 172 void CreateHighLowResAndSetAllTilesVisible() { |
| 172 // Active layer must get updated first so pending layer can share from it. | 173 // Active layer must get updated first so pending layer can share from it. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 // Pending layer counts as one layer. | 356 // Pending layer counts as one layer. |
| 356 layers.push_back(pending_root_layer_); | 357 layers.push_back(pending_root_layer_); |
| 357 int next_id = id_ + 1; | 358 int next_id = id_ + 1; |
| 358 | 359 |
| 359 // Create the rest of the layers as children of the root layer. | 360 // Create the rest of the layers as children of the root layer. |
| 360 scoped_refptr<FakePicturePileImpl> pile = | 361 scoped_refptr<FakePicturePileImpl> pile = |
| 361 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); | 362 FakePicturePileImpl::CreateFilledPile(kDefaultTileSize, layer_bounds); |
| 362 while (static_cast<int>(layers.size()) < layer_count) { | 363 while (static_cast<int>(layers.size()) < layer_count) { |
| 363 scoped_ptr<FakePictureLayerImpl> layer = | 364 scoped_ptr<FakePictureLayerImpl> layer = |
| 364 FakePictureLayerImpl::CreateWithRasterSource( | 365 FakePictureLayerImpl::CreateWithRasterSource( |
| 365 host_impl_.pending_tree(), next_id, pile); | 366 host_impl_.pending_tree(), next_id, pile, false); |
| 366 layer->SetBounds(layer_bounds); | 367 layer->SetBounds(layer_bounds); |
| 367 layers.push_back(layer.get()); | 368 layers.push_back(layer.get()); |
| 368 pending_root_layer_->AddChild(layer.Pass()); | 369 pending_root_layer_->AddChild(layer.Pass()); |
| 369 | 370 |
| 370 FakePictureLayerImpl* fake_layer = | 371 FakePictureLayerImpl* fake_layer = |
| 371 static_cast<FakePictureLayerImpl*>(layers.back()); | 372 static_cast<FakePictureLayerImpl*>(layers.back()); |
| 372 | 373 |
| 373 fake_layer->SetDrawsContent(true); | 374 fake_layer->SetDrawsContent(true); |
| 374 fake_layer->DoPostCommitInitializationIfNeeded(); | 375 fake_layer->DoPostCommitInitializationIfNeeded(); |
| 375 fake_layer->CreateDefaultTilingsAndTiles(); | 376 fake_layer->CreateDefaultTilingsAndTiles(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 490 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 490 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 491 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 491 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 492 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 492 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 493 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 493 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 494 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 494 } | 495 } |
| 495 | 496 |
| 496 } // namespace | 497 } // namespace |
| 497 | 498 |
| 498 } // namespace cc | 499 } // namespace cc |
| OLD | NEW |