| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "wtf/PartitionAlloc.h" | 34 #include "wtf/PartitionAlloc.h" |
| 35 #include "wtf/WTF.h" | 35 #include "wtf/WTF.h" |
| 36 #include "wtf/WTFExport.h" | 36 #include "wtf/WTFExport.h" |
| 37 #include <string.h> | 37 #include <string.h> |
| 38 | 38 |
| 39 namespace WTF { | 39 namespace WTF { |
| 40 | 40 |
| 41 class WTF_EXPORT Partitions { | 41 class WTF_EXPORT Partitions { |
| 42 public: | 42 public: |
| 43 typedef void (*ReportPartitionAllocSizeFunction)(size_t); |
| 44 |
| 43 // Name of allocator used by tracing for marking sub-allocations while take | 45 // Name of allocator used by tracing for marking sub-allocations while take |
| 44 // memory snapshots. | 46 // memory snapshots. |
| 45 static const char* const kAllocatedObjectPoolName; | 47 static const char* const kAllocatedObjectPoolName; |
| 46 | 48 |
| 47 static void initialize(HistogramEnumerationFunction); | 49 static void initialize(ReportPartitionAllocSizeFunction); |
| 48 static void shutdown(); | 50 static void shutdown(); |
| 49 ALWAYS_INLINE static PartitionRootGeneric* bufferPartition() | 51 ALWAYS_INLINE static PartitionRootGeneric* bufferPartition() |
| 50 { | 52 { |
| 51 ASSERT(s_initialized); | 53 ASSERT(s_initialized); |
| 52 return m_bufferAllocator.root(); | 54 return m_bufferAllocator.root(); |
| 53 } | 55 } |
| 54 | 56 |
| 55 ALWAYS_INLINE static PartitionRootGeneric* fastMallocPartition() | 57 ALWAYS_INLINE static PartitionRootGeneric* fastMallocPartition() |
| 56 { | 58 { |
| 57 ASSERT(s_initialized); | 59 ASSERT(s_initialized); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // risk where the length and/or the contents are exploited from user | 155 // risk where the length and/or the contents are exploited from user |
| 154 // scripts. Vectors, HashTables, ArrayBufferContents and Strings are | 156 // scripts. Vectors, HashTables, ArrayBufferContents and Strings are |
| 155 // allocated in the buffer partition. | 157 // allocated in the buffer partition. |
| 156 // - Fast malloc partition: A partition to allocate all other objects. | 158 // - Fast malloc partition: A partition to allocate all other objects. |
| 157 static PartitionAllocatorGeneric m_fastMallocAllocator; | 159 static PartitionAllocatorGeneric m_fastMallocAllocator; |
| 158 static PartitionAllocatorGeneric m_bufferAllocator; | 160 static PartitionAllocatorGeneric m_bufferAllocator; |
| 159 #if !ENABLE(OILPAN) | 161 #if !ENABLE(OILPAN) |
| 160 static SizeSpecificPartitionAllocator<3328> m_nodeAllocator; | 162 static SizeSpecificPartitionAllocator<3328> m_nodeAllocator; |
| 161 #endif | 163 #endif |
| 162 static SizeSpecificPartitionAllocator<1024> m_layoutAllocator; | 164 static SizeSpecificPartitionAllocator<1024> m_layoutAllocator; |
| 163 static HistogramEnumerationFunction m_histogramEnumeration; | 165 static ReportPartitionAllocSizeFunction m_reportSizeFunction; |
| 164 }; | 166 }; |
| 165 | 167 |
| 166 } // namespace WTF | 168 } // namespace WTF |
| 167 | 169 |
| 168 #endif // Partitions_h | 170 #endif // Partitions_h |
| OLD | NEW |