diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-23 19:21:18 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-23 19:21:18 +0000 |
commit | 405c556a510d9ee1b827a70a5f2294cac42a278c (patch) | |
tree | e9a28886c8979beda858faae66edb42bf1e7a124 /base/scoped_nsobject.h | |
parent | 408f2188cdce0e0d82571be4d9dfa7227751fb1b (diff) | |
download | chromium_src-405c556a510d9ee1b827a70a5f2294cac42a278c.zip chromium_src-405c556a510d9ee1b827a70a5f2294cac42a278c.tar.gz chromium_src-405c556a510d9ee1b827a70a5f2294cac42a278c.tar.bz2 |
Improve scoped_cftyperef<> and scoped_nsobject<> reset() semantics.
Review URL: http://codereview.chromium.org/52018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12301 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_nsobject.h')
-rw-r--r-- | base/scoped_nsobject.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/base/scoped_nsobject.h b/base/scoped_nsobject.h index 12e3a37..2c808c6 100644 --- a/base/scoped_nsobject.h +++ b/base/scoped_nsobject.h @@ -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 @@ class scoped_nsobject { } void reset(NST* object = nil) { - if (object_ != object) { - [object_ release]; - object_ = object; - } + [object_ release]; + object_ = object; } bool operator==(NST* that) const { |