23template <
int BlockSize>
26template <
int BlockSize>
29template <
int BlockSize>
31 global_empty_ =
new List();
32 if (global_mutex_ ==
nullptr) {
33 global_mutex_ =
new Mutex();
37template <
int BlockSize>
40 global_empty_ =
nullptr;
43template <
int BlockSize>
46template <
int BlockSize>
51template <
int BlockSize>
57 while (!full_.IsEmpty()) {
60 global_empty_->Push(block);
62 while (!partial_.IsEmpty()) {
65 global_empty_->Push(block);
71template <
int BlockSize>
74 while (!partial_.IsEmpty()) {
75 full_.Push(partial_.Pop());
77 return full_.PopAll();
80template <
int BlockSize>
82 while (block !=
nullptr) {
90template <
int BlockSize>
95 bool was_empty = IsEmptyLocked();
97 if (was_empty) ml.Notify();
100 global_empty_->Push(block);
104 bool was_empty = IsEmptyLocked();
105 partial_.Push(block);
106 if (was_empty) ml.Notify();
110template <
int BlockSize>
125 if (!full_.IsEmpty()) {
129 if (!partial_.IsEmpty()) {
131 return partial_.Pop();
134 if (num_busy->
load() == 0) {
161template <
int BlockSize>
166 if (!partial_.IsEmpty()) {
167 return partial_.Pop();
170 return PopEmptyBlock();
173template <
int BlockSize>
177 if (!global_empty_->IsEmpty()) {
178 return global_empty_->Pop();
184template <
int BlockSize>
188 if (!full_.IsEmpty()) {
190 }
else if (!partial_.IsEmpty()) {
191 return partial_.Pop();
197template <
int BlockSize>
200 return IsEmptyLocked();
203template <
int BlockSize>
205 return full_.IsEmpty() && partial_.IsEmpty();
208template <
int BlockSize>
215template <
int BlockSize>
218 head_ = head_->next_;
224template <
int BlockSize>
232template <
int BlockSize>
234 ASSERT(block->next_ ==
nullptr);
235 block->next_ = head_;
250template <
int BlockSize>
256 block = block->
next()) {
261template <
int BlockSize>
static float next(float f)
SkBlockAllocator::Block Block
SkIDChangeListener::List List
#define DEBUG_ASSERT(cond)
static void TrimGlobalEmpty()
Block * PopNonFullBlock()
static Mutex * global_mutex_
Block * WaitForWork(RelaxedAtomic< uintptr_t > *num_busy, bool abort)
static List * global_empty_
void PushAll(Block *blocks)
void VisitObjectPointers(ObjectPointerVisitor *visitor)
static constexpr intptr_t kMaxGlobalEmpty
void PushBlockImpl(Block *block)
Block * PopNonEmptyBlock()
StoreBuffer * store_buffer() const
bool IsOwnedByCurrentThread() const
virtual void VisitPointers(ObjectPtr *first, ObjectPtr *last)=0
PointerBlock< Size > * next() const
void set_next(PointerBlock< Size > *next)
void VisitObjectPointers(ObjectPointerVisitor *visitor)
T load(std::memory_order order=std::memory_order_relaxed) const
T fetch_add(T arg, std::memory_order order=std::memory_order_relaxed)
T fetch_sub(T arg, std::memory_order order=std::memory_order_relaxed)
void PushBlock(Block *block, ThresholdPolicy policy)
void ScheduleInterrupts(uword interrupt_bits)
void MarkingStackBlockProcess()
static Thread * Current()
void StoreBufferBlockProcess(StoreBuffer::ThresholdPolicy policy)
IsolateGroup * isolate_group() const
#define MSAN_UNPOISON(ptr, len)
#define END_LEAF_RUNTIME_ENTRY
#define DEFINE_LEAF_RUNTIME_ENTRY(type, name, argument_count,...)