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

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

Issue 2834123002: cc: Replace render surface layer list with a render surface list (Closed)
Patch Set: Address review comments Created 3 years, 7 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 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/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 "cc/animation/animation_host.h" 9 #include "cc/animation/animation_host.h"
10 #include "cc/base/filter_operation.h" 10 #include "cc/base/filter_operation.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 const gfx::Size& bounds, 181 const gfx::Size& bounds,
182 bool opaque) { 182 bool opaque) {
183 TestContentLayerImpl* layer = 183 TestContentLayerImpl* layer =
184 CreateDrawingLayer(parent, transform, position, bounds, opaque); 184 CreateDrawingLayer(parent, transform, position, bounds, opaque);
185 layer->test_properties()->force_render_surface = true; 185 layer->test_properties()->force_render_surface = true;
186 return layer; 186 return layer;
187 } 187 }
188 188
189 void DestroyLayers() { 189 void DestroyLayers() {
190 host_->host_impl()->active_tree()->SetRootLayerForTesting(nullptr); 190 host_->host_impl()->active_tree()->SetRootLayerForTesting(nullptr);
191 render_surface_layer_list_impl_.clear(); 191 render_surface_list_impl_.clear();
192 mask_layers_.clear(); 192 mask_layers_.clear();
193 layer_iterator_.reset(); 193 layer_iterator_.reset();
194 } 194 }
195 195
196 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} 196 void CopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {}
197 197
198 void AddCopyRequest(Layer* layer) { 198 void AddCopyRequest(Layer* layer) {
199 layer->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( 199 layer->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest(
200 base::Bind(&OcclusionTrackerTest::CopyOutputCallback, 200 base::Bind(&OcclusionTrackerTest::CopyOutputCallback,
201 base::Unretained(this)))); 201 base::Unretained(this))));
202 } 202 }
203 203
204 void AddCopyRequest(LayerImpl* layer) { 204 void AddCopyRequest(LayerImpl* layer) {
205 layer->test_properties()->copy_requests.push_back( 205 layer->test_properties()->copy_requests.push_back(
206 CopyOutputRequest::CreateBitmapRequest( 206 CopyOutputRequest::CreateBitmapRequest(
207 base::Bind(&OcclusionTrackerTest::CopyOutputCallback, 207 base::Bind(&OcclusionTrackerTest::CopyOutputCallback,
208 base::Unretained(this)))); 208 base::Unretained(this))));
209 } 209 }
210 210
211 void CalcDrawEtc(TestContentLayerImpl* root) { 211 void CalcDrawEtc(TestContentLayerImpl* root) {
212 root->layer_tree_impl()->BuildLayerListForTesting(); 212 root->layer_tree_impl()->BuildLayerListForTesting();
213 DCHECK(root == root->layer_tree_impl()->root_layer_for_testing()); 213 DCHECK(root == root->layer_tree_impl()->root_layer_for_testing());
214 214
215 // These occlusion tests attach and detach layers in multiple 215 // These occlusion tests attach and detach layers in multiple
216 // iterations, so rebuild property trees every time. 216 // iterations, so rebuild property trees every time.
217 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 217 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
218 218
219 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 219 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
220 root, root->bounds(), &render_surface_layer_list_impl_); 220 root, root->bounds(), &render_surface_list_impl_);
221 inputs.can_adjust_raster_scales = true; 221 inputs.can_adjust_raster_scales = true;
222 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 222 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
223 223
224 layer_iterator_ = base::MakeUnique<EffectTreeLayerListIterator>( 224 layer_iterator_ = base::MakeUnique<EffectTreeLayerListIterator>(
225 host_->host_impl()->active_tree()); 225 host_->host_impl()->active_tree());
226 } 226 }
227 227
228 void EnterLayer(LayerImpl* layer, OcclusionTracker* occlusion) { 228 void EnterLayer(LayerImpl* layer, OcclusionTracker* occlusion) {
229 ASSERT_EQ(layer_iterator_->current_layer(), layer); 229 ASSERT_EQ(layer_iterator_->current_layer(), layer);
230 ASSERT_TRUE(layer_iterator_->state() == 230 ASSERT_TRUE(layer_iterator_->state() ==
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 void SetMask(LayerImpl* owning_layer, std::unique_ptr<LayerImpl> layer) { 298 void SetMask(LayerImpl* owning_layer, std::unique_ptr<LayerImpl> layer) {
299 owning_layer->test_properties()->SetMaskLayer(std::move(layer)); 299 owning_layer->test_properties()->SetMaskLayer(std::move(layer));
300 } 300 }
301 301
302 bool opaque_layers_; 302 bool opaque_layers_;
303 FakeLayerTreeHostClient client_; 303 FakeLayerTreeHostClient client_;
304 TestTaskGraphRunner task_graph_runner_; 304 TestTaskGraphRunner task_graph_runner_;
305 std::unique_ptr<AnimationHost> animation_host_; 305 std::unique_ptr<AnimationHost> animation_host_;
306 std::unique_ptr<FakeLayerTreeHost> host_; 306 std::unique_ptr<FakeLayerTreeHost> host_;
307 // These hold ownership of the layers for the duration of the test. 307 // These hold ownership of the layers for the duration of the test.
308 LayerImplList render_surface_layer_list_impl_; 308 RenderSurfaceList render_surface_list_impl_;
309 std::unique_ptr<EffectTreeLayerListIterator> layer_iterator_; 309 std::unique_ptr<EffectTreeLayerListIterator> layer_iterator_;
310 LayerList mask_layers_; 310 LayerList mask_layers_;
311 int next_layer_impl_id_; 311 int next_layer_impl_id_;
312 }; 312 };
313 313
314 #define RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ 314 #define RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \
315 class ClassName##ImplThreadOpaqueLayers : public ClassName { \ 315 class ClassName##ImplThreadOpaqueLayers : public ClassName { \
316 public: /* NOLINT(whitespace/indent) */ \ 316 public: /* NOLINT(whitespace/indent) */ \
317 ClassName##ImplThreadOpaqueLayers() : ClassName(true) {} \ 317 ClassName##ImplThreadOpaqueLayers() : ClassName(true) {} \
318 }; \ 318 }; \
(...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 EXPECT_EQ(gfx::Rect(), 2432 EXPECT_EQ(gfx::Rect(),
2433 occlusion.UnoccludedSurfaceContentRect( 2433 occlusion.UnoccludedSurfaceContentRect(
2434 surface, gfx::Rect(80, 70, 50, 50))); 2434 surface, gfx::Rect(80, 70, 50, 50)));
2435 } 2435 }
2436 }; 2436 };
2437 2437
2438 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) 2438 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery)
2439 2439
2440 } // namespace 2440 } // namespace
2441 } // namespace cc 2441 } // 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