Chromium Code Reviews| Index: Source/wtf/PassRefPtr.h |
| diff --git a/Source/wtf/PassRefPtr.h b/Source/wtf/PassRefPtr.h |
| index a099eef5aa35ca287fa50971a04da5e4b812829d..d3e613ee978edf1d294bad406e0355d7d0460d8f 100644 |
| --- a/Source/wtf/PassRefPtr.h |
| +++ b/Source/wtf/PassRefPtr.h |
| @@ -26,6 +26,10 @@ |
| #include "wtf/RawPtr.h" |
| #include "wtf/TypeTraits.h" |
| +namespace blink { |
| +template<typename T> class RefCountedGarbageCollected; |
| +} |
| + |
| namespace WTF { |
| template<typename T> class RefPtr; |
| @@ -185,6 +189,8 @@ namespace WTF { |
| template<typename T> PassRefPtr<T> adoptRef(T* p) |
| { |
| + static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemplate<typename WTF::RemoveConst<T>::Type, blink::RefCountedGarbageCollected>::value; |
| + COMPILE_ASSERT(notRefCountedGarbageCollected, adoptRefIsNotAllowedForRefCountedGarbageCollected); |
|
Mikhail
2014/10/14 11:05:10
wouldn't smth like
template<T> void adoptRef(con
tkent
2014/11/10 06:06:59
Mikhail's idea looks better.
This patch has a laye
haraken
2014/11/10 06:41:56
Hmm, it looks like I need your help.
When I add:
Mikhail
2014/11/10 10:10:57
yeah, sorry this trick does not work with function
|
| adopted(p); |
| return PassRefPtr<T>(p, PassRefPtr<T>::AdoptRef); |
| } |