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

Unified Diff: Source/wtf/PassRefPtr.h

Issue 647393002: Oilpan: Forbid adoptRef(X*) where X is RefCountedGarbageCollected (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698