OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef Partitions_h | 31 #ifndef Partitions_h |
32 #define Partitions_h | 32 #define Partitions_h |
33 | 33 |
34 #include "wtf/PartitionAlloc.h" | 34 #include "wtf/PartitionAlloc.h" |
| 35 #include "wtf/WTF.h" |
35 #include "wtf/WTFExport.h" | 36 #include "wtf/WTFExport.h" |
36 | 37 |
37 namespace WTF { | 38 namespace WTF { |
38 | 39 |
39 class WTF_EXPORT Partitions { | 40 class WTF_EXPORT Partitions { |
40 public: | 41 public: |
41 static void initialize(); | 42 static void initialize(HistogramEnumerationFunction = nullptr); |
42 static void shutdown(); | 43 static void shutdown(); |
43 ALWAYS_INLINE static PartitionRootGeneric* getBufferPartition() | 44 ALWAYS_INLINE static PartitionRootGeneric* getBufferPartition() |
44 { | 45 { |
45 // TODO(haraken): This check is needed because some call sites allocate | 46 // TODO(haraken): This check is needed because some call sites allocate |
46 // Blink things before WTF::initialize(). We should fix those call sites | 47 // Blink things before WTF::initialize(). We should fix those call sites |
47 // and remove the check. | 48 // and remove the check. |
48 if (UNLIKELY(!s_initialized)) | 49 if (UNLIKELY(!s_initialized)) |
49 initialize(); | 50 initialize(); |
50 return m_bufferAllocator.root(); | 51 return m_bufferAllocator.root(); |
51 } | 52 } |
(...skipping 28 matching lines...) Expand all Loading... |
80 static size_t totalSizeOfCommittedPages() | 81 static size_t totalSizeOfCommittedPages() |
81 { | 82 { |
82 size_t totalSize = 0; | 83 size_t totalSize = 0; |
83 totalSize += m_fastMallocAllocator.root()->totalSizeOfCommittedPages; | 84 totalSize += m_fastMallocAllocator.root()->totalSizeOfCommittedPages; |
84 totalSize += m_bufferAllocator.root()->totalSizeOfCommittedPages; | 85 totalSize += m_bufferAllocator.root()->totalSizeOfCommittedPages; |
85 totalSize += m_objectModelAllocator.root()->totalSizeOfCommittedPages; | 86 totalSize += m_objectModelAllocator.root()->totalSizeOfCommittedPages; |
86 totalSize += m_renderingAllocator.root()->totalSizeOfCommittedPages; | 87 totalSize += m_renderingAllocator.root()->totalSizeOfCommittedPages; |
87 return totalSize; | 88 return totalSize; |
88 } | 89 } |
89 | 90 |
| 91 static void notifyCommittedMemoryChanged(); |
| 92 |
90 private: | 93 private: |
91 static bool s_initialized; | 94 static bool s_initialized; |
92 static PartitionAllocatorGeneric m_fastMallocAllocator; | 95 static PartitionAllocatorGeneric m_fastMallocAllocator; |
93 static PartitionAllocatorGeneric m_bufferAllocator; | 96 static PartitionAllocatorGeneric m_bufferAllocator; |
94 static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator; | 97 static SizeSpecificPartitionAllocator<3328> m_objectModelAllocator; |
95 static SizeSpecificPartitionAllocator<1024> m_renderingAllocator; | 98 static SizeSpecificPartitionAllocator<1024> m_renderingAllocator; |
| 99 static HistogramEnumerationFunction m_histogramEnumeration; |
96 }; | 100 }; |
97 | 101 |
98 } // namespace WTF | 102 } // namespace WTF |
99 | 103 |
100 #endif // Partitions_h | 104 #endif // Partitions_h |
OLD | NEW |