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 PagePool_h | 5 #ifndef PagePool_h |
6 #define PagePool_h | 6 #define PagePool_h |
7 | 7 |
8 #include "platform/heap/ThreadState.h" | 8 #include "platform/heap/ThreadState.h" |
9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/ThreadingPrimitives.h" | |
11 | 10 |
12 namespace blink { | 11 namespace blink { |
13 | 12 |
14 class PageMemory; | 13 class PageMemory; |
15 | 14 |
16 // Once pages have been used for one type of thread heap they will never be | 15 // Once pages have been used for one type of thread heap they will never be |
17 // reused for another type of thread heap. Instead of unmapping, we add the | 16 // reused for another type of thread heap. Instead of unmapping, we add the |
18 // pages to a pool of pages to be reused later by a thread heap of the same | 17 // pages to a pool of pages to be reused later by a thread heap of the same |
19 // type. This is done as a security feature to avoid type confusion. The | 18 // type. This is done as a security feature to avoid type confusion. The |
20 // heaps are type segregated by having separate thread arenas for different | 19 // heaps are type segregated by having separate thread arenas for different |
(...skipping 14 matching lines...) Expand all Loading... |
35 USING_FAST_MALLOC(PoolEntry); | 34 USING_FAST_MALLOC(PoolEntry); |
36 | 35 |
37 public: | 36 public: |
38 PoolEntry(PageMemory* data, PoolEntry* next) : data(data), next(next) {} | 37 PoolEntry(PageMemory* data, PoolEntry* next) : data(data), next(next) {} |
39 | 38 |
40 PageMemory* data; | 39 PageMemory* data; |
41 PoolEntry* next; | 40 PoolEntry* next; |
42 }; | 41 }; |
43 | 42 |
44 PoolEntry* m_pool[BlinkGC::NumberOfArenas]; | 43 PoolEntry* m_pool[BlinkGC::NumberOfArenas]; |
45 Mutex m_mutex[BlinkGC::NumberOfArenas]; | |
46 }; | 44 }; |
47 | 45 |
48 } // namespace blink | 46 } // namespace blink |
49 | 47 |
50 #endif | 48 #endif |
OLD | NEW |