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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 state.memory_limit_policy = memory_limit_policy_; | 105 state.memory_limit_policy = memory_limit_policy_; |
106 state.tree_priority = tree_priority; | 106 state.tree_priority = tree_priority; |
107 | 107 |
108 global_state_ = state; | 108 global_state_ = state; |
109 host_impl_.resource_pool()->SetResourceUsageLimits( | 109 host_impl_.resource_pool()->SetResourceUsageLimits( |
110 state.soft_memory_limit_in_bytes, 0, state.num_resources_limit); | 110 state.soft_memory_limit_in_bytes, 0, state.num_resources_limit); |
111 host_impl_.tile_manager()->SetGlobalStateForTesting(state); | 111 host_impl_.tile_manager()->SetGlobalStateForTesting(state); |
112 } | 112 } |
113 | 113 |
114 virtual void SetUp() override { | 114 virtual void SetUp() override { |
115 picture_pile_ = FakePicturePileImpl::CreateInfiniteFilledPile(); | |
116 InitializeRenderer(); | 115 InitializeRenderer(); |
117 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | 116 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); |
118 } | 117 } |
119 | 118 |
120 virtual void InitializeRenderer() { | 119 virtual void InitializeRenderer() { |
121 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass()); | 120 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass()); |
122 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer()); | 121 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer()); |
123 } | 122 } |
124 | 123 |
125 void SetupDefaultTrees(const gfx::Size& layer_bounds) { | 124 void SetupDefaultTrees(const gfx::Size& layer_bounds) { |
126 gfx::Size tile_size(100, 100); | 125 gfx::Size tile_size(100, 100); |
127 | 126 |
127 picture_pile_ = | |
128 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | |
128 scoped_refptr<FakePicturePileImpl> pending_pile = | 129 scoped_refptr<FakePicturePileImpl> pending_pile = |
129 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 130 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
130 scoped_refptr<FakePicturePileImpl> active_pile = | 131 scoped_refptr<FakePicturePileImpl> active_pile = |
131 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 132 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
132 | 133 |
133 SetupTrees(pending_pile, active_pile); | 134 SetupTrees(pending_pile, active_pile); |
134 } | 135 } |
135 | 136 |
136 void ActivateTree() { | 137 void ActivateTree() { |
137 host_impl_.ActivateSyncTree(); | 138 host_impl_.ActivateSyncTree(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 settings_.default_tile_size); | 352 settings_.default_tile_size); |
352 | 353 |
353 active_root_layer_->CreateDefaultTilingsAndTiles(); | 354 active_root_layer_->CreateDefaultTilingsAndTiles(); |
354 pending_root_layer_->CreateDefaultTilingsAndTiles(); | 355 pending_root_layer_->CreateDefaultTilingsAndTiles(); |
355 | 356 |
356 std::vector<LayerImpl*> layers; | 357 std::vector<LayerImpl*> layers; |
357 | 358 |
358 // Pending layer counts as one layer. | 359 // Pending layer counts as one layer. |
359 layers.push_back(pending_root_layer_); | 360 layers.push_back(pending_root_layer_); |
360 int next_id = id_ + 1; | 361 int next_id = id_ + 1; |
361 | 362 |
danakj
2014/11/04 15:39:55
Cool, this looks good. But one thing: how about ju
USE eero AT chromium.org
2014/11/04 16:00:35
Done.
| |
362 // Create the rest of the layers as children of the root layer. | 363 // Create the rest of the layers as children of the root layer. |
363 while (static_cast<int>(layers.size()) < layer_count) { | 364 while (static_cast<int>(layers.size()) < layer_count) { |
364 scoped_ptr<FakePictureLayerImpl> layer = | 365 scoped_ptr<FakePictureLayerImpl> layer = |
365 FakePictureLayerImpl::CreateWithPile( | 366 FakePictureLayerImpl::CreateWithPile( |
366 host_impl_.pending_tree(), next_id, picture_pile_); | 367 host_impl_.pending_tree(), next_id, picture_pile_); |
367 layer->SetBounds(layer_bounds); | 368 layer->SetBounds(layer_bounds); |
368 layers.push_back(layer.get()); | 369 layers.push_back(layer.get()); |
369 pending_root_layer_->AddChild(layer.Pass()); | 370 pending_root_layer_->AddChild(layer.Pass()); |
370 | 371 |
371 FakePictureLayerImpl* fake_layer = | 372 FakePictureLayerImpl* fake_layer = |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
486 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); | 487 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); |
487 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); | 488 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); |
488 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); | 489 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); |
489 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); | 490 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); |
490 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); | 491 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); |
491 } | 492 } |
492 | 493 |
493 } // namespace | 494 } // namespace |
494 | 495 |
495 } // namespace cc | 496 } // namespace cc |
OLD | NEW |