| OLD | NEW |
| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 115 } |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 struct OcclusionTrackerTestMainThreadTypes { | 118 struct OcclusionTrackerTestMainThreadTypes { |
| 119 typedef Layer LayerType; | 119 typedef Layer LayerType; |
| 120 typedef FakeLayerTreeHost HostType; | 120 typedef FakeLayerTreeHost HostType; |
| 121 typedef RenderSurface RenderSurfaceType; | 121 typedef RenderSurface RenderSurfaceType; |
| 122 typedef TestContentLayer ContentLayerType; | 122 typedef TestContentLayer ContentLayerType; |
| 123 typedef scoped_refptr<Layer> LayerPtrType; | 123 typedef scoped_refptr<Layer> LayerPtrType; |
| 124 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; | 124 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; |
| 125 typedef LayerIterator<Layer, | 125 typedef LayerIterator<Layer> TestLayerIterator; |
| 126 RenderSurfaceLayerList, | |
| 127 RenderSurface, | |
| 128 LayerIteratorActions::FrontToBack> TestLayerIterator; | |
| 129 typedef OcclusionTracker OcclusionTrackerType; | 126 typedef OcclusionTracker OcclusionTrackerType; |
| 130 | 127 |
| 131 static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); } | 128 static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); } |
| 132 static ContentLayerPtrType CreateContentLayer(HostType* host) { | 129 static ContentLayerPtrType CreateContentLayer(HostType* host) { |
| 133 return make_scoped_refptr(new ContentLayerType()); | 130 return make_scoped_refptr(new ContentLayerType()); |
| 134 } | 131 } |
| 135 | 132 |
| 136 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { | 133 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { |
| 137 LayerPtrType ref(*layer); | 134 LayerPtrType ref(*layer); |
| 138 *layer = NULL; | 135 *layer = NULL; |
| 139 return ref; | 136 return ref; |
| 140 } | 137 } |
| 141 | 138 |
| 142 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { | 139 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { |
| 143 LayerPtrType ref(*layer); | 140 LayerPtrType ref(*layer); |
| 144 *layer = NULL; | 141 *layer = NULL; |
| 145 return ref; | 142 return ref; |
| 146 } | 143 } |
| 147 | 144 |
| 148 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } | 145 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } |
| 149 }; | 146 }; |
| 150 | 147 |
| 151 struct OcclusionTrackerTestImplThreadTypes { | 148 struct OcclusionTrackerTestImplThreadTypes { |
| 152 typedef LayerImpl LayerType; | 149 typedef LayerImpl LayerType; |
| 153 typedef LayerTreeImpl HostType; | 150 typedef LayerTreeImpl HostType; |
| 154 typedef RenderSurfaceImpl RenderSurfaceType; | 151 typedef RenderSurfaceImpl RenderSurfaceType; |
| 155 typedef TestContentLayerImpl ContentLayerType; | 152 typedef TestContentLayerImpl ContentLayerType; |
| 156 typedef scoped_ptr<LayerImpl> LayerPtrType; | 153 typedef scoped_ptr<LayerImpl> LayerPtrType; |
| 157 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; | 154 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; |
| 158 typedef LayerIterator<LayerImpl, | 155 typedef LayerIterator<LayerImpl> TestLayerIterator; |
| 159 LayerImplList, | |
| 160 RenderSurfaceImpl, | |
| 161 LayerIteratorActions::FrontToBack> TestLayerIterator; | |
| 162 typedef OcclusionTrackerImpl OcclusionTrackerType; | 156 typedef OcclusionTrackerImpl OcclusionTrackerType; |
| 163 | 157 |
| 164 static LayerPtrType CreateLayer(HostType* host) { | 158 static LayerPtrType CreateLayer(HostType* host) { |
| 165 return LayerImpl::Create(host, next_layer_impl_id++); | 159 return LayerImpl::Create(host, next_layer_impl_id++); |
| 166 } | 160 } |
| 167 static ContentLayerPtrType CreateContentLayer(HostType* host) { | 161 static ContentLayerPtrType CreateContentLayer(HostType* host) { |
| 168 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++)); | 162 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++)); |
| 169 } | 163 } |
| 170 static int next_layer_impl_id; | 164 static int next_layer_impl_id; |
| 171 | 165 |
| (...skipping 3641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3813 occlusion.occlusion_from_outside_target().ToString()); | 3807 occlusion.occlusion_from_outside_target().ToString()); |
| 3814 EXPECT_EQ(gfx::Rect().ToString(), | 3808 EXPECT_EQ(gfx::Rect().ToString(), |
| 3815 occlusion.occlusion_from_inside_target().ToString()); | 3809 occlusion.occlusion_from_inside_target().ToString()); |
| 3816 } | 3810 } |
| 3817 }; | 3811 }; |
| 3818 | 3812 |
| 3819 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestEmptyEventLayerDoesNotOcclude) | 3813 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestEmptyEventLayerDoesNotOcclude) |
| 3820 | 3814 |
| 3821 } // namespace | 3815 } // namespace |
| 3822 } // namespace cc | 3816 } // namespace cc |
| OLD | NEW |