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

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: 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
Index: Source/platform/heap/Handle.h
diff --git a/Source/platform/heap/Handle.h b/Source/platform/heap/Handle.h
index 203780194d341006cc438cfc192b83c1c6030215..0691d160157e7a29158334039ee96c806e7d8ce4 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 isGC> struct PointerParamStorageTraits;
haraken 2014/06/06 05:54:53 Nit: isGC => isGarbageCollected
tkent 2014/06/06 06:52:48 Done.
+
+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

Powered by Google App Engine
This is Rietveld 408576698