OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reser
ved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reser
ved. |
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 { | 195 { |
196 return b.get(); | 196 return b.get(); |
197 } | 197 } |
198 | 198 |
199 template <typename T> PassRefPtr<T> adoptRef(T* p) | 199 template <typename T> PassRefPtr<T> adoptRef(T* p) |
200 { | 200 { |
201 adopted(p); | 201 adopted(p); |
202 return PassRefPtr<T>(p, PassRefPtr<T>::AdoptRef); | 202 return PassRefPtr<T>(p, PassRefPtr<T>::AdoptRef); |
203 } | 203 } |
204 | 204 |
205 template <typename T, typename U> inline PassRefPtr<T> static_pointer_cast(const
PassRefPtr<U>& p) | |
206 { | |
207 return adoptRef(static_cast<T*>(p.leakRef())); | |
208 } | |
209 | |
210 template <typename T> inline T* getPtr(const PassRefPtr<T>& p) | 205 template <typename T> inline T* getPtr(const PassRefPtr<T>& p) |
211 { | 206 { |
212 return p.get(); | 207 return p.get(); |
213 } | 208 } |
214 | 209 |
215 } // namespace WTF | 210 } // namespace WTF |
216 | 211 |
217 using WTF::PassRefPtr; | 212 using WTF::PassRefPtr; |
218 using WTF::adoptRef; | 213 using WTF::adoptRef; |
219 using WTF::static_pointer_cast; | |
220 | 214 |
221 #endif // WTF_PassRefPtr_h | 215 #endif // WTF_PassRefPtr_h |
OLD | NEW |