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

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

Issue 2032303004: cc : Add layer_list to LayerTreeImpl and build it for tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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') | no next file » | 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 CreateHost(); 86 CreateHost();
87 host_impl_->SetViewportSize(viewport_rect.size()); 87 host_impl_->SetViewportSize(viewport_rect.size());
88 88
89 std::unique_ptr<SolidColorLayerImpl> opaque_layer = 89 std::unique_ptr<SolidColorLayerImpl> opaque_layer =
90 SolidColorLayerImpl::Create(active_tree(), 2); 90 SolidColorLayerImpl::Create(active_tree(), 2);
91 opaque_layer->SetBackgroundColor(SK_ColorRED); 91 opaque_layer->SetBackgroundColor(SK_ColorRED);
92 opaque_layer->SetContentsOpaque(true); 92 opaque_layer->SetContentsOpaque(true);
93 opaque_layer->SetDrawsContent(true); 93 opaque_layer->SetDrawsContent(true);
94 opaque_layer->SetBounds(viewport_rect.size()); 94 opaque_layer->SetBounds(viewport_rect.size());
95 active_tree()->root_layer()->AddChild(std::move(opaque_layer)); 95 active_tree()->root_layer()->AddChild(std::move(opaque_layer));
96 active_tree()->BuildPropertyTreesForTesting(); 96 active_tree()->BuildLayerListAndPropertyTreesForTesting();
97 97
98 bool update_lcd_text = false; 98 bool update_lcd_text = false;
99 active_tree()->UpdateDrawProperties(update_lcd_text); 99 active_tree()->UpdateDrawProperties(update_lcd_text);
100 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 100 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
101 ASSERT_EQ(1u, rsll.size()); 101 ASSERT_EQ(1u, rsll.size());
102 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size()); 102 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size());
103 103
104 LayerIterator begin = LayerIterator::Begin(&rsll); 104 LayerIterator begin = LayerIterator::Begin(&rsll);
105 LayerIterator end = LayerIterator::End(&rsll); 105 LayerIterator end = LayerIterator::End(&rsll);
106 106
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 SolidColorLayerImpl::Create(active_tree(), 2 + i); 158 SolidColorLayerImpl::Create(active_tree(), 2 + i);
159 opaque_layer->SetBackgroundColor(SK_ColorRED); 159 opaque_layer->SetBackgroundColor(SK_ColorRED);
160 opaque_layer->SetContentsOpaque(true); 160 opaque_layer->SetContentsOpaque(true);
161 opaque_layer->SetDrawsContent(true); 161 opaque_layer->SetDrawsContent(true);
162 opaque_layer->SetBounds( 162 opaque_layer->SetBounds(
163 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2)); 163 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2));
164 opaque_layer->SetPosition(gfx::PointF(i, i)); 164 opaque_layer->SetPosition(gfx::PointF(i, i));
165 active_tree()->root_layer()->AddChild(std::move(opaque_layer)); 165 active_tree()->root_layer()->AddChild(std::move(opaque_layer));
166 } 166 }
167 167
168 active_tree()->BuildPropertyTreesForTesting(); 168 active_tree()->BuildLayerListAndPropertyTreesForTesting();
169 bool update_lcd_text = false; 169 bool update_lcd_text = false;
170 active_tree()->UpdateDrawProperties(update_lcd_text); 170 active_tree()->UpdateDrawProperties(update_lcd_text);
171 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 171 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
172 ASSERT_EQ(1u, rsll.size()); 172 ASSERT_EQ(1u, rsll.size());
173 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers), 173 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers),
174 rsll[0]->render_surface()->layer_list().size()); 174 rsll[0]->render_surface()->layer_list().size());
175 175
176 LayerIterator begin = LayerIterator::Begin(&rsll); 176 LayerIterator begin = LayerIterator::Begin(&rsll);
177 LayerIterator end = LayerIterator::End(&rsll); 177 LayerIterator end = LayerIterator::End(&rsll);
178 178
(...skipping 30 matching lines...) Expand all
209 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); 209 EXPECT_EQ(active_tree()->root_layer(), next.current_layer);
210 210
211 ++begin; 211 ++begin;
212 EXPECT_EQ(end, begin); 212 EXPECT_EQ(end, begin);
213 213
214 PrintResults(); 214 PrintResults();
215 } 215 }
216 216
217 } // namespace 217 } // namespace
218 } // namespace cc 218 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698