| 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.
|
|
|