Home | History | Annotate | Download | only in zone

Lines Matching refs:Segment

39   // The sum of the bytes of one segment of each size.
53 // full_size. If max_pool_size is no sum of segment sizes the actual pool
56 // TODO(heimbuef): Determine better strategy generating a segment sizes
72 Segment* AccountingAllocator::GetSegment(size_t bytes) {
73 Segment* result = GetSegmentFromPool(bytes);
84 Segment* AccountingAllocator::AllocateSegment(size_t bytes) {
94 return reinterpret_cast<Segment*>(memory);
97 void AccountingAllocator::ReturnSegment(Segment* segment) {
98 segment->ZapContents();
101 FreeSegment(segment);
102 } else if (!AddSegmentToPool(segment)) {
103 FreeSegment(segment);
107 void AccountingAllocator::FreeSegment(Segment* memory) {
126 Segment* AccountingAllocator::GetSegmentFromPool(size_t requested_size) {
137 Segment* segment;
141 segment = unused_segments_heads_[power];
143 if (segment != nullptr) {
144 unused_segments_heads_[power] = segment->next();
145 segment->set_next(nullptr);
149 &current_pool_size_, -static_cast<base::AtomicWord>(segment->size()));
153 if (segment) {
154 DCHECK_GE(segment->size(), requested_size);
156 return segment;
159 bool AccountingAllocator::AddSegmentToPool(Segment* segment) {
160 size_t size = segment->size();
180 segment->set_next(unused_segments_heads_[power]);
181 unused_segments_heads_[power] = segment;
194 Segment* current = unused_segments_heads_[power];
196 Segment* next = current->next();