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

Side by Side Diff: cc/resources/tile_manager_perftest.cc

Issue 609663003: cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc-passas: PassAs-presubmit-warning Created 6 years, 2 months 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/resources/texture_mailbox_deleter_unittest.cc ('k') | cc/resources/tile_manager_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 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
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 scoped_ptr<RasterBuffer>(); 74 return nullptr;
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
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( 122 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d().Pass());
123 FakeOutputSurface::Create3d().PassAs<OutputSurface>());
124 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer()); 123 tile_manager()->SetRasterizerForTesting(g_fake_rasterizer.Pointer());
125 } 124 }
126 125
127 void SetupDefaultTrees(const gfx::Size& layer_bounds) { 126 void SetupDefaultTrees(const gfx::Size& layer_bounds) {
128 gfx::Size tile_size(100, 100); 127 gfx::Size tile_size(100, 100);
129 128
130 scoped_refptr<FakePicturePileImpl> pending_pile = 129 scoped_refptr<FakePicturePileImpl> pending_pile =
131 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 130 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
132 scoped_refptr<FakePicturePileImpl> active_pile = 131 scoped_refptr<FakePicturePileImpl> active_pile =
133 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 132 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
(...skipping 25 matching lines...) Expand all
159 158
160 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) { 159 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) {
161 host_impl_.CreatePendingTree(); 160 host_impl_.CreatePendingTree();
162 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); 161 LayerTreeImpl* pending_tree = host_impl_.pending_tree();
163 // Clear recycled tree. 162 // Clear recycled tree.
164 pending_tree->DetachLayerTree(); 163 pending_tree->DetachLayerTree();
165 164
166 scoped_ptr<FakePictureLayerImpl> pending_layer = 165 scoped_ptr<FakePictureLayerImpl> pending_layer =
167 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); 166 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile);
168 pending_layer->SetDrawsContent(true); 167 pending_layer->SetDrawsContent(true);
169 pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); 168 pending_tree->SetRootLayer(pending_layer.Pass());
170 169
171 pending_root_layer_ = static_cast<FakePictureLayerImpl*>( 170 pending_root_layer_ = static_cast<FakePictureLayerImpl*>(
172 host_impl_.pending_tree()->LayerById(id_)); 171 host_impl_.pending_tree()->LayerById(id_));
173 pending_root_layer_->DoPostCommitInitializationIfNeeded(); 172 pending_root_layer_->DoPostCommitInitializationIfNeeded();
174 } 173 }
175 174
176 void CreateHighLowResAndSetAllTilesVisible() { 175 void CreateHighLowResAndSetAllTilesVisible() {
177 // Active layer must get updated first so pending layer can share from it. 176 // Active layer must get updated first so pending layer can share from it.
178 active_root_layer_->CreateDefaultTilingsAndTiles(); 177 active_root_layer_->CreateDefaultTilingsAndTiles();
179 active_root_layer_->SetAllTilesVisible(); 178 active_root_layer_->SetAllTilesVisible();
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 layers.push_back(pending_root_layer_); 354 layers.push_back(pending_root_layer_);
356 int next_id = id_ + 1; 355 int next_id = id_ + 1;
357 356
358 // Create the rest of the layers as children of the root layer. 357 // Create the rest of the layers as children of the root layer.
359 while (static_cast<int>(layers.size()) < layer_count) { 358 while (static_cast<int>(layers.size()) < layer_count) {
360 scoped_ptr<FakePictureLayerImpl> layer = 359 scoped_ptr<FakePictureLayerImpl> layer =
361 FakePictureLayerImpl::CreateWithPile( 360 FakePictureLayerImpl::CreateWithPile(
362 host_impl_.pending_tree(), next_id, picture_pile_); 361 host_impl_.pending_tree(), next_id, picture_pile_);
363 layer->SetBounds(layer_bounds); 362 layer->SetBounds(layer_bounds);
364 layers.push_back(layer.get()); 363 layers.push_back(layer.get());
365 pending_root_layer_->AddChild(layer.PassAs<LayerImpl>()); 364 pending_root_layer_->AddChild(layer.Pass());
366 365
367 FakePictureLayerImpl* fake_layer = 366 FakePictureLayerImpl* fake_layer =
368 static_cast<FakePictureLayerImpl*>(layers.back()); 367 static_cast<FakePictureLayerImpl*>(layers.back());
369 368
370 fake_layer->SetDrawsContent(true); 369 fake_layer->SetDrawsContent(true);
371 fake_layer->DoPostCommitInitializationIfNeeded(); 370 fake_layer->DoPostCommitInitializationIfNeeded();
372 fake_layer->CreateDefaultTilingsAndTiles(); 371 fake_layer->CreateDefaultTilingsAndTiles();
373 ++next_id; 372 ++next_id;
374 } 373 }
375 374
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128); 479 RunEvictionQueueConstructAndIterateTest("10_128", 10, 128);
481 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16); 480 RunEvictionQueueConstructAndIterateTest("50_16", 50, 16);
482 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32); 481 RunEvictionQueueConstructAndIterateTest("50_32", 50, 32);
483 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64); 482 RunEvictionQueueConstructAndIterateTest("50_64", 50, 64);
484 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128); 483 RunEvictionQueueConstructAndIterateTest("50_128", 50, 128);
485 } 484 }
486 485
487 } // namespace 486 } // namespace
488 487
489 } // namespace cc 488 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/texture_mailbox_deleter_unittest.cc ('k') | cc/resources/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698