5 #ifndef INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_
6 #define INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_
12 #include "cppgc/internal/logging.h"
13 #include "cppgc/trace-trait.h"
25 class PersistentNode
final {
30 PersistentNode&
operator=(
const PersistentNode&) =
delete;
54 trace_(visitor, owner_);
57 bool IsUsed()
const {
return trace_; }
69 void* owner_ =
nullptr;
70 PersistentNode* next_;
72 TraceCallback trace_ =
nullptr;
76 using PersistentNodeSlots = std::array<PersistentNode, 256u>;
84 PersistentRegion&
operator=(
const PersistentRegion&) =
delete;
87 if (!free_list_head_) {
90 PersistentNode* node = free_list_head_;
99 free_list_head_ = node;
111 void EnsureNodeSlots();
113 std::vector<std::unique_ptr<PersistentNodeSlots>> nodes_;
114 PersistentNode* free_list_head_ =
nullptr;
115 size_t nodes_in_use_ = 0;