OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project 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 V8_BASE_SMART_POINTERS_H_ | 5 #ifndef V8_BASE_SMART_POINTERS_H_ |
6 #define V8_BASE_SMART_POINTERS_H_ | 6 #define V8_BASE_SMART_POINTERS_H_ |
7 | 7 |
| 8 #include "src/base/logging.h" |
| 9 |
8 namespace v8 { | 10 namespace v8 { |
9 namespace base { | 11 namespace base { |
10 | 12 |
11 template <typename Deallocator, typename T> | 13 template <typename Deallocator, typename T> |
12 class SmartPointerBase { | 14 class SmartPointerBase { |
13 public: | 15 public: |
14 // Default constructor. Constructs an empty scoped pointer. | 16 // Default constructor. Constructs an empty scoped pointer. |
15 SmartPointerBase() : p_(NULL) {} | 17 SmartPointerBase() : p_(NULL) {} |
16 | 18 |
17 // Constructs a scoped pointer from a plain one. | 19 // Constructs a scoped pointer from a plain one. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 explicit SmartPointer(T* ptr) | 115 explicit SmartPointer(T* ptr) |
114 : SmartPointerBase<ObjectDeallocator<T>, T>(ptr) {} | 116 : SmartPointerBase<ObjectDeallocator<T>, T>(ptr) {} |
115 SmartPointer(const SmartPointer<T>& rhs) | 117 SmartPointer(const SmartPointer<T>& rhs) |
116 : SmartPointerBase<ObjectDeallocator<T>, T>(rhs) {} | 118 : SmartPointerBase<ObjectDeallocator<T>, T>(rhs) {} |
117 }; | 119 }; |
118 | 120 |
119 } // namespace base | 121 } // namespace base |
120 } // namespace v8 | 122 } // namespace v8 |
121 | 123 |
122 #endif // V8_SMART_POINTERS_H_ | 124 #endif // V8_SMART_POINTERS_H_ |
OLD | NEW |