OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef TEMPLATED_CLASS_WITH_LOCAL_CLASS_REQUIRES_TRACE_H |
| 6 #define TEMPLATED_CLASS_WITH_LOCAL_CLASS_REQUIRES_TRACE_H |
| 7 |
| 8 #include "heap/stubs.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 class NonHeapObject { }; |
| 13 |
| 14 class HeapObject : public GarbageCollected<HeapObject> { |
| 15 public: |
| 16 HeapObject() { } |
| 17 |
| 18 void trace(Visitor*) { } |
| 19 }; |
| 20 |
| 21 template<typename T> |
| 22 class TemplatedObject final |
| 23 : public GarbageCollectedFinalized<TemplatedObject<T> > { |
| 24 public: |
| 25 TemplatedObject(T*) |
| 26 { |
| 27 } |
| 28 |
| 29 void trace(Visitor*); |
| 30 |
| 31 private: |
| 32 class Local final : public GarbageCollected<Local> { |
| 33 public: |
| 34 void trace(Visitor* visitor) |
| 35 { |
| 36 visitor->trace(m_heapObject); |
| 37 visitor->trace(m_object); |
| 38 } |
| 39 private: |
| 40 Member<HeapObject> m_heapObject; |
| 41 OwnPtr<HeapObject> m_object; |
| 42 }; |
| 43 |
| 44 Member<Local> m_local; |
| 45 Member<T> m_memberRef; |
| 46 OwnPtr<T> m_ownRef; |
| 47 }; |
| 48 |
| 49 } // namespace blink |
| 50 |
| 51 #endif // TEMPLATED_CLASS_WITH_LOCAL_CLASS_REQUIRES_TRACE_H |
| 52 |
OLD | NEW |