| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Visitor_h | 31 #ifndef Visitor_h |
| 32 #define Visitor_h | 32 #define Visitor_h |
| 33 | 33 |
| 34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
| 35 #include "platform/heap/GarbageCollected.h" | 35 #include "platform/heap/GarbageCollected.h" |
| 36 #include "platform/heap/StackFrameDepth.h" | 36 #include "platform/heap/StackFrameDepth.h" |
| 37 #include "platform/heap/ThreadState.h" | 37 #include "platform/heap/ThreadState.h" |
| 38 #include "wtf/Allocator.h" |
| 38 #include "wtf/Assertions.h" | 39 #include "wtf/Assertions.h" |
| 39 #include "wtf/Atomics.h" | 40 #include "wtf/Atomics.h" |
| 40 #include "wtf/Deque.h" | 41 #include "wtf/Deque.h" |
| 41 #include "wtf/Forward.h" | 42 #include "wtf/Forward.h" |
| 42 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
| 43 #include "wtf/HashTraits.h" | 44 #include "wtf/HashTraits.h" |
| 44 #include "wtf/InstanceCounter.h" | 45 #include "wtf/InstanceCounter.h" |
| 45 #include "wtf/TypeTraits.h" | 46 #include "wtf/TypeTraits.h" |
| 46 | 47 |
| 47 namespace blink { | 48 namespace blink { |
| 48 | 49 |
| 49 template<typename T> class GarbageCollected; | 50 template<typename T> class GarbageCollected; |
| 50 class HeapObjectHeader; | 51 class HeapObjectHeader; |
| 51 class InlinedGlobalMarkingVisitor; | 52 class InlinedGlobalMarkingVisitor; |
| 52 template<typename T> class TraceTrait; | 53 template<typename T> class TraceTrait; |
| 53 template<typename T> class TraceEagerlyTrait; | 54 template<typename T> class TraceEagerlyTrait; |
| 54 class Visitor; | 55 class Visitor; |
| 55 | 56 |
| 56 // The TraceMethodDelegate is used to convert a trace method for type T to a Tra
ceCallback. | 57 // The TraceMethodDelegate is used to convert a trace method for type T to a Tra
ceCallback. |
| 57 // This allows us to pass a type's trace method as a parameter to the Persistent
Node | 58 // This allows us to pass a type's trace method as a parameter to the Persistent
Node |
| 58 // constructor. The PersistentNode constructor needs the specific trace method d
ue an issue | 59 // constructor. The PersistentNode constructor needs the specific trace method d
ue an issue |
| 59 // with the Windows compiler which instantiates even unused variables. This caus
es problems | 60 // with the Windows compiler which instantiates even unused variables. This caus
es problems |
| 60 // in header files where we have only forward declarations of classes. | 61 // in header files where we have only forward declarations of classes. |
| 61 template<typename T, void (T::*method)(Visitor*)> | 62 template<typename T, void (T::*method)(Visitor*)> |
| 62 struct TraceMethodDelegate { | 63 struct TraceMethodDelegate { |
| 64 STATIC_ONLY(TraceMethodDelegate); |
| 63 static void trampoline(Visitor* visitor, void* self) | 65 static void trampoline(Visitor* visitor, void* self) |
| 64 { | 66 { |
| 65 (reinterpret_cast<T*>(self)->*method)(visitor); | 67 (reinterpret_cast<T*>(self)->*method)(visitor); |
| 66 } | 68 } |
| 67 }; | 69 }; |
| 68 | 70 |
| 69 #define DECLARE_TRACE_IMPL(maybevirtual) \ | 71 #define DECLARE_TRACE_IMPL(maybevirtual) \ |
| 70 public: \ | 72 public: \ |
| 71 maybevirtual void trace(Visitor*); \ | 73 maybevirtual void trace(Visitor*); \ |
| 72 maybevirtual void trace(InlinedGlobalMarkingVisitor); \ | 74 maybevirtual void trace(InlinedGlobalMarkingVisitor); \ |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 private: | 383 private: |
| 382 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c
ast<Visitor*>(helper); } | 384 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c
ast<Visitor*>(helper); } |
| 383 | 385 |
| 384 const MarkingMode m_markingMode; | 386 const MarkingMode m_markingMode; |
| 385 bool m_isGlobalMarkingVisitor; | 387 bool m_isGlobalMarkingVisitor; |
| 386 }; | 388 }; |
| 387 | 389 |
| 388 #if ENABLE(DETAILED_MEMORY_INFRA) | 390 #if ENABLE(DETAILED_MEMORY_INFRA) |
| 389 template<typename T> | 391 template<typename T> |
| 390 struct TypenameStringTrait { | 392 struct TypenameStringTrait { |
| 393 STATIC_ONLY(TypenameStringTrait); |
| 391 static const String get() | 394 static const String get() |
| 392 { | 395 { |
| 393 return WTF::extractTypeNameFromFunctionName(WTF::extractNameFunction<T>(
)); | 396 return WTF::extractTypeNameFromFunctionName(WTF::extractNameFunction<T>(
)); |
| 394 } | 397 } |
| 395 }; | 398 }; |
| 396 #endif | 399 #endif |
| 397 | 400 |
| 398 } // namespace blink | 401 } // namespace blink |
| 399 | 402 |
| 400 #endif // Visitor_h | 403 #endif // Visitor_h |
| OLD | NEW |