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"
22 class CrossThreadPersistentRegion;
27 class PersistentNode
final {
32 PersistentNode&
operator=(
const PersistentNode&) =
delete;
57 trace_(visitor, owner_);
60 bool IsUsed()
const {
return trace_; }
75 TraceCallback trace_ =
nullptr;
79 using PersistentNodeSlots = std::array<PersistentNode, 256u>;
90 if (!free_list_head_) {
93 PersistentNode* node = free_list_head_;
105 free_list_head_ = node;
117 void EnsureNodeSlots();
119 template <
typename PersistentBaseClass>
120 void ClearAllUsedNodes();
122 std::vector<std::unique_ptr<PersistentNodeSlots>> nodes_;
123 PersistentNode* free_list_head_ =
nullptr;
124 size_t nodes_in_use_ = 0;
126 friend class CrossThreadPersistentRegion;
148 CrossThreadPersistentRegion&
operator=(
const CrossThreadPersistentRegion&) =