Classes | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
google::protobuf.internal::ThreadSafeArena Class Reference

#include <arena_impl.h>

Classes

struct  CacheAlignedLifecycleIdGenerator
 
struct  ThreadCache
 

Public Member Functions

void AddCleanup (void *elem, void(*cleanup)(void *))
 
void * AllocateAligned (size_t n, const std::type_info *type)
 
std::pair< void *, SerialArena::CleanupNode * > AllocateAlignedWithCleanup (size_t n, const std::type_info *type)
 
PROTOBUF_ALWAYS_INLINE bool IsMessageOwned () const
 
PROTOBUF_NDEBUG_INLINE bool MaybeAllocateAligned (size_t n, void **out)
 
uint64_t Reset ()
 
uint64_t SpaceAllocated () const
 
uint64_t SpaceUsed () const
 
 ThreadSafeArena ()
 
 ThreadSafeArena (char *mem, size_t size)
 
 ThreadSafeArena (internal::MessageOwned)
 
 ThreadSafeArena (void *mem, size_t size, const AllocationPolicy &policy)
 
 ~ThreadSafeArena ()
 

Static Public Attributes

static constexpr size_t kBlockHeaderSize = SerialArena::kBlockHeaderSize
 
static constexpr size_t kSerialArenaSize
 

Private Types

enum  : uint64_t { kMessageOwnedArena = 1 }
 

Private Member Functions

void * AllocateAlignedFallback (size_t n, const std::type_info *type)
 
std::pair< void *, SerialArena::CleanupNode * > AllocateAlignedWithCleanupFallback (size_t n, const std::type_info *type)
 
const AllocationPolicyAllocPolicy () const
 
void CacheSerialArena (SerialArena *serial)
 
void CleanupList ()
 
SerialArena::Memory Free (size_t *space_allocated)
 
SerialArenaGetSerialArenaFallback (void *me)
 
PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast (SerialArena **arena)
 
PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFromThreadCache (SerialArena **arena)
 
 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS (ThreadSafeArena)
 
void Init ()
 
void InitializeFrom (void *mem, size_t size)
 
void InitializeWithPolicy (void *mem, size_t size, AllocationPolicy policy)
 
uint64_t LifeCycleId () const
 
ThreadSafeArenaoperator= (ThreadSafeArena &&)=delete
 
template<typename Functor >
void PerSerialArena (Functor fn)
 
void SetInitialBlock (void *mem, size_t size)
 
 ThreadSafeArena (ThreadSafeArena &&)=delete
 

Static Private Member Functions

static ThreadCachethread_cache ()
 

Private Attributes

TaggedAllocationPolicyPtr alloc_policy_
 
std::atomic< SerialArena * > hint_
 
uint64_t tag_and_id_ = 0
 
std::atomic< SerialArena * > threads_
 

Static Private Attributes

static CacheAlignedLifecycleIdGenerator lifecycle_id_generator_
 
static PROTOBUF_THREAD_LOCAL ThreadCache thread_cache_
 

Detailed Description

Definition at line 344 of file protobuf/src/google/protobuf/arena_impl.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : uint64_t
private
Enumerator
kMessageOwnedArena 

Definition at line 410 of file protobuf/src/google/protobuf/arena_impl.h.

Constructor & Destructor Documentation

◆ ThreadSafeArena() [1/5]

google::protobuf.internal::ThreadSafeArena::ThreadSafeArena ( )
inline

Definition at line 346 of file protobuf/src/google/protobuf/arena_impl.h.

◆ ThreadSafeArena() [2/5]

google::protobuf.internal::ThreadSafeArena::ThreadSafeArena ( internal::MessageOwned  )
inline

Definition at line 349 of file protobuf/src/google/protobuf/arena_impl.h.

◆ ThreadSafeArena() [3/5]

google::protobuf.internal::ThreadSafeArena::ThreadSafeArena ( char *  mem,
size_t  size 
)
inline

Definition at line 353 of file protobuf/src/google/protobuf/arena_impl.h.

◆ ThreadSafeArena() [4/5]

google::protobuf.internal::ThreadSafeArena::ThreadSafeArena ( void *  mem,
size_t  size,
const AllocationPolicy policy 
)
inlineexplicit

Definition at line 355 of file protobuf/src/google/protobuf/arena_impl.h.

◆ ~ThreadSafeArena()

google::protobuf.internal::ThreadSafeArena::~ThreadSafeArena ( )

◆ ThreadSafeArena() [5/5]

google::protobuf.internal::ThreadSafeArena::ThreadSafeArena ( ThreadSafeArena &&  )
privatedelete

Member Function Documentation

◆ AddCleanup()

void google::protobuf.internal::ThreadSafeArena::AddCleanup ( void *  elem,
void(*)(void *)  cleanup 
)

◆ AllocateAligned()

void* google::protobuf.internal::ThreadSafeArena::AllocateAligned ( size_t  n,
const std::type_info *  type 
)
inline

Definition at line 371 of file protobuf/src/google/protobuf/arena_impl.h.

◆ AllocateAlignedFallback()

PROTOBUF_NOINLINE void * google::protobuf.internal::ThreadSafeArena::AllocateAlignedFallback ( size_t  n,
const std::type_info *  type 
)
private

◆ AllocateAlignedWithCleanup()

std::pair< void *, SerialArena::CleanupNode * > google::protobuf.internal::ThreadSafeArena::AllocateAlignedWithCleanup ( size_t  n,
const std::type_info *  type 
)

◆ AllocateAlignedWithCleanupFallback()

PROTOBUF_NOINLINE std::pair< void *, SerialArena::CleanupNode * > google::protobuf.internal::ThreadSafeArena::AllocateAlignedWithCleanupFallback ( size_t  n,
const std::type_info *  type 
)
private

◆ AllocPolicy()

const AllocationPolicy* google::protobuf.internal::ThreadSafeArena::AllocPolicy ( ) const
inlineprivate

Definition at line 418 of file protobuf/src/google/protobuf/arena_impl.h.

◆ CacheSerialArena()

void google::protobuf.internal::ThreadSafeArena::CacheSerialArena ( SerialArena serial)
inlineprivate

Definition at line 435 of file protobuf/src/google/protobuf/arena_impl.h.

◆ CleanupList()

void google::protobuf.internal::ThreadSafeArena::CleanupList ( )
private

◆ Free()

SerialArena::Memory google::protobuf.internal::ThreadSafeArena::Free ( size_t *  space_allocated)
private

◆ GetSerialArenaFallback()

PROTOBUF_NOINLINE SerialArena * google::protobuf.internal::ThreadSafeArena::GetSerialArenaFallback ( void *  me)
private

◆ GetSerialArenaFast()

PROTOBUF_NDEBUG_INLINE bool google::protobuf.internal::ThreadSafeArena::GetSerialArenaFast ( SerialArena **  arena)
inlineprivate

Definition at line 445 of file protobuf/src/google/protobuf/arena_impl.h.

◆ GetSerialArenaFromThreadCache()

PROTOBUF_NDEBUG_INLINE bool google::protobuf.internal::ThreadSafeArena::GetSerialArenaFromThreadCache ( SerialArena **  arena)
inlineprivate

Definition at line 459 of file protobuf/src/google/protobuf/arena_impl.h.

◆ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS()

google::protobuf.internal::ThreadSafeArena::GOOGLE_DISALLOW_EVIL_CONSTRUCTORS ( ThreadSafeArena  )
private

◆ Init()

void google::protobuf.internal::ThreadSafeArena::Init ( )
private

◆ InitializeFrom()

void google::protobuf.internal::ThreadSafeArena::InitializeFrom ( void *  mem,
size_t  size 
)
private

◆ InitializeWithPolicy()

void google::protobuf.internal::ThreadSafeArena::InitializeWithPolicy ( void *  mem,
size_t  size,
AllocationPolicy  policy 
)
private

◆ IsMessageOwned()

PROTOBUF_ALWAYS_INLINE bool google::protobuf.internal::ThreadSafeArena::IsMessageOwned ( ) const
inline

Definition at line 402 of file protobuf/src/google/protobuf/arena_impl.h.

◆ LifeCycleId()

uint64_t google::protobuf.internal::ThreadSafeArena::LifeCycleId ( ) const
inlineprivate

Definition at line 431 of file protobuf/src/google/protobuf/arena_impl.h.

◆ MaybeAllocateAligned()

PROTOBUF_NDEBUG_INLINE bool google::protobuf.internal::ThreadSafeArena::MaybeAllocateAligned ( size_t  n,
void **  out 
)
inline

Definition at line 386 of file protobuf/src/google/protobuf/arena_impl.h.

◆ operator=()

ThreadSafeArena& google::protobuf.internal::ThreadSafeArena::operator= ( ThreadSafeArena &&  )
privatedelete

◆ PerSerialArena()

template<typename Functor >
void google::protobuf.internal::ThreadSafeArena::PerSerialArena ( Functor  fn)
inlineprivate

Definition at line 474 of file protobuf/src/google/protobuf/arena_impl.h.

◆ Reset()

uint64_t google::protobuf.internal::ThreadSafeArena::Reset ( )

◆ SetInitialBlock()

void google::protobuf.internal::ThreadSafeArena::SetInitialBlock ( void *  mem,
size_t  size 
)
private

◆ SpaceAllocated()

uint64_t google::protobuf.internal::ThreadSafeArena::SpaceAllocated ( ) const

◆ SpaceUsed()

uint64_t google::protobuf.internal::ThreadSafeArena::SpaceUsed ( ) const

◆ thread_cache()

static ThreadCache& google::protobuf.internal::ThreadSafeArena::thread_cache ( )
inlinestaticprivate

Definition at line 535 of file protobuf/src/google/protobuf/arena_impl.h.

Member Data Documentation

◆ alloc_policy_

TaggedAllocationPolicyPtr google::protobuf.internal::ThreadSafeArena::alloc_policy_
private

Definition at line 412 of file protobuf/src/google/protobuf/arena_impl.h.

◆ hint_

std::atomic<SerialArena*> google::protobuf.internal::ThreadSafeArena::hint_
private

Definition at line 416 of file protobuf/src/google/protobuf/arena_impl.h.

◆ kBlockHeaderSize

constexpr size_t google::protobuf.internal::ThreadSafeArena::kBlockHeaderSize = SerialArena::kBlockHeaderSize
staticconstexpr

Definition at line 547 of file protobuf/src/google/protobuf/arena_impl.h.

◆ kSerialArenaSize

constexpr size_t google::protobuf.internal::ThreadSafeArena::kSerialArenaSize
staticconstexpr
Initial value:
=
(sizeof(SerialArena) + 7) & static_cast<size_t>(-8)

Definition at line 548 of file protobuf/src/google/protobuf/arena_impl.h.

◆ lifecycle_id_generator_

ThreadSafeArena::CacheAlignedLifecycleIdGenerator google::protobuf.internal::ThreadSafeArena::lifecycle_id_generator_
staticprivate

Definition at line 524 of file protobuf/src/google/protobuf/arena_impl.h.

◆ tag_and_id_

uint64_t google::protobuf.internal::ThreadSafeArena::tag_and_id_ = 0
private

Definition at line 408 of file protobuf/src/google/protobuf/arena_impl.h.

◆ thread_cache_

PROTOBUF_THREAD_LOCAL ThreadSafeArena::ThreadCache google::protobuf.internal::ThreadSafeArena::thread_cache_
staticprivate
Initial value:
= {0, static_cast<LifecycleIdAtomic>(-1),
nullptr}

Definition at line 534 of file protobuf/src/google/protobuf/arena_impl.h.

◆ threads_

std::atomic<SerialArena*> google::protobuf.internal::ThreadSafeArena::threads_
private

Definition at line 415 of file protobuf/src/google/protobuf/arena_impl.h.


The documentation for this class was generated from the following files:
google::protobuf.internal::LifecycleIdAtomic
uint64_t LifecycleIdAtomic
Definition: protobuf/src/google/protobuf/arena_impl.h:59


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:26