Commit bc00ec09 authored by hiroshige's avatar hiroshige Committed by Commit bot

Add support for IsGarbageCollectedType<void>

Currently IsGarbageCollectedType<void> and PointerParamStorageTraits<void*> can't be compiled.
This CL makes them successfully compiled, and removes ParamStorageTraits<void*> specialization.

BUG=597856

Review-Url: https://codereview.chromium.org/1923183002
Cr-Commit-Position: refs/heads/master@{#390331}
parent 5e468383
......@@ -99,6 +99,11 @@ struct IsGarbageCollectedType {
|| isHeapAllocatedListHashSetNode;
};
template <>
struct IsGarbageCollectedType<void> {
static const bool value = false;
};
// The GarbageCollectedMixin interface and helper macro
// USING_GARBAGE_COLLECTED_MIXIN can be used to automatically define
// TraceTrait/ObjectAliveTrait on non-leftmost deriving classes
......
......@@ -1159,10 +1159,11 @@ template<typename T> inline T* getPtr(const blink::Persistent<T>& p)
// For wtf/Functional.h
template<typename T, bool isGarbageCollected> struct PointerParamStorageTraits;
// The condition of 'T must be fully defined' (except for void) is checked in
// blink::IsGarbageCollectedType<T>::value.
template<typename T>
struct PointerParamStorageTraits<T*, false> {
STATIC_ONLY(PointerParamStorageTraits);
static_assert(sizeof(T), "T must be fully defined");
using StorageType = T*;
static StorageType wrap(T* value) { return value; }
......@@ -1172,7 +1173,6 @@ struct PointerParamStorageTraits<T*, false> {
template<typename T>
struct PointerParamStorageTraits<T*, true> {
STATIC_ONLY(PointerParamStorageTraits);
static_assert(sizeof(T), "T must be fully defined");
using StorageType = blink::CrossThreadPersistent<T>;
static StorageType wrap(T* value) { return value; }
......@@ -1182,7 +1182,6 @@ struct PointerParamStorageTraits<T*, true> {
template<typename T>
struct ParamStorageTraits<T*> : public PointerParamStorageTraits<T*, blink::IsGarbageCollectedType<T>::value> {
STATIC_ONLY(ParamStorageTraits);
static_assert(sizeof(T), "T must be fully defined");
};
template<typename T>
......
......@@ -214,14 +214,6 @@ struct ParamStorageTraits<RetainPtr<T>> {
static typename RetainPtr<T>::PtrType unwrap(const StorageType& value) { return value.get(); }
};
template <>
struct ParamStorageTraits<void*> {
typedef void* StorageType;
static StorageType wrap(void* value) { return value; }
static void* unwrap(const StorageType& value) { return value; }
};
template <typename T>
struct ParamStorageTraits<PassedWrapper<T>> {
typedef PassedWrapper<T> StorageType;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment