Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: third_party/WebKit/Source/wtf/Allocator.h

Issue 2518253002: Move Partition Allocator into Chromium base. (Closed)
Patch Set: Move OOM_CRASH into its own, more specific header. Fixes Windows build. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WTF_Allocator_h 5 #ifndef WTF_Allocator_h
6 #define WTF_Allocator_h 6 #define WTF_Allocator_h
7 7
8 #include "wtf/Assertions.h" 8 #include "wtf/Assertions.h"
9 #include "wtf/StdLibExtras.h" 9 #include "wtf/StdLibExtras.h"
10 #include "wtf/allocator/Partitions.h" 10 #include "wtf/allocator/Partitions.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } \ 111 } \
112 \ 112 \
113 void operator delete(void* p) { ::WTF::Partitions::fastFree(p); } \ 113 void operator delete(void* p) { ::WTF::Partitions::fastFree(p); } \
114 \ 114 \
115 void* operator new[](size_t size) { \ 115 void* operator new[](size_t size) { \
116 return ::WTF::Partitions::fastMalloc(size, typeName); \ 116 return ::WTF::Partitions::fastMalloc(size, typeName); \
117 } \ 117 } \
118 \ 118 \
119 void operator delete[](void* p) { ::WTF::Partitions::fastFree(p); } \ 119 void operator delete[](void* p) { ::WTF::Partitions::fastFree(p); } \
120 void* operator new(size_t, NotNullTag, void* location) { \ 120 void* operator new(size_t, NotNullTag, void* location) { \
121 ASSERT(location); \ 121 DCHECK(location); \
122 return location; \ 122 return location; \
123 } \ 123 } \
124 \ 124 \
125 private: \ 125 private: \
126 typedef int __thisIsHereToForceASemicolonAfterThisMacro 126 typedef int __thisIsHereToForceASemicolonAfterThisMacro
127 127
128 // In official builds, do not include type info string literals to avoid
129 // bloating the binary.
130 #if defined(OFFICIAL_BUILD)
131 #define WTF_HEAP_PROFILER_TYPE_NAME(T) nullptr
132 #else
133 #define WTF_HEAP_PROFILER_TYPE_NAME(T) ::WTF::getStringWithTypeName<T>()
134 #endif
135
128 // Both of these macros enable fast malloc and provide type info to the heap 136 // Both of these macros enable fast malloc and provide type info to the heap
129 // profiler. The regular macro does not provide type info in official builds, 137 // profiler. The regular macro does not provide type info in official builds,
130 // to avoid bloating the binary with type name strings. The |WITH_TYPE_NAME| 138 // to avoid bloating the binary with type name strings. The |WITH_TYPE_NAME|
131 // variant provides type info unconditionally, so it should be used sparingly. 139 // variant provides type info unconditionally, so it should be used sparingly.
132 // Furthermore, the |WITH_TYPE_NAME| variant does not work if |type| is a 140 // Furthermore, the |WITH_TYPE_NAME| variant does not work if |type| is a
133 // template argument; |USING_FAST_MALLOC| does. 141 // template argument; |USING_FAST_MALLOC| does.
134 #define USING_FAST_MALLOC(type) \ 142 #define USING_FAST_MALLOC(type) \
135 USING_FAST_MALLOC_INTERNAL(type, WTF_HEAP_PROFILER_TYPE_NAME(type)) 143 USING_FAST_MALLOC_INTERNAL(type, WTF_HEAP_PROFILER_TYPE_NAME(type))
136 #define USING_FAST_MALLOC_WITH_TYPE_NAME(type) \ 144 #define USING_FAST_MALLOC_WITH_TYPE_NAME(type) \
137 USING_FAST_MALLOC_INTERNAL(type, #type) 145 USING_FAST_MALLOC_INTERNAL(type, #type)
138 146
139 } // namespace WTF 147 } // namespace WTF
140 148
141 #endif /* WTF_Allocator_h */ 149 #endif /* WTF_Allocator_h */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698