Index: tools/clang/blink_gc_plugin/tests/destructor_eagerly_finalized.h |
diff --git a/tools/clang/blink_gc_plugin/tests/destructor_eagerly_finalized.h b/tools/clang/blink_gc_plugin/tests/destructor_eagerly_finalized.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..77a29dea097bdeeac02b11ec22f1d81147ee130b |
--- /dev/null |
+++ b/tools/clang/blink_gc_plugin/tests/destructor_eagerly_finalized.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef DESTRUCTOR_EAGERLY_FINALIZED_H_ |
+#define DESTRUCTOR_EAGERLY_FINALIZED_H_ |
+ |
+#include "heap/stubs.h" |
+ |
+namespace blink { |
+ |
+class HeapObject : public GarbageCollected<HeapObject> { |
+public: |
+ void trace(Visitor*) { } |
+ void foo() { } |
+}; |
+ |
+class HeapObjectEagerFinalized |
+ : public GarbageCollectedFinalized<HeapObjectEagerFinalized> { |
+public: |
+ EAGERLY_FINALIZED(); |
+ ~HeapObjectEagerFinalized(); |
+ void trace(Visitor*); |
+ |
+ void foo() { } |
+ |
+private: |
+ Member<HeapObject> m_obj; |
+}; |
+ |
+// Accessing other eagerly finalized objects during finalization is not allowed. |
+class HeapObjectEagerFinalizedAlso |
+ : public GarbageCollectedFinalized<HeapObjectEagerFinalizedAlso> { |
+public: |
+ EAGERLY_FINALIZED(); |
+ ~HeapObjectEagerFinalizedAlso(); |
+ void trace(Visitor*); |
+ |
+private: |
+ Member<HeapObject> m_heapObject; |
+ Member<HeapObjectEagerFinalized> m_heapObjectFinalized; |
+ HeapVector<Member<HeapObjectEagerFinalized>> m_heapVector; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // DESTRUCTOR_EAGERLY_FINALIZED_H_ |