| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 task->DidComplete(); | 64 task->DidComplete(); |
| 65 | 65 |
| 66 task->RunReplyOnOriginThread(); | 66 task->RunReplyOnOriginThread(); |
| 67 } | 67 } |
| 68 completed_tasks_.clear(); | 68 completed_tasks_.clear(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Overridden from RasterizerTaskClient: | 71 // Overridden from RasterizerTaskClient: |
| 72 virtual scoped_ptr<RasterBuffer> AcquireBufferForRaster( | 72 virtual scoped_ptr<RasterBuffer> AcquireBufferForRaster( |
| 73 const Resource* resource) OVERRIDE { | 73 const Resource* resource) OVERRIDE { |
| 74 return nullptr; | 74 return scoped_ptr<RasterBuffer>(); |
| 75 } | 75 } |
| 76 virtual void ReleaseBufferForRaster( | 76 virtual void ReleaseBufferForRaster( |
| 77 scoped_ptr<RasterBuffer> buffer) OVERRIDE {} | 77 scoped_ptr<RasterBuffer> buffer) OVERRIDE {} |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 RasterTask::Vector completed_tasks_; | 80 RasterTask::Vector completed_tasks_; |
| 81 }; | 81 }; |
| 82 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = | 82 base::LazyInstance<FakeRasterizerImpl> g_fake_rasterizer = |
| 83 LAZY_INSTANCE_INITIALIZER; | 83 LAZY_INSTANCE_INITIALIZER; |
| 84 | 84 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 112 host_impl_.tile_manager()->SetGlobalStateForTesting(state); | 112 host_impl_.tile_manager()->SetGlobalStateForTesting(state); |
| 113 } | 113 } |
| 114 | 114 |
| 115 virtual void SetUp() OVERRIDE { | 115 virtual void SetUp() OVERRIDE { |
| 116 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); | 116 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); |
| 117 InitializeRenderer(); | 117 InitializeRenderer(); |
| 118 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 118 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
| 119 } | 119 } |
| 120 | 120 |
| 121 virtual void InitializeRenderer() { | 121 virtual void InitializeRenderer() { |
| 122 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass()); | 122 host_impl_.InitializeRenderer( |
| 123 FakeOutputSurface::Create3d().PassAs<OutputSurface>()); |
| 123 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer()); | 124 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer()); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void SetupDefaultTrees(const gfx::Size& layer_bounds) { | 127 void SetupDefaultTrees(const gfx::Size& layer_bounds) { |
| 127 gfx::Size tile_size(100, 100); | 128 gfx::Size tile_size(100, 100); |
| 128 | 129 |
| 129 scoped_refptr<FakePicturePileImpl> pending_pile = | 130 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 130 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 131 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 131 scoped_refptr<FakePicturePileImpl> active_pile = | 132 scoped_refptr<FakePicturePileImpl> active_pile = |
| 132 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 133 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 158 | 159 |
| 159 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) { | 160 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) { |
| 160 host_impl_.CreatePendingTree(); | 161 host_impl_.CreatePendingTree(); |
| 161 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | 162 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); |
| 162 // Clear recycled tree. | 163 // Clear recycled tree. |
| 163 pending_tree->DetachLayerTree(); | 164 pending_tree->DetachLayerTree(); |
| 164 | 165 |
| 165 scoped_ptr<FakePictureLayerImpl> pending_layer = | 166 scoped_ptr<FakePictureLayerImpl> pending_layer = |
| 166 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); | 167 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); |
| 167 pending_layer->SetDrawsContent(true); | 168 pending_layer->SetDrawsContent(true); |
| 168 pending_tree->SetRootLayer(pending_layer.Pass()); | 169 pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); |
| 169 | 170 |
| 170 pending_root_layer_ = static_cast<FakePictureLayerImpl*>( | 171 pending_root_layer_ = static_cast<FakePictureLayerImpl*>( |
| 171 host_impl_.pending_tree()->LayerById(id_)); | 172 host_impl_.pending_tree()->LayerById(id_)); |
| 172 pending_root_layer_->DoPostCommitInitializationIfNeeded(); | 173 pending_root_layer_->DoPostCommitInitializationIfNeeded(); |
| 173 } | 174 } |
| 174 | 175 |
| 175 void CreateHighLowResAndSetAllTilesVisible() { | 176 void CreateHighLowResAndSetAllTilesVisible() { |
| 176 // Active layer must get updated first so pending layer can share from it. | 177 // Active layer must get updated first so pending layer can share from it. |
| 177 active_root_layer_->CreateDefaultTilingsAndTiles(); | 178 active_root_layer_->CreateDefaultTilingsAndTiles(); |
| 178 active_root_layer_->SetAllTilesVisible(); | 179 active_root_layer_->SetAllTilesVisible(); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 layers.push_back(pending_root_layer_); | 355 layers.push_back(pending_root_layer_); |
| 355 int next_id = id_ + 1; | 356 int next_id = id_ + 1; |
| 356 | 357 |
| 357 // Create the rest of the layers as children of the root layer. | 358 // Create the rest of the layers as children of the root layer. |
| 358 while (static_cast<int>(layers.size()) < layer_count) { | 359 while (static_cast<int>(layers.size()) < layer_count) { |
| 359 scoped_ptr<FakePictureLayerImpl> layer = | 360 scoped_ptr<FakePictureLayerImpl> layer = |
| 360 FakePictureLayerImpl::CreateWithPile( | 361 FakePictureLayerImpl::CreateWithPile( |
| 361 host_impl_.pending_tree(), next_id, picture_pile_); | 362 host_impl_.pending_tree(), next_id, picture_pile_); |
| 362 layer->SetBounds(layer_bounds); | 363 layer->SetBounds(layer_bounds); |
| 363 layers.push_back(layer.get()); | 364 layers.push_back(layer.get()); |
| 364 pending_root_layer_->AddChild(layer.Pass()); | 365 pending_root_layer_->AddChild(layer.PassAs<LayerImpl>()); |
| 365 | 366 |
| 366 FakePictureLayerImpl* fake_layer = | 367 FakePictureLayerImpl* fake_layer = |
| 367 static_cast<FakePictureLayerImpl*>(layers.back()); | 368 static_cast<FakePictureLayerImpl*>(layers.back()); |
| 368 | 369 |
| 369 fake_layer->SetDrawsContent(true); | 370 fake_layer->SetDrawsContent(true); |
| 370 fake_layer->DoPostCommitInitializationIfNeeded(); | 371 fake_layer->DoPostCommitInitializationIfNeeded(); |
| 371 fake_layer->CreateDefaultTilingsAndTiles(); | 372 fake_layer->CreateDefaultTilingsAndTiles(); |
| 372 ++next_id; | 373 ++next_id; |
| 373 } | 374 } |
| 374 | 375 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 480 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
| 480 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 481 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
| 481 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 482 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
| 482 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 483 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
| 483 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 484 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
| 484 } | 485 } |
| 485 | 486 |
| 486 } // namespace | 487 } // namespace |
| 487 | 488 |
| 488 } // namespace cc | 489 } // namespace cc |
| OLD | NEW |