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

Unified Diff: third_party/WebKit/Source/wtf/PartitionAllocator.h

Issue 1436153002: Apply clang-format with Chromium-style without column limit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/PartitionAllocator.h
diff --git a/third_party/WebKit/Source/wtf/PartitionAllocator.h b/third_party/WebKit/Source/wtf/PartitionAllocator.h
index de84fb7d8beb4b3354176ce63ebb05caa9ea8b50..1771269e4e17ee4e4f06742332dcf325245ae1d7 100644
--- a/third_party/WebKit/Source/wtf/PartitionAllocator.h
+++ b/third_party/WebKit/Source/wtf/PartitionAllocator.h
@@ -47,172 +47,151 @@ namespace WTF {
class PartitionAllocatorDummyVisitor;
class WTF_EXPORT PartitionAllocator {
-public:
- typedef PartitionAllocatorDummyVisitor Visitor;
- static const bool isGarbageCollected = false;
-
- template<typename T>
- static size_t quantizedSize(size_t count)
- {
- RELEASE_ASSERT(count <= kGenericMaxDirectMapped / sizeof(T));
- return partitionAllocActualSize(Partitions::bufferPartition(), count * sizeof(T));
- }
- template <typename T>
- static T* allocateVectorBacking(size_t size)
- {
- return reinterpret_cast<T*>(allocateBacking(size));
- }
- template <typename T>
- static T* allocateExpandedVectorBacking(size_t size)
- {
- return reinterpret_cast<T*>(allocateBacking(size));
- }
- static void freeVectorBacking(void* address);
- static inline bool expandVectorBacking(void*, size_t)
- {
- return false;
- }
- static inline bool shrinkVectorBacking(void* address, size_t quantizedCurrentSize, size_t quantizedShrunkSize)
- {
- // Optimization: if we're downsizing inside the same allocator bucket,
- // we can skip reallocation.
- return quantizedCurrentSize == quantizedShrunkSize;
- }
- template <typename T>
- static T* allocateInlineVectorBacking(size_t size) { return allocateVectorBacking<T>(size); }
- static inline void freeInlineVectorBacking(void* address) { freeVectorBacking(address); }
- static inline bool expandInlineVectorBacking(void*, size_t) { return false; }
- static inline bool shrinkInlineVectorBacking(void* address, size_t quantizedCurrentSize, size_t quantizedShrunkSize) { return shrinkVectorBacking(address, quantizedCurrentSize, quantizedShrunkSize); }
-
- template <typename T, typename HashTable>
- static T* allocateHashTableBacking(size_t size)
- {
- return reinterpret_cast<T*>(allocateBacking(size));
- }
- template <typename T, typename HashTable>
- static T* allocateZeroedHashTableBacking(size_t size)
- {
- void* result = allocateBacking(size);
- memset(result, 0, size);
- return reinterpret_cast<T*>(result);
- }
- static void freeHashTableBacking(void* address);
-
- template <typename Return, typename Metadata>
- static Return malloc(size_t size)
- {
- return reinterpret_cast<Return>(Partitions::fastMalloc(size));
- }
-
- static inline bool expandHashTableBacking(void*, size_t)
- {
- return false;
- }
- static void free(void* address)
- {
- Partitions::fastFree(address);
- }
- template<typename T>
- static void* newArray(size_t bytes)
- {
- return malloc<void*, void>(bytes);
- }
- static void
- deleteArray(void* ptr)
- {
- free(ptr); // Not the system free, the one from this class.
- }
-
- static bool isAllocationAllowed() { return true; }
- template<typename T>
- static bool isHeapObjectAlive(T* object)
- {
- ASSERT_NOT_REACHED();
- return false;
- }
-
- static void markNoTracing(...)
- {
- ASSERT_NOT_REACHED();
- }
-
- static void registerDelayedMarkNoTracing(...)
- {
- ASSERT_NOT_REACHED();
- }
-
- static void registerWeakMembers(...)
- {
- ASSERT_NOT_REACHED();
- }
-
- static void registerWeakTable(...)
- {
- ASSERT_NOT_REACHED();
- }
+ public:
+ typedef PartitionAllocatorDummyVisitor Visitor;
+ static const bool isGarbageCollected = false;
+
+ template <typename T>
+ static size_t quantizedSize(size_t count) {
+ RELEASE_ASSERT(count <= kGenericMaxDirectMapped / sizeof(T));
+ return partitionAllocActualSize(Partitions::bufferPartition(), count * sizeof(T));
+ }
+ template <typename T>
+ static T* allocateVectorBacking(size_t size) {
+ return reinterpret_cast<T*>(allocateBacking(size));
+ }
+ template <typename T>
+ static T* allocateExpandedVectorBacking(size_t size) {
+ return reinterpret_cast<T*>(allocateBacking(size));
+ }
+ static void freeVectorBacking(void* address);
+ static inline bool expandVectorBacking(void*, size_t) {
+ return false;
+ }
+ static inline bool shrinkVectorBacking(void* address, size_t quantizedCurrentSize, size_t quantizedShrunkSize) {
+ // Optimization: if we're downsizing inside the same allocator bucket,
+ // we can skip reallocation.
+ return quantizedCurrentSize == quantizedShrunkSize;
+ }
+ template <typename T>
+ static T* allocateInlineVectorBacking(size_t size) { return allocateVectorBacking<T>(size); }
+ static inline void freeInlineVectorBacking(void* address) { freeVectorBacking(address); }
+ static inline bool expandInlineVectorBacking(void*, size_t) { return false; }
+ static inline bool shrinkInlineVectorBacking(void* address, size_t quantizedCurrentSize, size_t quantizedShrunkSize) { return shrinkVectorBacking(address, quantizedCurrentSize, quantizedShrunkSize); }
+
+ template <typename T, typename HashTable>
+ static T* allocateHashTableBacking(size_t size) {
+ return reinterpret_cast<T*>(allocateBacking(size));
+ }
+ template <typename T, typename HashTable>
+ static T* allocateZeroedHashTableBacking(size_t size) {
+ void* result = allocateBacking(size);
+ memset(result, 0, size);
+ return reinterpret_cast<T*>(result);
+ }
+ static void freeHashTableBacking(void* address);
+
+ template <typename Return, typename Metadata>
+ static Return malloc(size_t size) {
+ return reinterpret_cast<Return>(Partitions::fastMalloc(size));
+ }
+
+ static inline bool expandHashTableBacking(void*, size_t) {
+ return false;
+ }
+ static void free(void* address) {
+ Partitions::fastFree(address);
+ }
+ template <typename T>
+ static void* newArray(size_t bytes) {
+ return malloc<void*, void>(bytes);
+ }
+ static void
+ deleteArray(void* ptr) {
+ free(ptr); // Not the system free, the one from this class.
+ }
+
+ static bool isAllocationAllowed() { return true; }
+ template <typename T>
+ static bool isHeapObjectAlive(T* object) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ static void markNoTracing(...) {
+ ASSERT_NOT_REACHED();
+ }
+
+ static void registerDelayedMarkNoTracing(...) {
+ ASSERT_NOT_REACHED();
+ }
+
+ static void registerWeakMembers(...) {
+ ASSERT_NOT_REACHED();
+ }
+
+ static void registerWeakTable(...) {
+ ASSERT_NOT_REACHED();
+ }
#if ENABLE(ASSERT)
- static bool weakTableRegistered(...)
- {
- ASSERT_NOT_REACHED();
- return false;
- }
+ static bool weakTableRegistered(...) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
#endif
- template<typename T, typename Traits>
- static void trace(...)
- {
- ASSERT_NOT_REACHED();
- }
+ template <typename T, typename Traits>
+ static void trace(...) {
+ ASSERT_NOT_REACHED();
+ }
- template<typename T>
- struct OtherType {
- typedef T* Type;
- };
+ template <typename T>
+ struct OtherType {
+ typedef T* Type;
+ };
- template<typename T>
- static T& getOther(T* other)
- {
- return *other;
- }
+ template <typename T>
+ static T& getOther(T* other) {
+ return *other;
+ }
- static void enterGCForbiddenScope() { }
- static void leaveGCForbiddenScope() { }
+ static void enterGCForbiddenScope() {}
+ static void leaveGCForbiddenScope() {}
-private:
- static void* allocateBacking(size_t);
+ private:
+ static void* allocateBacking(size_t);
};
// The Windows compiler seems to be very eager to instantiate things it won't
// need, so unless we have this class we get compile errors.
class PartitionAllocatorDummyVisitor {
-public:
- template<typename T> inline bool isHeapObjectAlive(T obj)
- {
- ASSERT_NOT_REACHED();
- return false;
- }
+ public:
+ template <typename T>
+ inline bool isHeapObjectAlive(T obj) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
};
-} // namespace WTF
-
-#define WTF_USE_ALLOCATOR(ClassName, Allocator) \
-public: \
- void* operator new(size_t size) \
- { \
- return Allocator::template malloc<void*, ClassName>(size); \
- } \
- void operator delete(void* p) { Allocator::free(p); } \
- void* operator new[](size_t size) { return Allocator::template newArray<ClassName>(size); } \
- void operator delete[](void* p) { Allocator::deleteArray(p); } \
- void* operator new(size_t, NotNullTag, void* location) \
- { \
- ASSERT(location); \
- return location; \
- } \
-private: \
-typedef int __thisIsHereToForceASemicolonAfterThisMacro
+} // namespace WTF
+
+#define WTF_USE_ALLOCATOR(ClassName, Allocator) \
+ public: \
+ void* operator new(size_t size) { \
+ return Allocator::template malloc<void*, ClassName>(size); \
+ } \
+ void operator delete(void* p) { Allocator::free(p); } \
+ void* operator new[](size_t size) { return Allocator::template newArray<ClassName>(size); } \
+ void operator delete[](void* p) { Allocator::deleteArray(p); } \
+ void* operator new(size_t, NotNullTag, void* location) { \
+ ASSERT(location); \
+ return location; \
+ } \
+ \
+ private: \
+ typedef int __thisIsHereToForceASemicolonAfterThisMacro
using WTF::PartitionAllocator;
-#endif // WTF_PartitionAllocator_h
+#endif // WTF_PartitionAllocator_h
« no previous file with comments | « third_party/WebKit/Source/wtf/PartitionAllocTest.cpp ('k') | third_party/WebKit/Source/wtf/PartitionAllocator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698