Index: base/mac/scoped_typeref.h |
diff --git a/base/mac/scoped_typeref.h b/base/mac/scoped_typeref.h |
index 551ddf23ec9094512edf9c6da1fca32896d9f05e..9d094dbe74e9cd9cb2e8e44dc7de8bd86eb3256b 100644 |
--- a/base/mac/scoped_typeref.h |
+++ b/base/mac/scoped_typeref.h |
@@ -54,7 +54,7 @@ class ScopedTypeRef { |
typedef T element_type; |
ScopedTypeRef( |
- T object = Traits::InvalidValue(), |
+ __unsafe_unretained T object = Traits::InvalidValue(), |
base::scoped_policy::OwnershipPolicy policy = base::scoped_policy::ASSUME) |
: object_(object) { |
if (object_ && policy == base::scoped_policy::RETAIN) |
@@ -99,9 +99,9 @@ class ScopedTypeRef { |
return &object_; |
} |
- void reset(T object = Traits::InvalidValue(), |
+ void reset(__unsafe_unretained T object = Traits::InvalidValue(), |
base::scoped_policy::OwnershipPolicy policy = |
- base::scoped_policy::ASSUME) { |
+ base::scoped_policy::ASSUME) { |
if (object && policy == base::scoped_policy::RETAIN) |
object = Traits::Retain(object); |
if (object_) |
@@ -109,24 +109,16 @@ class ScopedTypeRef { |
object_ = object; |
} |
- bool operator==(T that) const { |
- return object_ == that; |
- } |
+ bool operator==(__unsafe_unretained T that) const { return object_ == that; } |
- bool operator!=(T that) const { |
- return object_ != that; |
- } |
+ bool operator!=(__unsafe_unretained T that) const { return object_ != that; } |
- operator T() const { |
- return object_; |
- } |
+ operator T() const __attribute((ns_returns_not_retained)) { return object_; } |
- T get() const { |
- return object_; |
- } |
+ T get() const __attribute((ns_returns_not_retained)) { return object_; } |
void swap(ScopedTypeRef& that) { |
- T temp = that.object_; |
+ __unsafe_unretained T temp = that.object_; |
that.object_ = object_; |
object_ = temp; |
} |
@@ -134,14 +126,14 @@ class ScopedTypeRef { |
// ScopedTypeRef<>::release() is like scoped_ptr<>::release. It is NOT |
// a wrapper for Release(). To force a ScopedTypeRef<> object to call |
// Release(), use ScopedTypeRef<>::reset(). |
- T release() WARN_UNUSED_RESULT { |
- T temp = object_; |
+ T release() __attribute((ns_returns_not_retained)) WARN_UNUSED_RESULT { |
+ __unsafe_unretained T temp = object_; |
object_ = Traits::InvalidValue(); |
return temp; |
} |
private: |
- T object_; |
+ __unsafe_unretained T object_; |
}; |
} // namespace base |