Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Unified Diff: src/zone/accounting-allocator.h

Issue 2365843002: Revert of Pool implementation for zone segments (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/v8.gyp ('k') | src/zone/accounting-allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/zone/accounting-allocator.h
diff --git a/src/zone/accounting-allocator.h b/src/zone/accounting-allocator.h
index f0f2cd11737214f8a805f6d28ec11d7eb4ddbb4e..01c38186d6809e44a4f08ebcc287ee1d09dcdc5d 100644
--- a/src/zone/accounting-allocator.h
+++ b/src/zone/accounting-allocator.h
@@ -19,54 +19,18 @@
class AccountingAllocator {
public:
- AccountingAllocator();
- virtual ~AccountingAllocator();
+ AccountingAllocator() = default;
+ virtual ~AccountingAllocator() = default;
- // Gets an empty segment from the pool or creates a new one.
- virtual Segment* GetSegment(size_t bytes);
- // Return unneeded segments to either insert them into the pool or release
- // them if the pool is already full or memory pressure is high.
- virtual void ReturnSegment(Segment* memory);
+ virtual Segment* AllocateSegment(size_t bytes);
+ virtual void FreeSegment(Segment* memory);
size_t GetCurrentMemoryUsage() const;
size_t GetMaxMemoryUsage() const;
- size_t GetCurrentPoolSize() const;
-
- void MemoryPressureNotification(MemoryPressureLevel level);
-
private:
- static const uint8_t kMinSegmentSizePower = 13;
- static const uint8_t kMaxSegmentSizePower = 18;
- static const uint8_t kMaxSegmentsPerBucket = 5;
-
- STATIC_ASSERT(kMinSegmentSizePower <= kMaxSegmentSizePower);
-
- // Allocates a new segment. Returns nullptr on failed allocation.
- Segment* AllocateSegment(size_t bytes);
- void FreeSegment(Segment* memory);
-
- // Returns a segment from the pool of at least the requested size.
- Segment* GetSegmentFromPool(size_t requested_size);
- // Trys to add a segment to the pool. Returns false if the pool is full.
- bool AddSegmentToPool(Segment* segment);
-
- // Empties the pool and puts all its contents onto the garbage stack.
- void ClearPool();
-
- Segment*
- unused_segments_heads_[1 + kMaxSegmentSizePower - kMinSegmentSizePower];
-
- size_t unused_segments_sizes[1 + kMaxSegmentSizePower - kMinSegmentSizePower];
-
- size_t unused_segments_size_ = 0;
-
- base::Mutex unused_segments_mutex_;
-
base::AtomicWord current_memory_usage_ = 0;
base::AtomicWord max_memory_usage_ = 0;
-
- base::AtomicValue<MemoryPressureLevel> memory_pressure_level_;
DISALLOW_COPY_AND_ASSIGN(AccountingAllocator);
};
« no previous file with comments | « src/v8.gyp ('k') | src/zone/accounting-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698