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

Unified Diff: base/mac/scoped_typeref.h

Issue 2018793002: Mac: Move remote layer use to GpuOutputSurfaceMac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean_up_mac
Patch Set: Created 4 years, 7 months 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 eed5afb539e35ce7b6a25a4f56daa87291b92e4b..6edbf08076728d97be3d5f79827685bbde9b040d 100644
--- a/base/mac/scoped_typeref.h
+++ b/base/mac/scoped_typeref.h
@@ -67,6 +67,14 @@ class ScopedTypeRef {
object_ = Traits::Retain(object_);
}
+ // This allows passing an object to a function that takes its superclass.
+ template <typename R, typename RTraits>
+ ScopedTypeRef(const ScopedTypeRef<R, RTraits>& that_as_subclass)
+ : object_(that_as_subclass.get()) {
+ if (object_)
+ object_ = Traits::Retain(object_);
+ }
+
// Without this, passing a ScopedTypeRef<A,TraitsX> to construct a
// ScopedTypeRef<A,TraitsY> would automatically cast down to an A, and then
// ASSUME ownership of A, when a retain is what was needed.

Powered by Google App Engine
This is Rietveld 408576698