Chromium Code Reviews| 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/occlusion_tracker.h" | 5 #include "cc/occlusion_tracker.h" |
| 6 | 6 |
| 7 #include <public/WebFilterOperation.h> | 7 #include <public/WebFilterOperation.h> |
| 8 #include <public/WebFilterOperations.h> | 8 #include <public/WebFilterOperations.h> |
| 9 | 9 |
| 10 #include "cc/layer.h" | 10 #include "cc/layer.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 typedef OcclusionTracker OcclusionTrackerType; | 127 typedef OcclusionTracker OcclusionTrackerType; |
| 128 | 128 |
| 129 static LayerPtrType createLayer() | 129 static LayerPtrType createLayer() |
| 130 { | 130 { |
| 131 return Layer::create(); | 131 return Layer::create(); |
| 132 } | 132 } |
| 133 static ContentLayerPtrType createContentLayer() { return make_scoped_refptr( new ContentLayerType()); } | 133 static ContentLayerPtrType createContentLayer() { return make_scoped_refptr( new ContentLayerType()); } |
| 134 | 134 |
| 135 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) | 135 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) |
| 136 { | 136 { |
| 137 return layer.release(); | 137 LayerPtrType ref(layer); |
| 138 layer = NULL; | |
|
piman
2012/12/06 21:07:49
Note: Dana suggested skipping the resetting to NUL
| |
| 139 return ref; | |
| 138 } | 140 } |
| 139 | 141 |
| 140 static LayerPtrType passLayerPtr(LayerPtrType& layer) | 142 static LayerPtrType passLayerPtr(LayerPtrType& layer) |
| 141 { | 143 { |
| 142 return layer.release(); | 144 LayerPtrType ref(layer); |
| 145 layer = NULL; | |
| 146 return ref; | |
| 143 } | 147 } |
| 144 | 148 |
| 145 static void destroyLayer(LayerPtrType& layer) | 149 static void destroyLayer(LayerPtrType& layer) |
| 146 { | 150 { |
| 147 layer = NULL; | 151 layer = NULL; |
| 148 } | 152 } |
| 149 }; | 153 }; |
| 150 | 154 |
| 151 struct OcclusionTrackerTestImplThreadTypes { | 155 struct OcclusionTrackerTestImplThreadTypes { |
| 152 typedef LayerImpl LayerType; | 156 typedef LayerImpl LayerType; |
| (...skipping 2920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3073 | 3077 |
| 3074 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInScreenSpace().ToString()); | 3078 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInScreenSpace().ToString()); |
| 3075 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInTargetSurface().ToString()); | 3079 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc clusionInTargetSurface().ToString()); |
| 3076 } | 3080 } |
| 3077 }; | 3081 }; |
| 3078 | 3082 |
| 3079 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); | 3083 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); |
| 3080 | 3084 |
| 3081 } // namespace | 3085 } // namespace |
| 3082 } // namespace cc | 3086 } // namespace cc |
| OLD | NEW |