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

Side by Side Diff: cc/layers/layer_iterator_unittest.cc

Issue 348093004: Make cc output surface creation async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Android compile fixes 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/layer_iterator.h" 5 #include "cc/layers/layer_iterator.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
10 #include "cc/test/fake_layer_tree_host.h" 10 #include "cc/test/fake_layer_tree_host.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 scoped_refptr<TestLayer> first = TestLayer::Create(); 104 scoped_refptr<TestLayer> first = TestLayer::Create();
105 scoped_refptr<TestLayer> second = TestLayer::Create(); 105 scoped_refptr<TestLayer> second = TestLayer::Create();
106 scoped_refptr<TestLayer> third = TestLayer::Create(); 106 scoped_refptr<TestLayer> third = TestLayer::Create();
107 scoped_refptr<TestLayer> fourth = TestLayer::Create(); 107 scoped_refptr<TestLayer> fourth = TestLayer::Create();
108 108
109 root_layer->AddChild(first); 109 root_layer->AddChild(first);
110 root_layer->AddChild(second); 110 root_layer->AddChild(second);
111 root_layer->AddChild(third); 111 root_layer->AddChild(third);
112 root_layer->AddChild(fourth); 112 root_layer->AddChild(fourth);
113 113
114 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 114 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
115 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client);
115 host->SetRootLayer(root_layer); 116 host->SetRootLayer(root_layer);
116 117
117 RenderSurfaceLayerList render_surface_layer_list; 118 RenderSurfaceLayerList render_surface_layer_list;
118 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 119 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
119 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); 120 root_layer.get(), root_layer->bounds(), &render_surface_layer_list);
120 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 121 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
121 122
122 IterateFrontToBack(&render_surface_layer_list); 123 IterateFrontToBack(&render_surface_layer_list);
123 EXPECT_COUNT(root_layer, 5, -1, 4); 124 EXPECT_COUNT(root_layer, 5, -1, 4);
124 EXPECT_COUNT(first, -1, -1, 3); 125 EXPECT_COUNT(first, -1, -1, 3);
(...skipping 15 matching lines...) Expand all
140 141
141 root_layer->AddChild(root1); 142 root_layer->AddChild(root1);
142 root_layer->AddChild(root2); 143 root_layer->AddChild(root2);
143 root_layer->AddChild(root3); 144 root_layer->AddChild(root3);
144 root2->AddChild(root21); 145 root2->AddChild(root21);
145 root2->AddChild(root22); 146 root2->AddChild(root22);
146 root2->AddChild(root23); 147 root2->AddChild(root23);
147 root22->AddChild(root221); 148 root22->AddChild(root221);
148 root23->AddChild(root231); 149 root23->AddChild(root231);
149 150
150 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 151 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
152 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client);
151 host->SetRootLayer(root_layer); 153 host->SetRootLayer(root_layer);
152 154
153 RenderSurfaceLayerList render_surface_layer_list; 155 RenderSurfaceLayerList render_surface_layer_list;
154 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 156 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
155 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); 157 root_layer.get(), root_layer->bounds(), &render_surface_layer_list);
156 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 158 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
157 159
158 IterateFrontToBack(&render_surface_layer_list); 160 IterateFrontToBack(&render_surface_layer_list);
159 EXPECT_COUNT(root_layer, 9, -1, 8); 161 EXPECT_COUNT(root_layer, 9, -1, 8);
160 EXPECT_COUNT(root1, -1, -1, 7); 162 EXPECT_COUNT(root1, -1, -1, 7);
(...skipping 24 matching lines...) Expand all
185 root2->SetOpacity(0.5f); 187 root2->SetOpacity(0.5f);
186 root2->SetForceRenderSurface(true); // Force the layer to own a new surface. 188 root2->SetForceRenderSurface(true); // Force the layer to own a new surface.
187 root2->AddChild(root21); 189 root2->AddChild(root21);
188 root2->AddChild(root22); 190 root2->AddChild(root22);
189 root2->AddChild(root23); 191 root2->AddChild(root23);
190 root22->SetOpacity(0.5f); 192 root22->SetOpacity(0.5f);
191 root22->AddChild(root221); 193 root22->AddChild(root221);
192 root23->SetOpacity(0.5f); 194 root23->SetOpacity(0.5f);
193 root23->AddChild(root231); 195 root23->AddChild(root231);
194 196
195 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); 197 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
198 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client);
196 host->SetRootLayer(root_layer); 199 host->SetRootLayer(root_layer);
197 200
198 RenderSurfaceLayerList render_surface_layer_list; 201 RenderSurfaceLayerList render_surface_layer_list;
199 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( 202 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs(
200 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); 203 root_layer.get(), root_layer->bounds(), &render_surface_layer_list);
201 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 204 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
202 205
203 IterateFrontToBack(&render_surface_layer_list); 206 IterateFrontToBack(&render_surface_layer_list);
204 EXPECT_COUNT(root_layer, 14, -1, 13); 207 EXPECT_COUNT(root_layer, 14, -1, 13);
205 EXPECT_COUNT(root1, -1, -1, 12); 208 EXPECT_COUNT(root1, -1, -1, 12);
206 EXPECT_COUNT(root2, 10, 11, -1); 209 EXPECT_COUNT(root2, 10, 11, -1);
207 EXPECT_COUNT(root21, -1, -1, 9); 210 EXPECT_COUNT(root21, -1, -1, 9);
208 EXPECT_COUNT(root22, 7, 8, 6); 211 EXPECT_COUNT(root22, 7, 8, 6);
209 EXPECT_COUNT(root221, -1, -1, 5); 212 EXPECT_COUNT(root221, -1, -1, 5);
210 EXPECT_COUNT(root23, 3, 4, 2); 213 EXPECT_COUNT(root23, 3, 4, 2);
211 EXPECT_COUNT(root231, -1, -1, 1); 214 EXPECT_COUNT(root231, -1, -1, 1);
212 EXPECT_COUNT(root3, -1, -1, 0); 215 EXPECT_COUNT(root3, -1, -1, 0);
213 } 216 }
214 217
215 } // namespace 218 } // namespace
216 } // namespace cc 219 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698