| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium 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 PageMemory_h | 5 #ifndef PageMemory_h |
| 6 #define PageMemory_h | 6 #define PageMemory_h |
| 7 | 7 |
| 8 #include "platform/heap/HeapPage.h" | 8 #include "platform/heap/HeapPage.h" |
| 9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
| 11 #include "wtf/Compiler.h" | 11 #include "wtf/Compiler.h" |
| 12 #include "wtf/allocator/Partitions.h" | 12 #include "wtf/allocator/Partitions.h" |
| 13 | 13 |
| 14 #if OS(POSIX) | |
| 15 #include <sys/mman.h> | |
| 16 #include <unistd.h> | |
| 17 #endif | |
| 18 | |
| 19 namespace blink { | 14 namespace blink { |
| 20 | 15 |
| 21 class RegionTree; | 16 class RegionTree; |
| 22 class RegionTreeNode; | 17 class RegionTreeNode; |
| 23 | 18 |
| 24 class MemoryRegion { | 19 class MemoryRegion { |
| 25 USING_FAST_MALLOC(MemoryRegion); | 20 USING_FAST_MALLOC(MemoryRegion); |
| 26 | 21 |
| 27 public: | 22 public: |
| 28 MemoryRegion(Address base, size_t size) : m_base(base), m_size(size) { | 23 MemoryRegion(Address base, size_t size) : m_base(base), m_size(size) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 USING_FAST_MALLOC(RegionTree); | 110 USING_FAST_MALLOC(RegionTree); |
| 116 | 111 |
| 117 public: | 112 public: |
| 118 RegionTree() : m_root(nullptr) {} | 113 RegionTree() : m_root(nullptr) {} |
| 119 | 114 |
| 120 void add(PageMemoryRegion*); | 115 void add(PageMemoryRegion*); |
| 121 void remove(PageMemoryRegion*); | 116 void remove(PageMemoryRegion*); |
| 122 PageMemoryRegion* lookup(Address); | 117 PageMemoryRegion* lookup(Address); |
| 123 | 118 |
| 124 private: | 119 private: |
| 125 Mutex m_mutex; | |
| 126 RegionTreeNode* m_root; | 120 RegionTreeNode* m_root; |
| 127 }; | 121 }; |
| 128 | 122 |
| 129 class RegionTreeNode { | 123 class RegionTreeNode { |
| 130 USING_FAST_MALLOC(RegionTreeNode); | 124 USING_FAST_MALLOC(RegionTreeNode); |
| 131 | 125 |
| 132 public: | 126 public: |
| 133 explicit RegionTreeNode(PageMemoryRegion* region) | 127 explicit RegionTreeNode(PageMemoryRegion* region) |
| 134 : m_region(region), m_left(nullptr), m_right(nullptr) {} | 128 : m_region(region), m_left(nullptr), m_right(nullptr) {} |
| 135 | 129 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 private: | 199 private: |
| 206 PageMemory(PageMemoryRegion* reserved, const MemoryRegion& writable); | 200 PageMemory(PageMemoryRegion* reserved, const MemoryRegion& writable); |
| 207 | 201 |
| 208 PageMemoryRegion* m_reserved; | 202 PageMemoryRegion* m_reserved; |
| 209 MemoryRegion m_writable; | 203 MemoryRegion m_writable; |
| 210 }; | 204 }; |
| 211 | 205 |
| 212 } // namespace blink | 206 } // namespace blink |
| 213 | 207 |
| 214 #endif | 208 #endif |
| OLD | NEW |