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

Unified Diff: base/mac/scoped_typeref.h

Issue 1551943002: Rewrite most of the scopers in //base/mac to use ScopedTypeRef or ScopedGeneric. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix iOS Created 5 years 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
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;

Powered by Google App Engine
This is Rietveld 408576698