Lines Matching refs:SharedBuffer
17 #define LOG_TAG "sharedbuffer"
19 #include "SharedBuffer.h"
30 SharedBuffer* SharedBuffer::alloc(size_t size)
34 LOG_ALWAYS_FATAL_IF((size >= (SIZE_MAX - sizeof(SharedBuffer))),
37 SharedBuffer* sb = static_cast<SharedBuffer *>(malloc(sizeof(SharedBuffer) + size));
49 void SharedBuffer::dealloc(const SharedBuffer* released)
51 free(const_cast<SharedBuffer*>(released));
54 SharedBuffer* SharedBuffer::edit() const
57 return const_cast<SharedBuffer*>(this);
59 SharedBuffer* sb = alloc(mSize);
67 SharedBuffer* SharedBuffer::editResize(size_t newSize) const
70 SharedBuffer* buf = const_cast<SharedBuffer*>(this);
74 LOG_ALWAYS_FATAL_IF((newSize >= (SIZE_MAX - sizeof(SharedBuffer))),
77 buf = (SharedBuffer*)realloc(buf, sizeof(SharedBuffer) + newSize);
83 SharedBuffer* sb = alloc(newSize);
92 SharedBuffer* SharedBuffer::attemptEdit() const
95 return const_cast<SharedBuffer*>(this);
100 SharedBuffer* SharedBuffer::reset(size_t new_size) const
103 SharedBuffer* sb = alloc(new_size);
110 void SharedBuffer::acquire() const {
114 int32_t SharedBuffer::release(uint32_t flags) const