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

Unified Diff: Source/wtf/PassRefPtr.h

Issue 23531003: Type check when upcasting PassOwnPtr/PassOwnArrayPtr to avoid possible function call ambiguousness (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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: Source/wtf/PassRefPtr.h
diff --git a/Source/wtf/PassRefPtr.h b/Source/wtf/PassRefPtr.h
index 46417573a17d5124bfcd0ebe55442edbb8c9f761..1de5e338a28708005a8d93b8835d12ecb258e936 100644
--- a/Source/wtf/PassRefPtr.h
+++ b/Source/wtf/PassRefPtr.h
@@ -25,6 +25,11 @@
#include "wtf/NullPtr.h"
#include "wtf/TypeTraits.h"
+#define EnsureRefPtrConvertibleArgDefn \
Nico 2013/08/29 19:58:47 This is identical to EnsureOwnArrayPtrConvertibleA
+ typename EnableIf<IsPointerConvertible<U, T>::Value, bool>::Type
+#define EnsureRefPtrConvertibleArgDecl \
+ EnsureRefPtrConvertibleArgDefn = true
+
namespace WTF {
template<typename T> class RefPtr;
@@ -53,11 +58,11 @@ namespace WTF {
// a const PassRefPtr. However, it makes it much easier to work with PassRefPtr
// temporaries, and we don't have a need to use real const PassRefPtrs anyway.
PassRefPtr(const PassRefPtr& o) : m_ptr(o.leakRef()) { }
- template<typename U> PassRefPtr(const PassRefPtr<U>& o, EnsurePtrConvertibleArgDecl(U, T)) : m_ptr(o.leakRef()) { }
+ template<typename U> PassRefPtr(const PassRefPtr<U>& o, EnsureRefPtrConvertibleArgDecl) : m_ptr(o.leakRef()) { }
ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull(m_ptr); }
- template<typename U> PassRefPtr(const RefPtr<U>&, EnsurePtrConvertibleArgDecl(U, T));
+ template<typename U> PassRefPtr(const RefPtr<U>&, EnsureRefPtrConvertibleArgDecl);
T* get() const { return m_ptr; }
@@ -83,7 +88,7 @@ namespace WTF {
mutable T* m_ptr;
};
- template<typename T> template<typename U> inline PassRefPtr<T>::PassRefPtr(const RefPtr<U>& o, EnsurePtrConvertibleArgDefn(U, T))
+ template<typename T> template<typename U> inline PassRefPtr<T>::PassRefPtr(const RefPtr<U>& o, EnsureRefPtrConvertibleArgDefn)
: m_ptr(o.get())
{
T* ptr = m_ptr;
« no previous file with comments | « Source/wtf/PassOwnPtr.h ('k') | Source/wtf/RefPtr.h » ('j') | Source/wtf/TypeTraits.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698