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

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

Issue 156603005: cc: Clean up iterator template to only take 1 parameter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iteratorcleanup: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_impl.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/layers/layer_iterator.h" 8 #include "cc/layers/layer_iterator.h"
9 #include "cc/layers/solid_color_layer_impl.h" 9 #include "cc/layers/solid_color_layer_impl.h"
10 #include "cc/test/fake_layer_tree_host_impl_client.h" 10 #include "cc/test/fake_layer_tree_host_impl_client.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 opaque_layer->SetDrawsContent(true); 84 opaque_layer->SetDrawsContent(true);
85 opaque_layer->SetBounds(viewport_rect.size()); 85 opaque_layer->SetBounds(viewport_rect.size());
86 opaque_layer->SetContentBounds(viewport_rect.size()); 86 opaque_layer->SetContentBounds(viewport_rect.size());
87 active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>()); 87 active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>());
88 88
89 active_tree()->UpdateDrawProperties(); 89 active_tree()->UpdateDrawProperties();
90 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 90 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
91 ASSERT_EQ(1u, rsll.size()); 91 ASSERT_EQ(1u, rsll.size());
92 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size()); 92 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size());
93 93
94 typedef LayerIterator<LayerImpl, 94 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll);
95 LayerImpl::LayerListType, 95 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll);
96 LayerImpl::RenderSurfaceType,
97 LayerIteratorActions::FrontToBack> IteratorType;
98 IteratorType begin = IteratorType::Begin(&rsll);
99 IteratorType end = IteratorType::End(&rsll);
100 96
101 LayerIteratorPosition<LayerImpl> pos = begin; 97 LayerIteratorPosition<LayerImpl> pos = begin;
102 98
103 // The opaque_layer adds occlusion over the whole viewport. 99 // The opaque_layer adds occlusion over the whole viewport.
104 tracker.EnterLayer(pos); 100 tracker.EnterLayer(pos);
105 tracker.LeaveLayer(pos); 101 tracker.LeaveLayer(pos);
106 102
107 gfx::Transform transform_to_target; 103 gfx::Transform transform_to_target;
108 transform_to_target.Translate(0, 96); 104 transform_to_target.Translate(0, 96);
109 bool impl_draw_transform_is_unknown = false; 105 bool impl_draw_transform_is_unknown = false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 opaque_layer->SetPosition(gfx::Point(i, i)); 159 opaque_layer->SetPosition(gfx::Point(i, i));
164 active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>()); 160 active_tree()->root_layer()->AddChild(opaque_layer.PassAs<LayerImpl>());
165 } 161 }
166 162
167 active_tree()->UpdateDrawProperties(); 163 active_tree()->UpdateDrawProperties();
168 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 164 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
169 ASSERT_EQ(1u, rsll.size()); 165 ASSERT_EQ(1u, rsll.size());
170 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers), 166 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers),
171 rsll[0]->render_surface()->layer_list().size()); 167 rsll[0]->render_surface()->layer_list().size());
172 168
173 typedef LayerIterator<LayerImpl, 169 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll);
174 LayerImpl::LayerListType, 170 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll);
175 LayerImpl::RenderSurfaceType,
176 LayerIteratorActions::FrontToBack> IteratorType;
177 IteratorType begin = IteratorType::Begin(&rsll);
178 IteratorType end = IteratorType::End(&rsll);
179 171
180 // The opaque_layers add occlusion. 172 // The opaque_layers add occlusion.
181 for (int i = 0; i < kNumOpaqueLayers - 1; ++i) { 173 for (int i = 0; i < kNumOpaqueLayers - 1; ++i) {
182 LayerIteratorPosition<LayerImpl> pos = begin; 174 LayerIteratorPosition<LayerImpl> pos = begin;
183 tracker.EnterLayer(pos); 175 tracker.EnterLayer(pos);
184 tracker.LeaveLayer(pos); 176 tracker.LeaveLayer(pos);
185 ++begin; 177 ++begin;
186 } 178 }
187 LayerIteratorPosition<LayerImpl> pos = begin; 179 LayerIteratorPosition<LayerImpl> pos = begin;
188 tracker.EnterLayer(pos); 180 tracker.EnterLayer(pos);
(...skipping 23 matching lines...) Expand all
212 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); 204 EXPECT_EQ(active_tree()->root_layer(), next.current_layer);
213 205
214 ++begin; 206 ++begin;
215 EXPECT_EQ(end, begin); 207 EXPECT_EQ(end, begin);
216 208
217 PrintResults(); 209 PrintResults();
218 } 210 }
219 211
220 } // namespace 212 } // namespace
221 } // namespace cc 213 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698