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

Side by Side Diff: src/zone/accounting-allocator.h

Issue 2344143003: Moved zones and zone related stuff in its own directory. (Closed)
Patch Set: Moved zones and zone related stuff into it's own folder 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_BASE_ACCOUNTING_ALLOCATOR_H_ 5 #ifndef V8_BASE_ACCOUNTING_ALLOCATOR_H_
jochen (gone - plz use gerrit) 2016/09/16 13:14:52 please update this to V8_SRC_ZONE_ACCOUNTING...
heimbuef 2016/09/16 13:49:53 Done.
6 #define V8_BASE_ACCOUNTING_ALLOCATOR_H_ 6 #define V8_BASE_ACCOUNTING_ALLOCATOR_H_
7 7
8 #include "include/v8-platform.h"
9 #include "src/base/atomic-utils.h"
8 #include "src/base/atomicops.h" 10 #include "src/base/atomicops.h"
9 #include "src/base/macros.h" 11 #include "src/base/macros.h"
12 #include "src/base/platform/mutex.h"
13 #include "src/base/platform/semaphore.h"
14 #include "src/base/platform/time.h"
15 #include "src/zone/zone-segment.h"
10 16
11 namespace v8 { 17 namespace v8 {
12 namespace base { 18 namespace internal {
13 19
14 class AccountingAllocator { 20 class AccountingAllocator {
15 public: 21 public:
16 AccountingAllocator() = default; 22 AccountingAllocator() = default;
17 virtual ~AccountingAllocator() = default; 23 virtual ~AccountingAllocator() = default;
18 24
19 // Returns nullptr on failed allocation. 25 virtual Segment* AllocateSegment(size_t bytes);
20 virtual void* Allocate(size_t bytes); 26 virtual void FreeSegment(Segment* memory);
21 virtual void Free(void* memory, size_t bytes);
22 27
23 size_t GetCurrentMemoryUsage() const; 28 size_t GetCurrentMemoryUsage() const;
24 size_t GetMaxMemoryUsage() const; 29 size_t GetMaxMemoryUsage() const;
25 30
26 private: 31 private:
27 AtomicWord current_memory_usage_ = 0; 32 base::AtomicWord current_memory_usage_ = 0;
28 AtomicWord max_memory_usage_ = 0; 33 base::AtomicWord max_memory_usage_ = 0;
29 34
30 DISALLOW_COPY_AND_ASSIGN(AccountingAllocator); 35 DISALLOW_COPY_AND_ASSIGN(AccountingAllocator);
31 }; 36 };
32 37
33 } // namespace base 38 } // namespace internal
34 } // namespace v8 39 } // namespace v8
35 40
36 #endif // V8_BASE_ACCOUNTING_ALLOCATOR_H_ 41 #endif // V8_BASE_ACCOUNTING_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698