#include <SkBlockAllocator.h>
Definition at line 71 of file SkBlockAllocator.h.
◆ ~Block()
SkBlockAllocator::Block::~Block |
( |
| ) |
|
Definition at line 48 of file SkBlockAllocator.cpp.
48 {
49 this->unpoisonRange(kDataStart, fSize);
50
51 SkASSERT(fSentinel == kAssignedMarker);
52 SkDEBUGCODE(fSentinel = kFreedMarker;)
53}
◆ avail()
template<size_t Align = 1, size_t Padding = 0>
int SkBlockAllocator::Block::avail |
( |
| ) |
const |
|
inline |
Definition at line 78 of file SkBlockAllocator.h.
78{
return std::max(0, fSize - this->cursor<Align, Padding>()); }
static float max(float r, float g, float b)
◆ firstAlignedOffset()
template<size_t Align = 1, size_t Padding = 0>
int SkBlockAllocator::Block::firstAlignedOffset |
( |
| ) |
const |
|
inline |
Definition at line 85 of file SkBlockAllocator.h.
85{ return this->alignedOffset<Align, Padding>(kDataStart); }
◆ metadata()
int SkBlockAllocator::Block::metadata |
( |
| ) |
const |
|
inline |
◆ operator delete()
void SkBlockAllocator::Block::operator delete |
( |
void * |
p | ) |
|
|
inline |
◆ ptr() [1/2]
void * SkBlockAllocator::Block::ptr |
( |
int |
offset | ) |
|
|
inline |
◆ ptr() [2/2]
const void * SkBlockAllocator::Block::ptr |
( |
int |
offset | ) |
const |
|
inline |
◆ release()
bool SkBlockAllocator::Block::release |
( |
int |
start, |
|
|
int |
end |
|
) |
| |
|
inline |
Release the byte range between offset 'start' (inclusive) and 'end' (exclusive). This will return true if those bytes were successfully reclaimed, i.e. a subsequent allocation request could occupy the space. Regardless of return value, the provided byte range that [start, end) represents should not be used until it's re-allocated with allocate<...>().
Definition at line 677 of file SkBlockAllocator.h.
677 {
678 SkASSERT(fSentinel == kAssignedMarker);
680
682
683 if (fCursor ==
end) {
685 return true;
686 } else {
687 return false;
688 }
689}
◆ resize()
bool SkBlockAllocator::Block::resize |
( |
int |
start, |
|
|
int |
end, |
|
|
int |
deltaBytes |
|
) |
| |
|
inline |
Resize a previously reserved byte range of offset 'start' (inclusive) to 'end' (exclusive). 'deltaBytes' is the SIGNED change to length of the reservation.
When negative this means the reservation is shrunk and the new length is (end - start - |deltaBytes|). If this new length would be 0, the byte range can no longer be used (as if it were released instead). Asserts that it would not shrink the reservation below 0.
If 'deltaBytes' is positive, the allocator attempts to increase the length of the reservation. If 'deltaBytes' is less than or equal to avail() and it was the last allocation in the block, it can be resized. If there is not enough available bytes to accommodate the increase in size, or another allocation is blocking the increase in size, then false will be returned and the reserved byte range is unmodified.
Definition at line 646 of file SkBlockAllocator.h.
646 {
647 SkASSERT(fSentinel == kAssignedMarker);
649
651
652 return false;
653 }
654 if (fCursor ==
end) {
655 int nextCursor =
end + deltaBytes;
657
658 if (nextCursor <= fSize && nextCursor >=
start) {
659 if (nextCursor < fCursor) {
660
661 this->poisonRange(nextCursor + 1,
end);
662 } else {
663
664 this->unpoisonRange(
end, nextCursor);
665 }
666
667 fCursor = nextCursor;
668 return true;
669 }
670 }
671 return false;
672}
static constexpr int kMaxAllocationSize
◆ setMetadata()
void SkBlockAllocator::Block::setMetadata |
( |
int |
value | ) |
|
|
inline |
◆ SkBlockAllocator
The documentation for this class was generated from the following files: