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

Unified Diff: base/scoped_cftyperef.h

Issue 52018: Improve scoped_cftyperef<> and scoped_nsobject<> reset() semantics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/scoped_nsobject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/scoped_cftyperef.h
===================================================================
--- base/scoped_cftyperef.h (revision 12287)
+++ base/scoped_cftyperef.h (working copy)
@@ -15,7 +15,9 @@
//
// When scoped_cftyperef<> takes ownership of an object (in the constructor or
// in reset()), it takes over the caller's existing ownership claim. The
-// caller must own the object. scoped_cftyperef<> does not call CFRetain().
+// caller must own the object it gives to scoped_cftyperef<>, and relinquishes
+// an ownership claim to that object. scoped_cftyperef<> does not call
+// CFRetain().
template<typename CFT>
class scoped_cftyperef {
public:
@@ -31,11 +33,9 @@
}
void reset(CFT object = NULL) {
- if (object_ != object) {
- if (object_)
- CFRelease(object_);
- object_ = object;
- }
+ if (object_)
TVL 2009/03/23 17:30:22 part of me thinks it's better to match the other s
+ CFRelease(object_);
+ object_ = object;
}
bool operator==(CFT that) const {
« no previous file with comments | « no previous file | base/scoped_nsobject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698