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

Side by Side Diff: third_party/WebKit/Source/platform/heap/GCInfo.h

Issue 1714523006: Refactoring: Remove DETAILED_MEMORY_INFRA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove spamming info Created 4 years, 10 months 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 GCInfo_h 5 #ifndef GCInfo_h
6 #define GCInfo_h 6 #define GCInfo_h
7 7
8 #include "platform/heap/Visitor.h" 8 #include "platform/heap/Visitor.h"
9 #include "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 // GCInfo contains meta-data associated with objects allocated in the 115 // GCInfo contains meta-data associated with objects allocated in the
116 // Blink heap. This meta-data consists of a function pointer used to 116 // Blink heap. This meta-data consists of a function pointer used to
117 // trace the pointers in the object during garbage collection, an 117 // trace the pointers in the object during garbage collection, an
118 // indication of whether or not the object needs a finalization 118 // indication of whether or not the object needs a finalization
119 // callback, and a function pointer used to finalize the object when 119 // callback, and a function pointer used to finalize the object when
120 // the garbage collector determines that the object is no longer 120 // the garbage collector determines that the object is no longer
121 // reachable. There is a GCInfo struct for each class that directly 121 // reachable. There is a GCInfo struct for each class that directly
122 // inherits from GarbageCollected or GarbageCollectedFinalized. 122 // inherits from GarbageCollected or GarbageCollectedFinalized.
123 struct GCInfo { 123 struct GCInfo {
124 using GetClassNameCallback = const String (*)();
125
126 bool hasFinalizer() const { return m_nonTrivialFinalizer; } 124 bool hasFinalizer() const { return m_nonTrivialFinalizer; }
127 bool hasVTable() const { return m_hasVTable; } 125 bool hasVTable() const { return m_hasVTable; }
128 TraceCallback m_trace; 126 TraceCallback m_trace;
129 FinalizationCallback m_finalize; 127 FinalizationCallback m_finalize;
130 bool m_nonTrivialFinalizer; 128 bool m_nonTrivialFinalizer;
131 bool m_hasVTable; 129 bool m_hasVTable;
132 #if ENABLE(DETAILED_MEMORY_INFRA)
133 const String className() const { return m_className(); }
134 GetClassNameCallback m_className;
135 #endif
136 }; 130 };
137 131
138 #if ENABLE(ASSERT) 132 #if ENABLE(ASSERT)
139 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex); 133 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex);
140 #endif 134 #endif
141 135
142 class GCInfoTable { 136 class GCInfoTable {
143 STATIC_ONLY(GCInfoTable); 137 STATIC_ONLY(GCInfoTable);
144 public: 138 public:
145 PLATFORM_EXPORT static void ensureGCInfoIndex(const GCInfo*, size_t*); 139 PLATFORM_EXPORT static void ensureGCInfoIndex(const GCInfo*, size_t*);
(...skipping 24 matching lines...) Expand all
170 struct GCInfoAtBaseType { 164 struct GCInfoAtBaseType {
171 STATIC_ONLY(GCInfoAtBaseType); 165 STATIC_ONLY(GCInfoAtBaseType);
172 static size_t index() 166 static size_t index()
173 { 167 {
174 static_assert(sizeof(T), "T must be fully defined"); 168 static_assert(sizeof(T), "T must be fully defined");
175 static const GCInfo gcInfo = { 169 static const GCInfo gcInfo = {
176 TraceTrait<T>::trace, 170 TraceTrait<T>::trace,
177 FinalizerTrait<T>::finalize, 171 FinalizerTrait<T>::finalize,
178 FinalizerTrait<T>::nonTrivialFinalizer, 172 FinalizerTrait<T>::nonTrivialFinalizer,
179 std::is_polymorphic<T>::value, 173 std::is_polymorphic<T>::value,
180 #if ENABLE(DETAILED_MEMORY_INFRA)
181 TypenameStringTrait<T>::get
182 #endif
183 }; 174 };
184 175
185 static size_t gcInfoIndex = 0; 176 static size_t gcInfoIndex = 0;
186 ASSERT(s_gcInfoTable); 177 ASSERT(s_gcInfoTable);
187 if (!acquireLoad(&gcInfoIndex)) 178 if (!acquireLoad(&gcInfoIndex))
188 GCInfoTable::ensureGCInfoIndex(&gcInfo, &gcInfoIndex); 179 GCInfoTable::ensureGCInfoIndex(&gcInfo, &gcInfoIndex);
189 ASSERT(gcInfoIndex >= 1); 180 ASSERT(gcInfoIndex >= 1);
190 ASSERT(gcInfoIndex < GCInfoTable::maxIndex); 181 ASSERT(gcInfoIndex < GCInfoTable::maxIndex);
191 return gcInfoIndex; 182 return gcInfoIndex;
192 } 183 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 template<typename T, size_t inlineCapacity> 227 template<typename T, size_t inlineCapacity>
237 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator>> { }; 228 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator>> { };
238 template<typename T, size_t inlineCapacity> 229 template<typename T, size_t inlineCapacity>
239 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i nlineCapacity, HeapAllocator>> { }; 230 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i nlineCapacity, HeapAllocator>> { };
240 template<typename T, typename U, typename V> 231 template<typename T, typename U, typename V>
241 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted Set<T, U, V, HeapAllocator>> { }; 232 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted Set<T, U, V, HeapAllocator>> { };
242 233
243 } // namespace blink 234 } // namespace blink
244 235
245 #endif 236 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/build/features.gypi ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698