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

Side by Side Diff: cc/occlusion_tracker_unittest.cc

Issue 11458003: Remove scoped_refptr::release which is confusing and causes leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: duh Created 8 years 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
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/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
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;
danakj 2012/12/06 05:00:09 The NULL assignment seems unneeded. The callsite w
piman 2012/12/06 05:16:00 I wanted to keep the semantics that it cleared the
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
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
OLDNEW
« no previous file with comments | « base/memory/ref_counted.h ('k') | chrome/browser/extensions/api/downloads/downloads_api_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698