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

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

Issue 318023002: Oilpan: Prepare to make ExecutionContext GarbageCollectedMixin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: isGC Created 6 years, 6 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 | « Source/modules/webdatabase/SQLCallbackWrapper.h ('k') | Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Handle.h
diff --git a/Source/platform/heap/Handle.h b/Source/platform/heap/Handle.h
index 203780194d341006cc438cfc192b83c1c6030215..d3872b02be0e526a2361b54a410d1922ab06c8d4 100644
--- a/Source/platform/heap/Handle.h
+++ b/Source/platform/heap/Handle.h
@@ -34,6 +34,7 @@
#include "platform/heap/Heap.h"
#include "platform/heap/ThreadState.h"
#include "platform/heap/Visitor.h"
+#include "wtf/Functional.h"
#include "wtf/HashFunctions.h"
#include "wtf/Locker.h"
#include "wtf/RawPtr.h"
@@ -1152,6 +1153,36 @@ struct NeedsTracing<ListHashSetNode<T, WebCore::HeapListHashSetAllocator<T, inli
static const bool value = true;
};
+// For wtf/Functional.h
+template<typename T, bool isGarbageCollected> struct PointerParamStorageTraits;
+
+template<typename T> struct PointerParamStorageTraits<T*, false> {
+ typedef T* StorageType;
+
+ static StorageType wrap(T* value) { return value; }
+ static T* unwrap(const StorageType& value) { return value; }
+};
+
+template<typename T> struct PointerParamStorageTraits<T*, true> {
+ typedef WebCore::CrossThreadPersistent<T> StorageType;
+
+ static StorageType wrap(T* value) { return value; }
+ static T* unwrap(const StorageType& value) { return value.get(); }
+};
+
+// FIXME: This doesn't support collections and const types. See
+// COMPILE_ASSERT_IS_GARBAGE_COLLECTED.
+template<typename T> struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, WTF::IsSubclassOfTemplate<T, WebCore::GarbageCollected>::value || WebCore::IsGarbageCollectedMixin<T>::value> {
+};
+
+// We assume RawPtr<T> is used only for garbage-collected types.
+template<typename T> struct ParamStorageTraits<RawPtr<T> > {
+ typedef WebCore::CrossThreadPersistent<T> StorageType;
+
+ static StorageType wrap(RawPtr<T> value) { return value.get(); }
+ static T* unwrap(const StorageType& value) { return value.get(); }
+};
+
} // namespace WTF
#endif
« no previous file with comments | « Source/modules/webdatabase/SQLCallbackWrapper.h ('k') | Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698