| Index: src/zone.h
|
| diff --git a/src/zone.h b/src/zone.h
|
| index 753e2035d3ac612060cb1391c33f29db5df9110f..4973405a4ec1b7bf07d7080feac62423419a7794 100644
|
| --- a/src/zone.h
|
| +++ b/src/zone.h
|
| @@ -7,7 +7,7 @@
|
|
|
| #include <limits>
|
|
|
| -#include "src/allocation.h"
|
| +#include "src/base/accounting_allocator.h"
|
| #include "src/base/logging.h"
|
| #include "src/globals.h"
|
| #include "src/hashmap.h"
|
| @@ -33,9 +33,9 @@ class Segment;
|
| //
|
| // Note: The implementation is inherently not thread safe. Do not use
|
| // from multi-threaded code.
|
| -class Zone final {
|
| +class Zone {
|
| public:
|
| - Zone();
|
| + explicit Zone(base::AccountingAllocator* allocator);
|
| ~Zone();
|
|
|
| // Allocate 'size' bytes of memory in the Zone; expands the Zone by
|
| @@ -64,6 +64,8 @@ class Zone final {
|
|
|
| size_t allocation_size() const { return allocation_size_; }
|
|
|
| + base::AccountingAllocator* allocator() const { return allocator_; }
|
| +
|
| private:
|
| // All pointers returned from New() have this alignment. In addition, if the
|
| // object being allocated has a size that is divisible by 8 then its alignment
|
| @@ -114,6 +116,8 @@ class Zone final {
|
| Address position_;
|
| Address limit_;
|
|
|
| + base::AccountingAllocator* allocator_;
|
| +
|
| Segment* segment_head_;
|
| };
|
|
|
| @@ -165,6 +169,16 @@ class ZoneAllocationPolicy final {
|
| Zone* zone_;
|
| };
|
|
|
| +class ZoneForTesting : public Zone {
|
| + public:
|
| + ZoneForTesting() : Zone(&allocator_) {}
|
| + ~ZoneForTesting() = default;
|
| +
|
| + private:
|
| + base::AccountingAllocator allocator_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ZoneForTesting);
|
| +};
|
|
|
| // ZoneLists are growable lists with constant-time access to the
|
| // elements. The list itself and all its elements are allocated in the
|
|
|