OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const
RefPtr<U>& p) | 181 template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const
RefPtr<U>& p) |
182 { | 182 { |
183 return RefPtr<T>(static_cast<T*>(p.get())); | 183 return RefPtr<T>(static_cast<T*>(p.get())); |
184 } | 184 } |
185 | 185 |
186 template<typename T> inline T* getPtr(const RefPtr<T>& p) | 186 template<typename T> inline T* getPtr(const RefPtr<T>& p) |
187 { | 187 { |
188 return p.get(); | 188 return p.get(); |
189 } | 189 } |
190 | 190 |
| 191 template<typename T> class RefPtrValuePeeker { |
| 192 public: |
| 193 ALWAYS_INLINE RefPtrValuePeeker(T* p): m_ptr(p) { } |
| 194 template<typename U> RefPtrValuePeeker(const RefPtr<U>& p): m_ptr(p.get(
)) { } |
| 195 template<typename U> RefPtrValuePeeker(const PassRefPtr<U>& p): m_ptr(p.
get()) { } |
| 196 ALWAYS_INLINE operator T*() const { return m_ptr; } |
| 197 private: |
| 198 T* m_ptr; |
| 199 }; |
| 200 |
191 } // namespace WTF | 201 } // namespace WTF |
192 | 202 |
193 using WTF::RefPtr; | 203 using WTF::RefPtr; |
194 using WTF::static_pointer_cast; | 204 using WTF::static_pointer_cast; |
195 | 205 |
196 #endif // WTF_RefPtr_h | 206 #endif // WTF_RefPtr_h |
OLD | NEW |