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

Side by Side Diff: cc/trees/occlusion_tracker_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/trees/layer_tree_impl_unittest.cc ('k') | cc/trees/occlusion_tracker_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/trees/occlusion_tracker.h" 5 #include "cc/trees/occlusion_tracker.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "cc/debug/lap_timer.h" 8 #include "cc/debug/lap_timer.h"
9 #include "cc/layers/layer_iterator.h" 9 #include "cc/layers/layer_iterator.h"
10 #include "cc/layers/solid_color_layer_impl.h" 10 #include "cc/layers/solid_color_layer_impl.h"
(...skipping 20 matching lines...) Expand all
31 OcclusionTrackerPerfTest() 31 OcclusionTrackerPerfTest()
32 : timer_(kWarmupRuns, 32 : timer_(kWarmupRuns,
33 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 33 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
34 kTimeCheckInterval), 34 kTimeCheckInterval),
35 impl_(&proxy_) {} 35 impl_(&proxy_) {}
36 void CreateHost() { 36 void CreateHost() {
37 LayerTreeSettings settings; 37 LayerTreeSettings settings;
38 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); 38 shared_bitmap_manager_.reset(new TestSharedBitmapManager());
39 host_impl_ = LayerTreeHostImpl::Create( 39 host_impl_ = LayerTreeHostImpl::Create(
40 settings, &client_, &proxy_, &stats_, shared_bitmap_manager_.get(), 1); 40 settings, &client_, &proxy_, &stats_, shared_bitmap_manager_.get(), 1);
41 host_impl_->InitializeRenderer( 41 host_impl_->InitializeRenderer(FakeOutputSurface::Create3d());
42 FakeOutputSurface::Create3d().PassAs<OutputSurface>());
43 42
44 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1); 43 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1);
45 active_tree()->SetRootLayer(root_layer.Pass()); 44 active_tree()->SetRootLayer(root_layer.Pass());
46 } 45 }
47 46
48 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); } 47 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); }
49 48
50 void SetTestName(const std::string& name) { test_name_ = name; } 49 void SetTestName(const std::string& name) { test_name_ = name; }
51 50
52 void PrintResults() { 51 void PrintResults() {
(...skipping 26 matching lines...) Expand all
79 CreateHost(); 78 CreateHost();
80 host_impl_->SetViewportSize(viewport_rect.size()); 79 host_impl_->SetViewportSize(viewport_rect.size());
81 80
82 scoped_ptr<SolidColorLayerImpl> opaque_layer = 81 scoped_ptr<SolidColorLayerImpl> opaque_layer =
83 SolidColorLayerImpl::Create(active_tree(), 2); 82 SolidColorLayerImpl::Create(active_tree(), 2);
84 opaque_layer->SetBackgroundColor(SK_ColorRED); 83 opaque_layer->SetBackgroundColor(SK_ColorRED);
85 opaque_layer->SetContentsOpaque(true); 84 opaque_layer->SetContentsOpaque(true);
86 opaque_layer->SetDrawsContent(true); 85 opaque_layer->SetDrawsContent(true);
87 opaque_layer->SetBounds(viewport_rect.size()); 86 opaque_layer->SetBounds(viewport_rect.size());
88 opaque_layer->SetContentBounds(viewport_rect.size()); 87 opaque_layer->SetContentBounds(viewport_rect.size());
89 active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>()); 88 active_tree()->root_layer()->AddChild(opaque_layer.Pass());
90 89
91 active_tree()->UpdateDrawProperties(); 90 active_tree()->UpdateDrawProperties();
92 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 91 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
93 ASSERT_EQ(1u, rsll.size()); 92 ASSERT_EQ(1u, rsll.size());
94 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size()); 93 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size());
95 94
96 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll); 95 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll);
97 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll); 96 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll);
98 97
99 LayerIteratorPosition<LayerImpl> pos = begin; 98 LayerIteratorPosition<LayerImpl> pos = begin;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 scoped_ptr<SolidColorLayerImpl> opaque_layer = 148 scoped_ptr<SolidColorLayerImpl> opaque_layer =
150 SolidColorLayerImpl::Create(active_tree(), 2 + i); 149 SolidColorLayerImpl::Create(active_tree(), 2 + i);
151 opaque_layer->SetBackgroundColor(SK_ColorRED); 150 opaque_layer->SetBackgroundColor(SK_ColorRED);
152 opaque_layer->SetContentsOpaque(true); 151 opaque_layer->SetContentsOpaque(true);
153 opaque_layer->SetDrawsContent(true); 152 opaque_layer->SetDrawsContent(true);
154 opaque_layer->SetBounds( 153 opaque_layer->SetBounds(
155 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2)); 154 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2));
156 opaque_layer->SetContentBounds( 155 opaque_layer->SetContentBounds(
157 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2)); 156 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2));
158 opaque_layer->SetPosition(gfx::Point(i, i)); 157 opaque_layer->SetPosition(gfx::Point(i, i));
159 active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>()); 158 active_tree()->root_layer()->AddChild(opaque_layer.Pass());
160 } 159 }
161 160
162 active_tree()->UpdateDrawProperties(); 161 active_tree()->UpdateDrawProperties();
163 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 162 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
164 ASSERT_EQ(1u, rsll.size()); 163 ASSERT_EQ(1u, rsll.size());
165 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers), 164 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers),
166 rsll[0]->render_surface()->layer_list().size()); 165 rsll[0]->render_surface()->layer_list().size());
167 166
168 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll); 167 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll);
169 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll); 168 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); 200 EXPECT_EQ(active_tree()->root_layer(), next.current_layer);
202 201
203 ++begin; 202 ++begin;
204 EXPECT_EQ(end, begin); 203 EXPECT_EQ(end, begin);
205 204
206 PrintResults(); 205 PrintResults();
207 } 206 }
208 207
209 } // namespace 208 } // namespace
210 } // namespace cc 209 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl_unittest.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698