Index: base/mac/scoped_typeref.h |
diff --git a/base/mac/scoped_typeref.h b/base/mac/scoped_typeref.h |
index 8cf3e4b75a0785ff381ba4f281b1685612ee28e6..42114141e12164a539a5b4890f8c263af1795e56 100644 |
--- a/base/mac/scoped_typeref.h |
+++ b/base/mac/scoped_typeref.h |
@@ -22,7 +22,10 @@ namespace base { |
// template<> |
// struct ScopedTypeRefTraits<CGLContextObj> { |
// static CGLContextObj InvalidValue() { return nullptr; } |
-// static void Retain(CGLContextObj object) { CGLContextRetain(object); } |
+// static CGLContextObj Retain(CGLContextObj object) { |
Mark Mentovai
2016/01/04 16:09:23
I think it’s easier to have these return void and
Robert Sesek
2016/01/04 16:11:52
I had to make this change for ScopedBlock, since t
|
+// CGLContextRetain(object); |
+// return object; |
+// } |
// static void Release(CGLContextObj object) { CGLContextRelease(object); } |
// }; |
// |
@@ -55,13 +58,13 @@ class ScopedTypeRef { |
base::scoped_policy::OwnershipPolicy policy = base::scoped_policy::ASSUME) |
: object_(object) { |
if (object_ && policy == base::scoped_policy::RETAIN) |
- Traits::Retain(object_); |
+ object_ = Traits::Retain(object_); |
} |
ScopedTypeRef(const ScopedTypeRef<T, Traits>& that) |
: object_(that.object_) { |
if (object_) |
- Traits::Retain(object_); |
+ object_ = Traits::Retain(object_); |
} |
~ScopedTypeRef() { |
@@ -86,7 +89,7 @@ class ScopedTypeRef { |
base::scoped_policy::OwnershipPolicy policy = |
base::scoped_policy::ASSUME) { |
if (object && policy == base::scoped_policy::RETAIN) |
- Traits::Retain(object); |
+ object = Traits::Retain(object); |
if (object_) |
Traits::Release(object_); |
object_ = object; |