| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef FIELDS_ILLEGAL_TRACING_H_ | 5 #ifndef FIELDS_ILLEGAL_TRACING_H_ |
| 6 #define FIELDS_ILLEGAL_TRACING_H_ | 6 #define FIELDS_ILLEGAL_TRACING_H_ |
| 7 | 7 |
| 8 #include "heap/stubs.h" | 8 #include "heap/stubs.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 namespace bar { | 12 namespace bar { |
| 13 | 13 |
| 14 // check that (only) std::unique_ptr<> is reported | 14 // check that (only) std::unique_ptr<> is reported |
| 15 // as an illegal smart pointer type. | 15 // as an illegal smart pointer type. |
| 16 template<typename T> class unique_ptr { | 16 template<typename T> class unique_ptr { |
| 17 public: | 17 public: |
| 18 ~unique_ptr() { } | 18 ~unique_ptr() { } |
| 19 operator T*() const { return 0; } | 19 operator T*() const { return 0; } |
| 20 T* operator->() { return 0; } | 20 T* operator->() { return 0; } |
| 21 | 21 |
| 22 void trace(Visitor* visitor) | 22 void Trace(Visitor* visitor) |
| 23 { | 23 { |
| 24 } | 24 } |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 } | 27 } |
| 28 | 28 |
| 29 class HeapObject; | 29 class HeapObject; |
| 30 class PartObject; | 30 class PartObject; |
| 31 | 31 |
| 32 class PartObject { | 32 class PartObject { |
| 33 DISALLOW_NEW(); | 33 DISALLOW_NEW(); |
| 34 public: | 34 public: |
| 35 void trace(Visitor*); | 35 void Trace(Visitor*); |
| 36 private: | 36 private: |
| 37 OwnPtr<HeapObject> m_obj1; | 37 OwnPtr<HeapObject> m_obj1; |
| 38 RefPtr<HeapObject> m_obj2; | 38 RefPtr<HeapObject> m_obj2; |
| 39 bar::unique_ptr<HeapObject> m_obj3; | 39 bar::unique_ptr<HeapObject> m_obj3; |
| 40 std::unique_ptr<HeapObject> m_obj4; | 40 std::unique_ptr<HeapObject> m_obj4; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 class HeapObject : public GarbageCollectedFinalized<HeapObject> { | 43 class HeapObject : public GarbageCollectedFinalized<HeapObject> { |
| 44 public: | 44 public: |
| 45 void trace(Visitor*); | 45 void Trace(Visitor*); |
| 46 private: | 46 private: |
| 47 PartObject m_part; | 47 PartObject m_part; |
| 48 OwnPtr<HeapObject> m_obj1; | 48 OwnPtr<HeapObject> m_obj1; |
| 49 RefPtr<HeapObject> m_obj2; | 49 RefPtr<HeapObject> m_obj2; |
| 50 bar::unique_ptr<HeapObject> m_obj3; | 50 bar::unique_ptr<HeapObject> m_obj3; |
| 51 std::unique_ptr<HeapObject> m_obj4; | 51 std::unique_ptr<HeapObject> m_obj4; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } | 54 } |
| 55 | 55 |
| 56 #endif | 56 #endif |
| OLD | NEW |