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

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

Issue 1013273003: cc: Force an update on tile size after viewport resize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: attempt 3? Created 5 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
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 scoped_ptr<SolidColorLayerImpl> opaque_layer = 87 scoped_ptr<SolidColorLayerImpl> opaque_layer =
88 SolidColorLayerImpl::Create(active_tree(), 2); 88 SolidColorLayerImpl::Create(active_tree(), 2);
89 opaque_layer->SetBackgroundColor(SK_ColorRED); 89 opaque_layer->SetBackgroundColor(SK_ColorRED);
90 opaque_layer->SetContentsOpaque(true); 90 opaque_layer->SetContentsOpaque(true);
91 opaque_layer->SetDrawsContent(true); 91 opaque_layer->SetDrawsContent(true);
92 opaque_layer->SetBounds(viewport_rect.size()); 92 opaque_layer->SetBounds(viewport_rect.size());
93 opaque_layer->SetContentBounds(viewport_rect.size()); 93 opaque_layer->SetContentBounds(viewport_rect.size());
94 active_tree()->root_layer()->AddChild(opaque_layer.Pass()); 94 active_tree()->root_layer()->AddChild(opaque_layer.Pass());
95 95
96 bool update_lcd_text = false; 96 bool first_update_after_commit = false;
97 active_tree()->UpdateDrawProperties(update_lcd_text); 97 active_tree()->UpdateDrawProperties(first_update_after_commit);
98 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 98 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
99 ASSERT_EQ(1u, rsll.size()); 99 ASSERT_EQ(1u, rsll.size());
100 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size()); 100 EXPECT_EQ(1u, rsll[0]->render_surface()->layer_list().size());
101 101
102 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll); 102 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll);
103 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll); 103 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll);
104 104
105 LayerIteratorPosition<LayerImpl> pos = begin; 105 LayerIteratorPosition<LayerImpl> pos = begin;
106 106
107 // The opaque_layer adds occlusion over the whole viewport. 107 // The opaque_layer adds occlusion over the whole viewport.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 opaque_layer->SetContentsOpaque(true); 158 opaque_layer->SetContentsOpaque(true);
159 opaque_layer->SetDrawsContent(true); 159 opaque_layer->SetDrawsContent(true);
160 opaque_layer->SetBounds( 160 opaque_layer->SetBounds(
161 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2)); 161 gfx::Size(viewport_rect.width() / 2, viewport_rect.height() / 2));
162 opaque_layer->SetContentBounds( 162 opaque_layer->SetContentBounds(
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::Point(i, i)); 164 opaque_layer->SetPosition(gfx::Point(i, i));
165 active_tree()->root_layer()->AddChild(opaque_layer.Pass()); 165 active_tree()->root_layer()->AddChild(opaque_layer.Pass());
166 } 166 }
167 167
168 bool update_lcd_text = false; 168 bool first_update_after_commit = false;
169 active_tree()->UpdateDrawProperties(update_lcd_text); 169 active_tree()->UpdateDrawProperties(first_update_after_commit);
170 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList(); 170 const LayerImplList& rsll = active_tree()->RenderSurfaceLayerList();
171 ASSERT_EQ(1u, rsll.size()); 171 ASSERT_EQ(1u, rsll.size());
172 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers), 172 EXPECT_EQ(static_cast<size_t>(kNumOpaqueLayers),
173 rsll[0]->render_surface()->layer_list().size()); 173 rsll[0]->render_surface()->layer_list().size());
174 174
175 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll); 175 LayerIterator<LayerImpl> begin = LayerIterator<LayerImpl>::Begin(&rsll);
176 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll); 176 LayerIterator<LayerImpl> end = LayerIterator<LayerImpl>::End(&rsll);
177 177
178 // The opaque_layers add occlusion. 178 // The opaque_layers add occlusion.
179 for (int i = 0; i < kNumOpaqueLayers - 1; ++i) { 179 for (int i = 0; i < kNumOpaqueLayers - 1; ++i) {
(...skipping 28 matching lines...) Expand all
208 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); 208 EXPECT_EQ(active_tree()->root_layer(), next.current_layer);
209 209
210 ++begin; 210 ++begin;
211 EXPECT_EQ(end, begin); 211 EXPECT_EQ(end, begin);
212 212
213 PrintResults(); 213 PrintResults();
214 } 214 }
215 215
216 } // namespace 216 } // namespace
217 } // namespace cc 217 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698