OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 inline SmartArrayPointer() { } | 122 inline SmartArrayPointer() { } |
123 explicit inline SmartArrayPointer(T* ptr) | 123 explicit inline SmartArrayPointer(T* ptr) |
124 : SmartPointerBase<ArrayDeallocator<T>, T>(ptr) { } | 124 : SmartPointerBase<ArrayDeallocator<T>, T>(ptr) { } |
125 inline SmartArrayPointer(const SmartArrayPointer<T>& rhs) | 125 inline SmartArrayPointer(const SmartArrayPointer<T>& rhs) |
126 : SmartPointerBase<ArrayDeallocator<T>, T>(rhs) { } | 126 : SmartPointerBase<ArrayDeallocator<T>, T>(rhs) { } |
127 }; | 127 }; |
128 | 128 |
129 | 129 |
130 template<typename T> | 130 template<typename T> |
131 struct ObjectDeallocator { | 131 struct ObjectDeallocator { |
132 static void Delete(T* array) { | 132 static void Delete(T* object) { |
133 Malloced::Delete(array); | 133 delete object; |
134 } | 134 } |
135 }; | 135 }; |
136 | 136 |
| 137 |
137 template<typename T> | 138 template<typename T> |
138 class SmartPointer: public SmartPointerBase<ObjectDeallocator<T>, T> { | 139 class SmartPointer: public SmartPointerBase<ObjectDeallocator<T>, T> { |
139 public: | 140 public: |
140 inline SmartPointer() { } | 141 inline SmartPointer() { } |
141 explicit inline SmartPointer(T* ptr) | 142 explicit inline SmartPointer(T* ptr) |
142 : SmartPointerBase<ObjectDeallocator<T>, T>(ptr) { } | 143 : SmartPointerBase<ObjectDeallocator<T>, T>(ptr) { } |
143 inline SmartPointer(const SmartPointer<T>& rhs) | 144 inline SmartPointer(const SmartPointer<T>& rhs) |
144 : SmartPointerBase<ObjectDeallocator<T>, T>(rhs) { } | 145 : SmartPointerBase<ObjectDeallocator<T>, T>(rhs) { } |
145 }; | 146 }; |
146 | 147 |
147 } } // namespace v8::internal | 148 } } // namespace v8::internal |
148 | 149 |
149 #endif // V8_SMART_POINTERS_H_ | 150 #endif // V8_SMART_POINTERS_H_ |
OLD | NEW |