| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 template<typename T> inline typename OwnArrayPtr<T>::PtrType OwnArrayPtr<T>::lea
kPtr() | 98 template<typename T> inline typename OwnArrayPtr<T>::PtrType OwnArrayPtr<T>::lea
kPtr() |
| 99 { | 99 { |
| 100 PtrType ptr = m_ptr; | 100 PtrType ptr = m_ptr; |
| 101 m_ptr = 0; | 101 m_ptr = 0; |
| 102 return ptr; | 102 return ptr; |
| 103 } | 103 } |
| 104 | 104 |
| 105 template<typename T> inline OwnArrayPtr<T>& OwnArrayPtr<T>::operator=(const Pass
OwnArrayPtr<T>& o) | 105 template<typename T> inline OwnArrayPtr<T>& OwnArrayPtr<T>::operator=(const Pass
OwnArrayPtr<T>& o) |
| 106 { | 106 { |
| 107 PtrType ptr = m_ptr; | 107 ASSERT(!o || o != m_ptr); |
| 108 m_ptr = o.leakPtr(); | 108 OwnArrayPtr ptr = o; |
| 109 ASSERT(!ptr || m_ptr != ptr); | 109 swap(ptr); |
| 110 deleteOwnedArrayPtr(ptr); | |
| 111 return *this; | 110 return *this; |
| 112 } | 111 } |
| 113 | 112 |
| 114 template<typename T> template<typename U> inline OwnArrayPtr<T>& OwnArrayPtr<T>:
:operator=(const PassOwnArrayPtr<U>& o) | 113 template<typename T> template<typename U> inline OwnArrayPtr<T>& OwnArrayPtr<T>:
:operator=(const PassOwnArrayPtr<U>& o) |
| 115 { | 114 { |
| 116 PtrType ptr = m_ptr; | 115 ASSERT(!o || o != m_ptr); |
| 117 m_ptr = o.leakPtr(); | 116 OwnArrayPtr ptr = o; |
| 118 ASSERT(!ptr || m_ptr != ptr); | 117 swap(ptr); |
| 119 deleteOwnedArrayPtr(ptr); | |
| 120 return *this; | 118 return *this; |
| 121 } | 119 } |
| 122 | 120 |
| 123 template <typename T> inline void swap(OwnArrayPtr<T>& a, OwnArrayPtr<T>& b) | 121 template <typename T> inline void swap(OwnArrayPtr<T>& a, OwnArrayPtr<T>& b) |
| 124 { | 122 { |
| 125 a.swap(b); | 123 a.swap(b); |
| 126 } | 124 } |
| 127 | 125 |
| 128 template<typename T, typename U> inline bool operator==(const OwnArrayPtr<T>& a,
U* b) | 126 template<typename T, typename U> inline bool operator==(const OwnArrayPtr<T>& a,
U* b) |
| 129 { | 127 { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 148 template <typename T> inline T* getPtr(const OwnArrayPtr<T>& p) | 146 template <typename T> inline T* getPtr(const OwnArrayPtr<T>& p) |
| 149 { | 147 { |
| 150 return p.get(); | 148 return p.get(); |
| 151 } | 149 } |
| 152 | 150 |
| 153 } // namespace WTF | 151 } // namespace WTF |
| 154 | 152 |
| 155 using WTF::OwnArrayPtr; | 153 using WTF::OwnArrayPtr; |
| 156 | 154 |
| 157 #endif // WTF_OwnArrayPtr_h | 155 #endif // WTF_OwnArrayPtr_h |
| OLD | NEW |