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

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

Issue 13285002: cc: Consolidate LayerList types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/occlusion_tracker.cc ('k') | cc/trees/quad_culler_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 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 "cc/animation/layer_animation_controller.h" 7 #include "cc/animation/layer_animation_controller.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/debug/overdraw_metrics.h" 9 #include "cc/debug/overdraw_metrics.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 }; 129 };
130 130
131 struct OcclusionTrackerTestMainThreadTypes { 131 struct OcclusionTrackerTestMainThreadTypes {
132 typedef Layer LayerType; 132 typedef Layer LayerType;
133 typedef LayerTreeHost HostType; 133 typedef LayerTreeHost HostType;
134 typedef RenderSurface RenderSurfaceType; 134 typedef RenderSurface RenderSurfaceType;
135 typedef TestContentLayer ContentLayerType; 135 typedef TestContentLayer ContentLayerType;
136 typedef scoped_refptr<Layer> LayerPtrType; 136 typedef scoped_refptr<Layer> LayerPtrType;
137 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; 137 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType;
138 typedef LayerIterator<Layer, 138 typedef LayerIterator<Layer,
139 std::vector<scoped_refptr<Layer> >, 139 LayerList,
140 RenderSurface, 140 RenderSurface,
141 LayerIteratorActions::FrontToBack> TestLayerIterator; 141 LayerIteratorActions::FrontToBack> TestLayerIterator;
142 typedef OcclusionTracker OcclusionTrackerType; 142 typedef OcclusionTracker OcclusionTrackerType;
143 143
144 static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); } 144 static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); }
145 static ContentLayerPtrType CreateContentLayer(HostType* host) { 145 static ContentLayerPtrType CreateContentLayer(HostType* host) {
146 return make_scoped_refptr(new ContentLayerType()); 146 return make_scoped_refptr(new ContentLayerType());
147 } 147 }
148 148
149 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { 149 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) {
(...skipping 12 matching lines...) Expand all
162 }; 162 };
163 163
164 struct OcclusionTrackerTestImplThreadTypes { 164 struct OcclusionTrackerTestImplThreadTypes {
165 typedef LayerImpl LayerType; 165 typedef LayerImpl LayerType;
166 typedef LayerTreeImpl HostType; 166 typedef LayerTreeImpl HostType;
167 typedef RenderSurfaceImpl RenderSurfaceType; 167 typedef RenderSurfaceImpl RenderSurfaceType;
168 typedef TestContentLayerImpl ContentLayerType; 168 typedef TestContentLayerImpl ContentLayerType;
169 typedef scoped_ptr<LayerImpl> LayerPtrType; 169 typedef scoped_ptr<LayerImpl> LayerPtrType;
170 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; 170 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType;
171 typedef LayerIterator<LayerImpl, 171 typedef LayerIterator<LayerImpl,
172 std::vector<LayerImpl*>, 172 LayerImplList,
173 RenderSurfaceImpl, 173 RenderSurfaceImpl,
174 LayerIteratorActions::FrontToBack> TestLayerIterator; 174 LayerIteratorActions::FrontToBack> TestLayerIterator;
175 typedef OcclusionTrackerImpl OcclusionTrackerType; 175 typedef OcclusionTrackerImpl OcclusionTrackerType;
176 176
177 static LayerPtrType CreateLayer(HostType* host) { 177 static LayerPtrType CreateLayer(HostType* host) {
178 return LayerImpl::Create(host, next_layer_impl_id++); 178 return LayerImpl::Create(host, next_layer_impl_id++);
179 } 179 }
180 static ContentLayerPtrType CreateContentLayer(HostType* host) { 180 static ContentLayerPtrType CreateContentLayer(HostType* host) {
181 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++)); 181 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++));
182 } 182 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 442
443 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) { 443 void SetMask(LayerImpl* owning_layer, scoped_ptr<LayerImpl> layer) {
444 owning_layer->SetMaskLayer(layer.Pass()); 444 owning_layer->SetMaskLayer(layer.Pass());
445 } 445 }
446 446
447 FakeImplProxy proxy_; 447 FakeImplProxy proxy_;
448 FakeLayerTreeHostImpl host_impl_; 448 FakeLayerTreeHostImpl host_impl_;
449 bool opaque_layers_; 449 bool opaque_layers_;
450 // These hold ownership of the layers for the duration of the test. 450 // These hold ownership of the layers for the duration of the test.
451 typename Types::LayerPtrType root_; 451 typename Types::LayerPtrType root_;
452 std::vector<scoped_refptr<Layer> > render_surface_layer_list_; 452 LayerList render_surface_layer_list_;
453 std::vector<LayerImpl*> render_surface_layer_list_impl_; 453 LayerImplList render_surface_layer_list_impl_;
454 typename Types::TestLayerIterator layer_iterator_begin_; 454 typename Types::TestLayerIterator layer_iterator_begin_;
455 typename Types::TestLayerIterator layer_iterator_; 455 typename Types::TestLayerIterator layer_iterator_;
456 typename Types::LayerType* last_layer_visited_; 456 typename Types::LayerType* last_layer_visited_;
457 std::vector<scoped_refptr<Layer> > replica_layers_; 457 LayerList replica_layers_;
458 std::vector<scoped_refptr<Layer> > mask_layers_; 458 LayerList mask_layers_;
459 }; 459 };
460 460
461 template <> 461 template <>
462 LayerTreeHost* 462 LayerTreeHost*
463 OcclusionTrackerTest<OcclusionTrackerTestMainThreadTypes>::GetHost() { 463 OcclusionTrackerTest<OcclusionTrackerTestMainThreadTypes>::GetHost() {
464 return NULL; 464 return NULL;
465 } 465 }
466 466
467 template <> 467 template <>
468 LayerTreeImpl* 468 LayerTreeImpl*
(...skipping 4066 matching lines...) Expand 10 before | Expand all | Expand 10 after
4535 gfx::Rect(0, 0, 100, 100), 4535 gfx::Rect(0, 0, 100, 100),
4536 &has_occlusion_from_outside_target_surface)); 4536 &has_occlusion_from_outside_target_surface));
4537 EXPECT_FALSE(has_occlusion_from_outside_target_surface); 4537 EXPECT_FALSE(has_occlusion_from_outside_target_surface);
4538 } 4538 }
4539 }; 4539 };
4540 4540
4541 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion) 4541 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion)
4542 4542
4543 } // namespace 4543 } // namespace
4544 } // namespace cc 4544 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/occlusion_tracker.cc ('k') | cc/trees/quad_culler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698