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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, const RawPtr<U>& b) | 176 template<typename T, typename U> inline bool operator!=(const PassRefPtr<T>& a, const RawPtr<U>& b) |
177 { | 177 { |
178 return a.get() != b.get(); | 178 return a.get() != b.get(); |
179 } | 179 } |
180 | 180 |
181 template<typename T, typename U> inline bool operator!=(const RawPtr<T>& a, const PassRefPtr<U>& b) | 181 template<typename T, typename U> inline bool operator!=(const RawPtr<T>& a, const PassRefPtr<U>& b) |
182 { | 182 { |
183 return a.get() != b.get(); | 183 return a.get() != b.get(); |
184 } | 184 } |
185 | 185 |
186 template<typename T> class RefCountedGarbageCollected; | |
haraken
2014/10/12 15:16:45
I'm not sure if this forward declaration is allowe
sof
2014/10/13 12:11:30
It doesn't quite set a precedent, TypeTraits.h alr
sof
2014/10/13 12:11:30
Don't think there is a "using" for it (or in scope
| |
186 template<typename T> PassRefPtr<T> adoptRef(T* p) | 187 template<typename T> PassRefPtr<T> adoptRef(T* p) |
187 { | 188 { |
189 static const bool notRefCountedGarbageCollected = !WTF::IsSubclassOfTemp late<typename WTF::RemoveConst<T>::Type, RefCountedGarbageCollected>::value; | |
190 COMPILE_ASSERT(notRefCountedGarbageCollected, adoptRefIsNotAllowedForRef CountedGarbageCollected); | |
188 adopted(p); | 191 adopted(p); |
189 return PassRefPtr<T>(p, PassRefPtr<T>::AdoptRef); | 192 return PassRefPtr<T>(p, PassRefPtr<T>::AdoptRef); |
190 } | 193 } |
191 | 194 |
192 template<typename T, typename U> inline PassRefPtr<T> static_pointer_cast(co nst PassRefPtr<U>& p) | 195 template<typename T, typename U> inline PassRefPtr<T> static_pointer_cast(co nst PassRefPtr<U>& p) |
193 { | 196 { |
194 return adoptRef(static_cast<T*>(p.leakRef())); | 197 return adoptRef(static_cast<T*>(p.leakRef())); |
195 } | 198 } |
196 | 199 |
197 template<typename T> inline T* getPtr(const PassRefPtr<T>& p) | 200 template<typename T> inline T* getPtr(const PassRefPtr<T>& p) |
198 { | 201 { |
199 return p.get(); | 202 return p.get(); |
200 } | 203 } |
201 | 204 |
202 } // namespace WTF | 205 } // namespace WTF |
203 | 206 |
204 using WTF::PassRefPtr; | 207 using WTF::PassRefPtr; |
205 using WTF::adoptRef; | 208 using WTF::adoptRef; |
206 using WTF::static_pointer_cast; | 209 using WTF::static_pointer_cast; |
207 | 210 |
208 #endif // WTF_PassRefPtr_h | 211 #endif // WTF_PassRefPtr_h |
OLD | NEW |