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

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

Issue 2344143003: Moved zones and zone related stuff in its own directory. (Closed)
Patch Set: Merge branch 'master' into zonefolder 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/zone-containers.h ('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
new file mode 100644
index 0000000000000000000000000000000000000000..01c38186d6809e44a4f08ebcc287ee1d09dcdc5d
--- /dev/null
+++ b/src/zone/accounting-allocator.h
@@ -0,0 +1,41 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_ZONE_ACCOUNTING_ALLOCATOR_H_
+#define V8_ZONE_ACCOUNTING_ALLOCATOR_H_
+
+#include "include/v8-platform.h"
+#include "src/base/atomic-utils.h"
+#include "src/base/atomicops.h"
+#include "src/base/macros.h"
+#include "src/base/platform/mutex.h"
+#include "src/base/platform/semaphore.h"
+#include "src/base/platform/time.h"
+#include "src/zone/zone-segment.h"
+
+namespace v8 {
+namespace internal {
+
+class AccountingAllocator {
+ public:
+ AccountingAllocator() = default;
+ virtual ~AccountingAllocator() = default;
+
+ virtual Segment* AllocateSegment(size_t bytes);
+ virtual void FreeSegment(Segment* memory);
+
+ size_t GetCurrentMemoryUsage() const;
+ size_t GetMaxMemoryUsage() const;
+
+ private:
+ base::AtomicWord current_memory_usage_ = 0;
+ base::AtomicWord max_memory_usage_ = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(AccountingAllocator);
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_ZONE_ACCOUNTING_ALLOCATOR_H_
« no previous file with comments | « src/zone-containers.h ('k') | src/zone/accounting-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698