Home | History | Annotate | Download | only in tests
      1 // Copyright 2016 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 FIELDS_ILLEGAL_TRACING_H_
      6 #define FIELDS_ILLEGAL_TRACING_H_
      7 
      8 #include "heap/stubs.h"
      9 
     10 namespace blink {
     11 
     12 namespace bar {
     13 
     14 // check that (only) std::unique_ptr<> is reported
     15 // as an illegal smart pointer type.
     16 template<typename T> class unique_ptr {
     17 public:
     18     ~unique_ptr() { }
     19     operator T*() const { return 0; }
     20     T* operator->() { return 0; }
     21 
     22     void trace(Visitor* visitor)
     23     {
     24     }
     25 };
     26 
     27 }
     28 
     29 class HeapObject;
     30 class PartObject;
     31 
     32 class PartObject {
     33     DISALLOW_NEW();
     34 public:
     35     void trace(Visitor*);
     36 private:
     37     OwnPtr<HeapObject> m_obj1;
     38     RefPtr<HeapObject> m_obj2;
     39     bar::unique_ptr<HeapObject> m_obj3;
     40     std::unique_ptr<HeapObject> m_obj4;
     41 };
     42 
     43 class HeapObject : public GarbageCollectedFinalized<HeapObject> {
     44 public:
     45     void trace(Visitor*);
     46 private:
     47     PartObject m_part;
     48     OwnPtr<HeapObject> m_obj1;
     49     RefPtr<HeapObject> m_obj2;
     50     bar::unique_ptr<HeapObject> m_obj3;
     51     std::unique_ptr<HeapObject> m_obj4;
     52 };
     53 
     54 }
     55 
     56 #endif
     57