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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return malloc<void*, void>(bytes, WTF_HEAP_PROFILER_TYPE_NAME(T)); | 120 return malloc<void*, void>(bytes, WTF_HEAP_PROFILER_TYPE_NAME(T)); |
121 } | 121 } |
122 static void | 122 static void |
123 deleteArray(void* ptr) | 123 deleteArray(void* ptr) |
124 { | 124 { |
125 free(ptr); // Not the system free, the one from this class. | 125 free(ptr); // Not the system free, the one from this class. |
126 } | 126 } |
127 | 127 |
128 static bool isAllocationAllowed() { return true; } | 128 static bool isAllocationAllowed() { return true; } |
129 | 129 |
130 template<typename T> | |
131 struct OtherType { | |
132 typedef T* Type; | |
133 }; | |
134 | |
135 template<typename T> | |
136 static T& getOther(T* other) | |
137 { | |
138 return *other; | |
139 } | |
140 | |
141 static void enterGCForbiddenScope() { } | 130 static void enterGCForbiddenScope() { } |
142 static void leaveGCForbiddenScope() { } | 131 static void leaveGCForbiddenScope() { } |
143 | 132 |
144 private: | 133 private: |
145 static void* allocateBacking(size_t, const char* typeName); | 134 static void* allocateBacking(size_t, const char* typeName); |
146 }; | 135 }; |
147 | 136 |
148 // Specializations for heap profiling, so type profiling of |char| is possible | 137 // Specializations for heap profiling, so type profiling of |char| is possible |
149 // even in official builds (because |char| makes up a large portion of the heap.
) | 138 // even in official builds (because |char| makes up a large portion of the heap.
) |
150 template <> WTF_EXPORT char* PartitionAllocator::allocateVectorBacking<char>(siz
e_t); | 139 template <> WTF_EXPORT char* PartitionAllocator::allocateVectorBacking<char>(siz
e_t); |
(...skipping 14 matching lines...) Expand all Loading... |
165 { \ | 154 { \ |
166 ASSERT(location); \ | 155 ASSERT(location); \ |
167 return location; \ | 156 return location; \ |
168 } \ | 157 } \ |
169 private: \ | 158 private: \ |
170 typedef int __thisIsHereToForceASemicolonAfterThisMacro | 159 typedef int __thisIsHereToForceASemicolonAfterThisMacro |
171 | 160 |
172 using WTF::PartitionAllocator; | 161 using WTF::PartitionAllocator; |
173 | 162 |
174 #endif // WTF_PartitionAllocator_h | 163 #endif // WTF_PartitionAllocator_h |
OLD | NEW |