| 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> TestLayerIterator; | 125 typedef LayerIterator<Layer, |
| 126 RenderSurfaceLayerList, |
| 127 RenderSurface, |
| 128 LayerIteratorActions::FrontToBack> TestLayerIterator; |
| 126 typedef OcclusionTracker OcclusionTrackerType; | 129 typedef OcclusionTracker OcclusionTrackerType; |
| 127 | 130 |
| 128 static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); } | 131 static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); } |
| 129 static ContentLayerPtrType CreateContentLayer(HostType* host) { | 132 static ContentLayerPtrType CreateContentLayer(HostType* host) { |
| 130 return make_scoped_refptr(new ContentLayerType()); | 133 return make_scoped_refptr(new ContentLayerType()); |
| 131 } | 134 } |
| 132 | 135 |
| 133 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { | 136 static LayerPtrType PassLayerPtr(ContentLayerPtrType* layer) { |
| 134 LayerPtrType ref(*layer); | 137 LayerPtrType ref(*layer); |
| 135 *layer = NULL; | 138 *layer = NULL; |
| 136 return ref; | 139 return ref; |
| 137 } | 140 } |
| 138 | 141 |
| 139 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { | 142 static LayerPtrType PassLayerPtr(LayerPtrType* layer) { |
| 140 LayerPtrType ref(*layer); | 143 LayerPtrType ref(*layer); |
| 141 *layer = NULL; | 144 *layer = NULL; |
| 142 return ref; | 145 return ref; |
| 143 } | 146 } |
| 144 | 147 |
| 145 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } | 148 static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; } |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 struct OcclusionTrackerTestImplThreadTypes { | 151 struct OcclusionTrackerTestImplThreadTypes { |
| 149 typedef LayerImpl LayerType; | 152 typedef LayerImpl LayerType; |
| 150 typedef LayerTreeImpl HostType; | 153 typedef LayerTreeImpl HostType; |
| 151 typedef RenderSurfaceImpl RenderSurfaceType; | 154 typedef RenderSurfaceImpl RenderSurfaceType; |
| 152 typedef TestContentLayerImpl ContentLayerType; | 155 typedef TestContentLayerImpl ContentLayerType; |
| 153 typedef scoped_ptr<LayerImpl> LayerPtrType; | 156 typedef scoped_ptr<LayerImpl> LayerPtrType; |
| 154 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; | 157 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; |
| 155 typedef LayerIterator<LayerImpl> TestLayerIterator; | 158 typedef LayerIterator<LayerImpl, |
| 159 LayerImplList, |
| 160 RenderSurfaceImpl, |
| 161 LayerIteratorActions::FrontToBack> TestLayerIterator; |
| 156 typedef OcclusionTrackerImpl OcclusionTrackerType; | 162 typedef OcclusionTrackerImpl OcclusionTrackerType; |
| 157 | 163 |
| 158 static LayerPtrType CreateLayer(HostType* host) { | 164 static LayerPtrType CreateLayer(HostType* host) { |
| 159 return LayerImpl::Create(host, next_layer_impl_id++); | 165 return LayerImpl::Create(host, next_layer_impl_id++); |
| 160 } | 166 } |
| 161 static ContentLayerPtrType CreateContentLayer(HostType* host) { | 167 static ContentLayerPtrType CreateContentLayer(HostType* host) { |
| 162 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++)); | 168 return make_scoped_ptr(new ContentLayerType(host, next_layer_impl_id++)); |
| 163 } | 169 } |
| 164 static int next_layer_impl_id; | 170 static int next_layer_impl_id; |
| 165 | 171 |
| (...skipping 3651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3817 occlusion.occlusion_from_outside_target().ToString()); | 3823 occlusion.occlusion_from_outside_target().ToString()); |
| 3818 EXPECT_EQ(gfx::Rect().ToString(), | 3824 EXPECT_EQ(gfx::Rect().ToString(), |
| 3819 occlusion.occlusion_from_inside_target().ToString()); | 3825 occlusion.occlusion_from_inside_target().ToString()); |
| 3820 } | 3826 } |
| 3821 }; | 3827 }; |
| 3822 | 3828 |
| 3823 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestEmptyEventLayerDoesNotOcclude) | 3829 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestEmptyEventLayerDoesNotOcclude) |
| 3824 | 3830 |
| 3825 } // namespace | 3831 } // namespace |
| 3826 } // namespace cc | 3832 } // namespace cc |
| OLD | NEW |