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

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

Issue 2542203004: blink: Cleanup class/struct forward declarations (Closed)
Patch Set: 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 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 template <typename T, typename Traits> 128 template <typename T, typename Traits>
129 struct FinalizerTrait<HeapVectorBacking<T, Traits>> { 129 struct FinalizerTrait<HeapVectorBacking<T, Traits>> {
130 STATIC_ONLY(FinalizerTrait); 130 STATIC_ONLY(FinalizerTrait);
131 static const bool nonTrivialFinalizer = Traits::needsDestruction; 131 static const bool nonTrivialFinalizer = Traits::needsDestruction;
132 static void finalize(void* obj) { 132 static void finalize(void* obj) {
133 FinalizerTraitImpl<HeapVectorBacking<T, Traits>, 133 FinalizerTraitImpl<HeapVectorBacking<T, Traits>,
134 nonTrivialFinalizer>::finalize(obj); 134 nonTrivialFinalizer>::finalize(obj);
135 } 135 }
136 }; 136 };
137 137
138 // s_gcInfoTable holds the per-class GCInfo descriptors; each heap
139 // object header keeps its index into this table.
140 extern PLATFORM_EXPORT GCInfo const** s_gcInfoTable;
141
142 // GCInfo contains meta-data associated with objects allocated in the 138 // GCInfo contains meta-data associated with objects allocated in the
143 // Blink heap. This meta-data consists of a function pointer used to 139 // Blink heap. This meta-data consists of a function pointer used to
144 // trace the pointers in the object during garbage collection, an 140 // trace the pointers in the object during garbage collection, an
145 // indication of whether or not the object needs a finalization 141 // indication of whether or not the object needs a finalization
146 // callback, and a function pointer used to finalize the object when 142 // callback, and a function pointer used to finalize the object when
147 // the garbage collector determines that the object is no longer 143 // the garbage collector determines that the object is no longer
148 // reachable. There is a GCInfo struct for each class that directly 144 // reachable. There is a GCInfo struct for each class that directly
149 // inherits from GarbageCollected or GarbageCollectedFinalized. 145 // inherits from GarbageCollected or GarbageCollectedFinalized.
150 struct GCInfo { 146 struct GCInfo {
151 bool hasFinalizer() const { return m_nonTrivialFinalizer; } 147 bool hasFinalizer() const { return m_nonTrivialFinalizer; }
152 bool hasVTable() const { return m_hasVTable; } 148 bool hasVTable() const { return m_hasVTable; }
153 TraceCallback m_trace; 149 TraceCallback m_trace;
154 FinalizationCallback m_finalize; 150 FinalizationCallback m_finalize;
155 bool m_nonTrivialFinalizer; 151 bool m_nonTrivialFinalizer;
156 bool m_hasVTable; 152 bool m_hasVTable;
157 }; 153 };
158 154
155 // s_gcInfoTable holds the per-class GCInfo descriptors; each heap
156 // object header keeps its index into this table.
157 extern PLATFORM_EXPORT GCInfo const** s_gcInfoTable;
158
159 #if ENABLE(ASSERT) 159 #if ENABLE(ASSERT)
160 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex); 160 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex);
161 #endif 161 #endif
162 162
163 class GCInfoTable { 163 class GCInfoTable {
164 STATIC_ONLY(GCInfoTable); 164 STATIC_ONLY(GCInfoTable);
165 165
166 public: 166 public:
167 PLATFORM_EXPORT static void ensureGCInfoIndex(const GCInfo*, size_t*); 167 PLATFORM_EXPORT static void ensureGCInfoIndex(const GCInfo*, size_t*);
168 168
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 template <typename T, size_t inlineCapacity> 273 template <typename T, size_t inlineCapacity>
274 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> 274 struct GCInfoTrait<HeapDeque<T, inlineCapacity>>
275 : public GCInfoTrait<Deque<T, inlineCapacity, HeapAllocator>> {}; 275 : public GCInfoTrait<Deque<T, inlineCapacity, HeapAllocator>> {};
276 template <typename T, typename U, typename V> 276 template <typename T, typename U, typename V>
277 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> 277 struct GCInfoTrait<HeapHashCountedSet<T, U, V>>
278 : public GCInfoTrait<HashCountedSet<T, U, V, HeapAllocator>> {}; 278 : public GCInfoTrait<HashCountedSet<T, U, V, HeapAllocator>> {};
279 279
280 } // namespace blink 280 } // namespace blink
281 281
282 #endif 282 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/PlaceholderImage.h ('k') | third_party/WebKit/Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698