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

Side by Side Diff: cc/trees/occlusion_tracker_perftest.cc

Issue 608503005: Revert of cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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(FakeOutputSurface::Create3d()); 41 host_impl_->InitializeRenderer(
42 FakeOutputSurface::Create3d().PassAs<OutputSurface>());
42 43
43 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1); 44 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1);
44 active_tree()->SetRootLayer(root_layer.Pass()); 45 active_tree()->SetRootLayer(root_layer.Pass());
45 } 46 }
46 47
47 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); } 48 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); }
48 49
49 void SetTestName(const std::string& name) { test_name_ = name; } 50 void SetTestName(const std::string& name) { test_name_ = name; }
50 51
51 void PrintResults() { 52 void PrintResults() {
(...skipping 26 matching lines...) Expand all
78 CreateHost(); 79 CreateHost();
79 host_impl_->SetViewportSize(viewport_rect.size()); 80 host_impl_->SetViewportSize(viewport_rect.size());
80 81
81 scoped_ptr<SolidColorLayerImpl> opaque_layer = 82 scoped_ptr<SolidColorLayerImpl> opaque_layer =
82 SolidColorLayerImpl::Create(active_tree(), 2); 83 SolidColorLayerImpl::Create(active_tree(), 2);
83 opaque_layer->SetBackgroundColor(SK_ColorRED); 84 opaque_layer->SetBackgroundColor(SK_ColorRED);
84 opaque_layer->SetContentsOpaque(true); 85 opaque_layer->SetContentsOpaque(true);
85 opaque_layer->SetDrawsContent(true); 86 opaque_layer->SetDrawsContent(true);
86 opaque_layer->SetBounds(viewport_rect.size()); 87 opaque_layer->SetBounds(viewport_rect.size());
87 opaque_layer->SetContentBounds(viewport_rect.size()); 88 opaque_layer->SetContentBounds(viewport_rect.size());
88 active_tree()->root_layer()->AddChild(opaque_layer.Pass()); 89 active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>());
89 90
90 active_tree()->UpdateDrawProperties(); 91 active_tree()->UpdateDrawProperties();
91 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 92 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
92 ASSERT_EQ(1u, rsll.size()); 93 ASSERT_EQ(1u, rsll.size());
93 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size()); 94 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size());
94 95
95 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll); 96 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll);
96 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll); 97 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll);
97 98
98 LayerIteratorPosition<LayerImpl> pos = begin; 99 LayerIteratorPosition<LayerImpl> pos = begin;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 scoped_ptr<SolidColorLayerImpl> opaque_layer = 149 scoped_ptr<SolidColorLayerImpl> opaque_layer =
149 SolidColorLayerImpl::Create(active_tree(), 2 + i); 150 SolidColorLayerImpl::Create(active_tree(), 2 + i);
150 opaque_layer->SetBackgroundColor(SK_ColorRED); 151 opaque_layer->SetBackgroundColor(SK_ColorRED);
151 opaque_layer->SetContentsOpaque(true); 152 opaque_layer->SetContentsOpaque(true);
152 opaque_layer->SetDrawsContent(true); 153 opaque_layer->SetDrawsContent(true);
153 opaque_layer->SetBounds( 154 opaque_layer->SetBounds(
154 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2)); 155 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2));
155 opaque_layer->SetContentBounds( 156 opaque_layer->SetContentBounds(
156 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2)); 157 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2));
157 opaque_layer->SetPosition(gfx::Point(i, i)); 158 opaque_layer->SetPosition(gfx::Point(i, i));
158 active_tree()->root_layer()->AddChild(opaque_layer.Pass()); 159 active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>());
159 } 160 }
160 161
161 active_tree()->UpdateDrawProperties(); 162 active_tree()->UpdateDrawProperties();
162 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 163 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
163 ASSERT_EQ(1u, rsll.size()); 164 ASSERT_EQ(1u, rsll.size());
164 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers), 165 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers),
165 rsll[0]->render_surface()->layer_list().size()); 166 rsll[0]->render_surface()->layer_list().size());
166 167
167 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll); 168 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll);
168 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll); 169 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); 201 EXPECT_EQ(active_tree()->root_layer(), next.current_layer);
201 202
202 ++begin; 203 ++begin;
203 EXPECT_EQ(end, begin); 204 EXPECT_EQ(end, begin);
204 205
205 PrintResults(); 206 PrintResults();
206 } 207 }
207 208
208 } // namespace 209 } // namespace
209 } // namespace cc 210 } // 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