| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return m_layoutAllocator.root(); | 69 return m_layoutAllocator.root(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 static size_t currentDOMMemoryUsage() { | 72 static size_t currentDOMMemoryUsage() { |
| 73 NOTREACHED(); | 73 NOTREACHED(); |
| 74 return 0; | 74 return 0; |
| 75 } | 75 } |
| 76 | 76 |
| 77 static size_t totalSizeOfCommittedPages() { | 77 static size_t totalSizeOfCommittedPages() { |
| 78 size_t totalSize = 0; | 78 size_t totalSize = 0; |
| 79 totalSize += m_fastMallocAllocator.root()->totalSizeOfCommittedPages; | 79 totalSize += m_fastMallocAllocator.root()->total_size_of_committed_pages; |
| 80 totalSize += m_bufferAllocator.root()->totalSizeOfCommittedPages; | 80 totalSize += m_bufferAllocator.root()->total_size_of_committed_pages; |
| 81 totalSize += m_layoutAllocator.root()->totalSizeOfCommittedPages; | 81 totalSize += m_layoutAllocator.root()->total_size_of_committed_pages; |
| 82 return totalSize; | 82 return totalSize; |
| 83 } | 83 } |
| 84 | 84 |
| 85 static void decommitFreeableMemory(); | 85 static void decommitFreeableMemory(); |
| 86 | 86 |
| 87 static void reportMemoryUsageHistogram(); | 87 static void reportMemoryUsageHistogram(); |
| 88 | 88 |
| 89 static void dumpMemoryStats(bool isLightDump, base::PartitionStatsDumper*); | 89 static void dumpMemoryStats(bool isLightDump, base::PartitionStatsDumper*); |
| 90 | 90 |
| 91 ALWAYS_INLINE static void* bufferMalloc(size_t n, const char* typeName) { | 91 ALWAYS_INLINE static void* bufferMalloc(size_t n, const char* typeName) { |
| 92 return partitionAllocGeneric(bufferPartition(), n, typeName); | 92 return PartitionAllocGeneric(bufferPartition(), n, typeName); |
| 93 } | 93 } |
| 94 ALWAYS_INLINE static void* bufferRealloc(void* p, | 94 ALWAYS_INLINE static void* bufferRealloc(void* p, |
| 95 size_t n, | 95 size_t n, |
| 96 const char* typeName) { | 96 const char* typeName) { |
| 97 return partitionReallocGeneric(bufferPartition(), p, n, typeName); | 97 return PartitionReallocGeneric(bufferPartition(), p, n, typeName); |
| 98 } | 98 } |
| 99 ALWAYS_INLINE static void bufferFree(void* p) { | 99 ALWAYS_INLINE static void bufferFree(void* p) { |
| 100 partitionFreeGeneric(bufferPartition(), p); | 100 PartitionFreeGeneric(bufferPartition(), p); |
| 101 } | 101 } |
| 102 ALWAYS_INLINE static size_t bufferActualSize(size_t n) { | 102 ALWAYS_INLINE static size_t bufferActualSize(size_t n) { |
| 103 return partitionAllocActualSize(bufferPartition(), n); | 103 return PartitionAllocActualSize(bufferPartition(), n); |
| 104 } | 104 } |
| 105 static void* fastMalloc(size_t n, const char* typeName) { | 105 static void* fastMalloc(size_t n, const char* typeName) { |
| 106 return partitionAllocGeneric(Partitions::fastMallocPartition(), n, | 106 return PartitionAllocGeneric(Partitions::fastMallocPartition(), n, |
| 107 typeName); | 107 typeName); |
| 108 } | 108 } |
| 109 static void* fastZeroedMalloc(size_t n, const char* typeName) { | 109 static void* fastZeroedMalloc(size_t n, const char* typeName) { |
| 110 void* result = fastMalloc(n, typeName); | 110 void* result = fastMalloc(n, typeName); |
| 111 memset(result, 0, n); | 111 memset(result, 0, n); |
| 112 return result; | 112 return result; |
| 113 } | 113 } |
| 114 static void* fastRealloc(void* p, size_t n, const char* typeName) { | 114 static void* fastRealloc(void* p, size_t n, const char* typeName) { |
| 115 return partitionReallocGeneric(Partitions::fastMallocPartition(), p, n, | 115 return PartitionReallocGeneric(Partitions::fastMallocPartition(), p, n, |
| 116 typeName); | 116 typeName); |
| 117 } | 117 } |
| 118 static void fastFree(void* p) { | 118 static void fastFree(void* p) { |
| 119 partitionFreeGeneric(Partitions::fastMallocPartition(), p); | 119 PartitionFreeGeneric(Partitions::fastMallocPartition(), p); |
| 120 } | 120 } |
| 121 | 121 |
| 122 static void handleOutOfMemory(); | 122 static void handleOutOfMemory(); |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 static base::subtle::SpinLock s_initializationLock; | 125 static base::subtle::SpinLock s_initializationLock; |
| 126 static bool s_initialized; | 126 static bool s_initialized; |
| 127 | 127 |
| 128 // We have the following four partitions. | 128 // We have the following four partitions. |
| 129 // - LayoutObject partition: A partition to allocate LayoutObjects. | 129 // - LayoutObject partition: A partition to allocate LayoutObjects. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 142 static base::SizeSpecificPartitionAllocator<1024> m_layoutAllocator; | 142 static base::SizeSpecificPartitionAllocator<1024> m_layoutAllocator; |
| 143 static ReportPartitionAllocSizeFunction m_reportSizeFunction; | 143 static ReportPartitionAllocSizeFunction m_reportSizeFunction; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 using base::kGenericMaxDirectMapped; | 146 using base::kGenericMaxDirectMapped; |
| 147 using base::kPageAllocationGranularity; | 147 using base::kPageAllocationGranularity; |
| 148 using base::kPageAllocationGranularityBaseMask; | 148 using base::kPageAllocationGranularityBaseMask; |
| 149 using base::kPageAllocationGranularityOffsetMask; | 149 using base::kPageAllocationGranularityOffsetMask; |
| 150 using base::kSystemPageSize; | 150 using base::kSystemPageSize; |
| 151 | 151 |
| 152 using base::allocPages; | 152 using base::AllocPages; |
| 153 using base::decommitSystemPages; | 153 using base::DecommitSystemPages; |
| 154 using base::discardSystemPages; | 154 using base::DiscardSystemPages; |
| 155 using base::partitionFree; | 155 using base::PartitionFree; |
| 156 using base::freePages; | 156 using base::FreePages; |
| 157 using base::getAllocPageErrorCode; | 157 using base::GetAllocPageErrorCode; |
| 158 using base::recommitSystemPages; | 158 using base::RecommitSystemPages; |
| 159 using base::roundDownToSystemPage; | 159 using base::RoundDownToSystemPage; |
| 160 using base::roundUpToSystemPage; | 160 using base::RoundUpToSystemPage; |
| 161 using base::setSystemPagesAccessible; | 161 using base::SetSystemPagesAccessible; |
| 162 using base::setSystemPagesInaccessible; | 162 using base::SetSystemPagesInaccessible; |
| 163 | 163 |
| 164 using base::PageAccessible; | 164 using base::PageAccessible; |
| 165 using base::PageInaccessible; | 165 using base::PageInaccessible; |
| 166 using base::PartitionStatsDumper; | 166 using base::PartitionStatsDumper; |
| 167 using base::PartitionMemoryStats; | 167 using base::PartitionMemoryStats; |
| 168 using base::PartitionBucketMemoryStats; | 168 using base::PartitionBucketMemoryStats; |
| 169 using base::PartitionAllocHooks; | 169 using base::PartitionAllocHooks; |
| 170 | 170 |
| 171 } // namespace WTF | 171 } // namespace WTF |
| 172 | 172 |
| 173 #endif // Partitions_h | 173 #endif // Partitions_h |
| OLD | NEW |