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

Side by Side Diff: tools/clang/blink_gc_plugin/tests/heap/stubs.h

Issue 834373003: BlinkGCPlugin: require GC mixin instances to declare local trace(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing 'override' annotations; sync heap/stubs.h with upstream defs Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 HEAP_STUBS_H_ 5 #ifndef HEAP_STUBS_H_
6 #define HEAP_STUBS_H_ 6 #define HEAP_STUBS_H_
7 7
8 #include "stddef.h" 8 #include "stddef.h"
9 9
10 #define WTF_MAKE_FAST_ALLOCATED \ 10 #define WTF_MAKE_FAST_ALLOCATED \
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 #define ALLOW_ONLY_INLINE_ALLOCATION() \ 136 #define ALLOW_ONLY_INLINE_ALLOCATION() \
137 public: \ 137 public: \
138 void* operator new(size_t, void*); \ 138 void* operator new(size_t, void*); \
139 private: \ 139 private: \
140 void* operator new(size_t) = delete; 140 void* operator new(size_t) = delete;
141 141
142 #define GC_PLUGIN_IGNORE(bug) \ 142 #define GC_PLUGIN_IGNORE(bug) \
143 __attribute__((annotate("blink_gc_plugin_ignore"))) 143 __attribute__((annotate("blink_gc_plugin_ignore")))
144 144
145 #define USING_GARBAGE_COLLECTED_MIXIN(type) \ 145 #define USING_GARBAGE_COLLECTED_MIXIN(type) \
146 public: \ 146 public: \
147 virtual void adjustAndMark(Visitor*) const {} \ 147 virtual void adjustAndMark(Visitor*) const override { } \
148 virtual bool isAlive(Visitor*) const { return 0; } 148 virtual bool isHeapObjectAlive(Visitor*) const override { return 0; }
149 149
150 template<typename T> class GarbageCollected { }; 150 template<typename T> class GarbageCollected { };
151 151
152 template<typename T> 152 template<typename T>
153 class GarbageCollectedFinalized : public GarbageCollected<T> { }; 153 class GarbageCollectedFinalized : public GarbageCollected<T> { };
154 154
155 template<typename T> class Member { 155 template<typename T> class Member {
156 public: 156 public:
157 operator T*() const { return 0; } 157 operator T*() const { return 0; }
158 T* operator->() { return 0; } 158 T* operator->() { return 0; }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 void trace(const T&); 211 void trace(const T&);
212 }; 212 };
213 213
214 class Visitor : public VisitorHelper<Visitor> { 214 class Visitor : public VisitorHelper<Visitor> {
215 public: 215 public:
216 template<typename T, void (T::*method)(Visitor*)> 216 template<typename T, void (T::*method)(Visitor*)>
217 void registerWeakMembers(const T* obj); 217 void registerWeakMembers(const T* obj);
218 }; 218 };
219 219
220 class GarbageCollectedMixin { 220 class GarbageCollectedMixin {
221 public:
221 virtual void adjustAndMark(Visitor*) const = 0; 222 virtual void adjustAndMark(Visitor*) const = 0;
222 virtual bool isAlive(Visitor*) const = 0; 223 virtual bool isHeapObjectAlive(Visitor*) const = 0;
223 virtual void trace(Visitor*) { } 224 virtual void trace(Visitor*) { }
224 }; 225 };
225 226
226 template<typename T> 227 template<typename T>
227 struct TraceIfNeeded { 228 struct TraceIfNeeded {
228 static void trace(Visitor*, T*); 229 static void trace(Visitor*, T*);
229 }; 230 };
230 231
231 // blink::ScriptWrappable receives special treatment 232 // blink::ScriptWrappable receives special treatment
232 // so as to allow it to be used together with GarbageCollected<T>, 233 // so as to allow it to be used together with GarbageCollected<T>,
233 // even when its user-declared destructor is provided. 234 // even when its user-declared destructor is provided.
234 // As it is with Oilpan disabled. 235 // As it is with Oilpan disabled.
235 class ScriptWrappable { 236 class ScriptWrappable {
236 public: 237 public:
237 ~ScriptWrappable() { /* user-declared, thus, non-trivial */ } 238 ~ScriptWrappable() { /* user-declared, thus, non-trivial */ }
238 }; 239 };
239 240
240 } 241 }
241 242
242 namespace WTF { 243 namespace WTF {
243 244
244 template<typename T> 245 template<typename T>
245 struct VectorTraits<blink::Member<T> > { 246 struct VectorTraits<blink::Member<T> > {
246 static const bool needsDestruction = false; 247 static const bool needsDestruction = false;
247 }; 248 };
248 249
249 } 250 }
250 251
251 #endif 252 #endif
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/tests/garbage_collected_mixin.h ('k') | tools/clang/blink_gc_plugin/tests/trace_templated_super.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698