| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 static void* fastZeroedMalloc(size_t n) | 110 static void* fastZeroedMalloc(size_t n) |
| 111 { | 111 { |
| 112 void* result = fastMalloc(n); | 112 void* result = fastMalloc(n); |
| 113 memset(result, 0, n); | 113 memset(result, 0, n); |
| 114 return result; | 114 return result; |
| 115 } | 115 } |
| 116 static void* fastRealloc(void* p, size_t n) | 116 static void* fastRealloc(void* p, size_t n) |
| 117 { | 117 { |
| 118 return partitionReallocGeneric(Partitions::fastMallocPartition(), p, n); | 118 return partitionReallocGeneric(Partitions::fastMallocPartition(), p, n); |
| 119 } | 119 } |
| 120 static char* fastStrDup(const char* src) | |
| 121 { | |
| 122 size_t len = strlen(src) + 1; | |
| 123 char* dup = static_cast<char*>(fastMalloc(len)); | |
| 124 memcpy(dup, src, len); | |
| 125 return dup; | |
| 126 } | |
| 127 static void fastFree(void* p) | 120 static void fastFree(void* p) |
| 128 { | 121 { |
| 129 partitionFreeGeneric(Partitions::fastMallocPartition(), p); | 122 partitionFreeGeneric(Partitions::fastMallocPartition(), p); |
| 130 } | 123 } |
| 131 | 124 |
| 132 static void handleOutOfMemory(); | 125 static void handleOutOfMemory(); |
| 133 | 126 |
| 134 private: | 127 private: |
| 135 static int s_initializationLock; | 128 static int s_initializationLock; |
| 136 static bool s_initialized; | 129 static bool s_initialized; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 152 static PartitionAllocatorGeneric m_fastMallocAllocator; | 145 static PartitionAllocatorGeneric m_fastMallocAllocator; |
| 153 static PartitionAllocatorGeneric m_bufferAllocator; | 146 static PartitionAllocatorGeneric m_bufferAllocator; |
| 154 static SizeSpecificPartitionAllocator<3328> m_nodeAllocator; | 147 static SizeSpecificPartitionAllocator<3328> m_nodeAllocator; |
| 155 static SizeSpecificPartitionAllocator<1024> m_layoutAllocator; | 148 static SizeSpecificPartitionAllocator<1024> m_layoutAllocator; |
| 156 static HistogramEnumerationFunction m_histogramEnumeration; | 149 static HistogramEnumerationFunction m_histogramEnumeration; |
| 157 }; | 150 }; |
| 158 | 151 |
| 159 } // namespace WTF | 152 } // namespace WTF |
| 160 | 153 |
| 161 #endif // Partitions_h | 154 #endif // Partitions_h |
| OLD | NEW |