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

Unified Diff: base/scoped_nsobject.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
« base/scoped_cftyperef.h ('K') | « base/scoped_cftyperef.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/scoped_nsobject.h
===================================================================
--- base/scoped_nsobject.h (revision 12287)
+++ base/scoped_nsobject.h (working copy)
@@ -15,7 +15,9 @@
//
// When scoped_nsobject<> 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_nsobject<> does not call -retain.
+// caller must own the object it gives to scoped_nsobject<>, and relinquishes
+// an ownership claim to that object. scoped_nsobject<> does not call
+// -retain.
template<typename NST>
class scoped_nsobject {
public:
@@ -30,10 +32,8 @@
}
void reset(NST* object = nil) {
- if (object_ != object) {
- [object_ release];
- object_ = object;
- }
+ [object_ release];
+ object_ = object;
}
bool operator==(NST* that) const {
« base/scoped_cftyperef.h ('K') | « base/scoped_cftyperef.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698