OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 EnsurePtrConvertibleArgDefn(U, T)) | 119 EnsurePtrConvertibleArgDefn(U, T)) |
120 : m_ptr(o.get()) { | 120 : m_ptr(o.get()) { |
121 T* ptr = m_ptr; | 121 T* ptr = m_ptr; |
122 refIfNotNull(ptr); | 122 refIfNotNull(ptr); |
123 } | 123 } |
124 | 124 |
125 template <typename T> | 125 template <typename T> |
126 template <typename U> | 126 template <typename U> |
127 inline PassRefPtr<T>::PassRefPtr(RefPtr<U>&& o, | 127 inline PassRefPtr<T>::PassRefPtr(RefPtr<U>&& o, |
128 EnsurePtrConvertibleArgDefn(U, T)) | 128 EnsurePtrConvertibleArgDefn(U, T)) |
129 : m_ptr(o.release().leakRef()) {} | 129 : m_ptr(o.leakRef()) {} |
130 | 130 |
131 template <typename T> | 131 template <typename T> |
132 inline T* PassRefPtr<T>::leakRef() const { | 132 inline T* PassRefPtr<T>::leakRef() const { |
133 T* ptr = m_ptr; | 133 T* ptr = m_ptr; |
134 m_ptr = nullptr; | 134 m_ptr = nullptr; |
135 return ptr; | 135 return ptr; |
136 } | 136 } |
137 | 137 |
138 template <typename T, typename U> | 138 template <typename T, typename U> |
139 inline bool operator==(const PassRefPtr<T>& a, const PassRefPtr<U>& b) { | 139 inline bool operator==(const PassRefPtr<T>& a, const PassRefPtr<U>& b) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 inline T* getPtr(const PassRefPtr<T>& p) { | 215 inline T* getPtr(const PassRefPtr<T>& p) { |
216 return p.get(); | 216 return p.get(); |
217 } | 217 } |
218 | 218 |
219 } // namespace WTF | 219 } // namespace WTF |
220 | 220 |
221 using WTF::PassRefPtr; | 221 using WTF::PassRefPtr; |
222 using WTF::adoptRef; | 222 using WTF::adoptRef; |
223 | 223 |
224 #endif // WTF_PassRefPtr_h | 224 #endif // WTF_PassRefPtr_h |
OLD | NEW |