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

Unified Diff: third_party/WebKit/Source/platform/heap/Handle.h

Issue 1487603002: Oilpan: improve adopt{Ref,Ptr}WillBeNoop(T*) static asserts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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: third_party/WebKit/Source/platform/heap/Handle.h
diff --git a/third_party/WebKit/Source/platform/heap/Handle.h b/third_party/WebKit/Source/platform/heap/Handle.h
index 358cf68921795c0a9aeb6040f23c4396207fecda..f45c10d5309883a2827e7af09289873f2c170ea5 100644
--- a/third_party/WebKit/Source/platform/heap/Handle.h
+++ b/third_party/WebKit/Source/platform/heap/Handle.h
@@ -1047,15 +1047,16 @@ class PLATFORM_EXPORT DummyBase<void> { };
template<typename T> T* adoptRefWillBeNoop(T* ptr)
{
- static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename std::remove_const<T>::type, RefCounted>::value;
- static_assert(notRefCounted, "you must adopt");
+ static const bool isGarbageCollected = IsGarbageCollectedType<T>::value;
+ static const bool isRefCounted = WTF::IsSubclassOfTemplate<typename std::remove_const<T>::type, RefCounted>::value;
+ static_assert(isGarbageCollected && !isRefCounted, "T needs to be a non-refcounted, garbage collected type.");
return ptr;
}
template<typename T> T* adoptPtrWillBeNoop(T* ptr)
{
- static const bool notRefCounted = !WTF::IsSubclassOfTemplate<typename std::remove_const<T>::type, RefCounted>::value;
- static_assert(notRefCounted, "you must adopt");
+ static const bool isGarbageCollected = IsGarbageCollectedType<T>::value;
+ static_assert(isGarbageCollected, "T needs to be a garbage collected type.");
return ptr;
}
« 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