Home | History | Annotate | Download | only in tests
      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 CLASS_REQUIRES_FINALIZATION_MIXIN_H_
      6 #define CLASS_REQUIRES_FINALIZATION_MIXIN_H_
      7 
      8 #include "heap/stubs.h"
      9 
     10 namespace WebCore {
     11 
     12 class OffHeap : public RefCounted<OffHeap> { };
     13 class OnHeap : public GarbageCollected<OnHeap> { };
     14 
     15 class Mixin : public GarbageCollectedMixin {
     16 public:
     17     void trace(Visitor*);
     18 private:
     19     RefPtr<OffHeap> m_offHeap; // Requires finalization
     20     Member<OnHeap> m_onHeap;
     21 };
     22 
     23 class NeedsFinalizer : public GarbageCollected<NeedsFinalizer>, public Mixin {
     24     USING_GARBAGE_COLLECTED_MIXIN(NeedsFinalizer);
     25 public:
     26     void trace(Visitor*);
     27 private:
     28     Member<OnHeap> m_obj;
     29 };
     30 
     31 class HasFinalizer : public GarbageCollectedFinalized<HasFinalizer>,
     32                      public Mixin {
     33     USING_GARBAGE_COLLECTED_MIXIN(HasFinalizer);
     34 public:
     35     void trace(Visitor*);
     36 private:
     37     Member<OnHeap> m_obj;
     38 };
     39 
     40 }
     41 
     42 #endif
     43