Index: base/mac/scoped_typeref.h |
diff --git a/base/mac/scoped_typeref.h b/base/mac/scoped_typeref.h |
index 11767186455e0aa859d0a7b9705372f472e868e2..b8d8a142625bb3f524786dae5078b6d95347149f 100644 |
--- a/base/mac/scoped_typeref.h |
+++ b/base/mac/scoped_typeref.h |
@@ -54,7 +54,7 @@ class ScopedTypeRef { |
typedef T element_type; |
explicit 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) |
@@ -97,9 +97,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_) |
@@ -107,24 +107,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; |
} |
@@ -132,14 +124,14 @@ class ScopedTypeRef { |
// ScopedTypeRef<>::release() is like std::unique_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 |