Commit 0df88f84 authored by Michael Lippautz's avatar Michael Lippautz Committed by Chromium LUCI CQ

heap: HeapHashCountedSet: Use standard GC types

Drive-by: IWYU for HeapDeque.

Bug: 1056170
Change-Id: I0be011fd4701533e24ca9dfbbbc2c046059a4f0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2620563Reviewed-by: default avatarOmer Katz <omerkatz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842010}
parent d4261c45
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_DEQUE_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_DEQUE_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_DEQUE_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_DEQUE_H_
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/heap/heap_allocator_impl.h" #include "third_party/blink/renderer/platform/heap/heap_allocator_impl.h"
#include "third_party/blink/renderer/platform/heap/visitor.h" #include "third_party/blink/renderer/platform/heap/visitor.h"
#include "third_party/blink/renderer/platform/wtf/deque.h" #include "third_party/blink/renderer/platform/wtf/deque.h"
......
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_HASH_COUNTED_SET_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_HASH_COUNTED_SET_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_HASH_COUNTED_SET_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_COLLECTION_SUPPORT_HEAP_HASH_COUNTED_SET_H_
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/heap/heap_allocator_impl.h" #include "third_party/blink/renderer/platform/heap/heap_allocator_impl.h"
#include "third_party/blink/renderer/platform/heap/visitor.h"
#include "third_party/blink/renderer/platform/wtf/hash_counted_set.h" #include "third_party/blink/renderer/platform/wtf/hash_counted_set.h"
namespace blink { namespace blink {
...@@ -14,11 +16,20 @@ template <typename Value, ...@@ -14,11 +16,20 @@ template <typename Value,
typename HashFunctions = typename DefaultHash<Value>::Hash, typename HashFunctions = typename DefaultHash<Value>::Hash,
typename Traits = HashTraits<Value>> typename Traits = HashTraits<Value>>
class HeapHashCountedSet final class HeapHashCountedSet final
: public HashCountedSet<Value, HashFunctions, Traits, HeapAllocator> { : public GarbageCollected<HeapHashCountedSet<Value, HashFunctions, Traits>>,
IS_GARBAGE_COLLECTED_CONTAINER_TYPE(); public HashCountedSet<Value, HashFunctions, Traits, HeapAllocator> {
DISALLOW_NEW(); DISALLOW_NEW();
static void CheckType() { public:
HeapHashCountedSet() = default;
void Trace(Visitor* visitor) const {
CheckType();
HashCountedSet<Value, HashFunctions, Traits, HeapAllocator>::Trace(visitor);
}
private:
static constexpr void CheckType() {
static_assert(WTF::IsMemberOrWeakMemberType<Value>::value, static_assert(WTF::IsMemberOrWeakMemberType<Value>::value,
"HeapHashCountedSet supports only Member and WeakMember."); "HeapHashCountedSet supports only Member and WeakMember.");
static_assert(std::is_trivially_destructible<HeapHashCountedSet>::value, static_assert(std::is_trivially_destructible<HeapHashCountedSet>::value,
...@@ -27,21 +38,8 @@ class HeapHashCountedSet final ...@@ -27,21 +38,8 @@ class HeapHashCountedSet final
"For counted sets without traceable elements, use " "For counted sets without traceable elements, use "
"HashCountedSet<> instead of HeapHashCountedSet<>."); "HashCountedSet<> instead of HeapHashCountedSet<>.");
} }
public:
template <typename>
static void* AllocateObject(size_t size) {
return ThreadHeap::Allocate<
HeapHashCountedSet<Value, HashFunctions, Traits>>(size);
}
HeapHashCountedSet() { CheckType(); }
}; };
template <typename T, typename U, typename V>
struct GCInfoTrait<HeapHashCountedSet<T, U, V>>
: public GCInfoTrait<HashCountedSet<T, U, V, HeapAllocator>> {};
} // namespace blink } // namespace blink
namespace WTF { namespace WTF {
......
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