Home
last modified time | relevance | path

Searched refs:SharedBuffer (Results 1 – 7 of 7) sorted by relevance

/system/core/libutils/
DSharedBuffer.h32 class SharedBuffer
44 static SharedBuffer* alloc(size_t size);
51 static void dealloc(const SharedBuffer* released);
63 static inline SharedBuffer* bufferFromData(void* data);
66 static inline const SharedBuffer* bufferFromData(const void* data);
72 SharedBuffer* edit() const;
75 SharedBuffer* editResize(size_t size) const;
78 SharedBuffer* attemptEdit() const;
81 SharedBuffer* reset(size_t size) const;
97 inline SharedBuffer() { } in SharedBuffer() function
[all …]
DSharedBuffer.cpp30 SharedBuffer* SharedBuffer::alloc(size_t size) in alloc()
34 LOG_ALWAYS_FATAL_IF((size >= (SIZE_MAX - sizeof(SharedBuffer))), in alloc()
37 SharedBuffer* sb = static_cast<SharedBuffer *>(malloc(sizeof(SharedBuffer) + size)); in alloc()
49 void SharedBuffer::dealloc(const SharedBuffer* released) in dealloc()
51 free(const_cast<SharedBuffer*>(released)); in dealloc()
54 SharedBuffer* SharedBuffer::edit() const in edit()
57 return const_cast<SharedBuffer*>(this); in edit()
59 SharedBuffer* sb = alloc(mSize); in edit()
67 SharedBuffer* SharedBuffer::editResize(size_t newSize) const in editResize()
70 SharedBuffer* buf = const_cast<SharedBuffer*>(this); in editResize()
[all …]
DSharedBuffer_test.cpp27 EXPECT_DEATH(android::SharedBuffer::alloc(SIZE_MAX), ""); in TEST()
28 EXPECT_DEATH(android::SharedBuffer::alloc(SIZE_MAX - sizeof(android::SharedBuffer)), ""); in TEST()
32 android::SharedBuffer* buf = in TEST()
33 android::SharedBuffer::alloc(SIZE_MAX - sizeof(android::SharedBuffer) - 1); in TEST()
36 buf = android::SharedBuffer::alloc(0); in TEST()
43 android::SharedBuffer* buf = android::SharedBuffer::alloc(10); in TEST()
44 EXPECT_DEATH(buf->editResize(SIZE_MAX - sizeof(android::SharedBuffer)), ""); in TEST()
45 buf = android::SharedBuffer::alloc(10); in TEST()
48 buf = android::SharedBuffer::alloc(10); in TEST()
51 buf = buf->editResize(SIZE_MAX - sizeof(android::SharedBuffer) - 1); in TEST()
[all …]
DString16.cpp28 static SharedBuffer* gEmptyStringBuf = [] { in getEmptyString()
29 SharedBuffer* buf = SharedBuffer::alloc(sizeof(char16_t)); in getEmptyString()
52 SharedBuffer* buf = SharedBuffer::alloc(sizeof(char16_t)*(u16len+1)); in allocFromUTF8()
75 SharedBuffer* buf = SharedBuffer::alloc((u16len + 1) * sizeof(char16_t)); in allocFromUTF16()
101 SharedBuffer::alloc(sizeof(char16_t))->data()); in String16()
109 SharedBuffer::bufferFromData(mString)->acquire(); in String16()
139 SharedBuffer::bufferFromData(mString)->release(); in ~String16()
144 return SharedBuffer::sizeFromData(mString)/sizeof(char16_t)-1; in size()
149 SharedBuffer::bufferFromData(other.mString)->acquire(); in setTo()
150 SharedBuffer::bufferFromData(mString)->release(); in setTo()
[all …]
DString8.cpp44 static SharedBuffer* gEmptyStringBuf = [] { in getEmptyString()
45 SharedBuffer* buf = SharedBuffer::alloc(1); in getEmptyString()
63 SharedBuffer* buf = SharedBuffer::alloc(len+1); in allocFromUTF8()
87 SharedBuffer* buf = SharedBuffer::alloc(resultStrLen); in allocFromUTF16()
109 SharedBuffer* buf = SharedBuffer::alloc(resultStrLen); in allocFromUTF32()
136 SharedBuffer::alloc(sizeof(char))->data()); in String8()
144 SharedBuffer::bufferFromData(mString)->acquire(); in String8()
190 SharedBuffer::bufferFromData(mString)->release(); in ~String8()
195 return SharedBuffer::sizeFromData(mString)-1; in length()
217 SharedBuffer::bufferFromData(mString)->release(); in clear()
[all …]
DVectorImpl.cpp54 SharedBuffer::bufferFromData(mStorage)->acquire(); in VectorImpl()
76 SharedBuffer::bufferFromData(mStorage)->acquire(); in operator =()
88 const SharedBuffer* sb = SharedBuffer::bufferFromData(mStorage); in editArrayImpl()
89 SharedBuffer* editable = sb->attemptEdit(); in editArrayImpl()
93 editable = SharedBuffer::alloc(sb->size()); in editArrayImpl()
109 return SharedBuffer::bufferFromData(mStorage)->size() / mItemSize; in capacity()
344 SharedBuffer* sb = SharedBuffer::alloc(new_allocation_size); in setCapacity()
369 const SharedBuffer* sb = SharedBuffer::bufferFromData(mStorage); in release_storage()
370 if (sb->release(SharedBuffer::eKeepStorage) == 1) { in release_storage()
372 SharedBuffer::dealloc(sb); in release_storage()
[all …]
DAndroid.bp132 "SharedBuffer.cpp",