Changeset 47592 in webkit
- Timestamp:
- Aug 20, 2009 1:12:17 PM (15 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r47582 r47592 1 2009-08-20 Yongjun Zhang <yongjun.zhang@nokia.com> 2 3 Reviewed by Eric Seidel. 4 5 https://bugs.webkit.org/show_bug.cgi?id=28054 6 7 Use a helper function to work around winscw compiler forward declaration bug 8 regarding templated classes. 9 10 Add parenthesis around (PassRefPtr::*UnspecifiedBoolType) to make winscw compiler 11 work with the default UnSpecifiedBoolType() operator, which removes the winscw 12 specific bool cast hack. 13 14 * wtf/PassRefPtr.h: 15 (WTF::derefIfNotNull): 16 (WTF::PassRefPtr::~PassRefPtr): 17 1 18 2009-08-19 Yong Li <yong.li@torchmobile.com> 2 19 -
trunk/JavaScriptCore/wtf/PassRefPtr.h
r43259 r47592 29 29 template<typename T> class PassRefPtr; 30 30 template <typename T> PassRefPtr<T> adoptRef(T*); 31 32 // Remove inline for winscw compiler to prevent the compiler agressively resolving 33 // T::deref(), which will fail compiling when PassRefPtr<T> is used as class member 34 // or function arguments before T is defined. 35 template<typename T> 36 #if !COMPILER(WINSCW) 37 inline 38 #endif 39 void derefIfNotNull(T* ptr) 40 { 41 if (UNLIKELY(ptr != 0)) 42 ptr->deref(); 43 } 31 44 32 45 template<typename T> class PassRefPtr { … … 41 54 template <typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.releaseRef()) { } 42 55 43 ALWAYS_INLINE ~PassRefPtr() { if (UNLIKELY(m_ptr != 0)) m_ptr->deref(); }44 56 ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull<T>(m_ptr); } 57 45 58 template <class U> 46 59 PassRefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); } … … 57 70 58 71 // This conversion operator allows implicit conversion to bool but not to other integer types. 59 #if COMPILER(WINSCW) 60 operator bool() const { return m_ptr; } 61 #else 62 typedef T* PassRefPtr::*UnspecifiedBoolType; 72 // Parenthesis is needed for winscw compiler to resolve class qualifier in this case. 73 typedef T* (PassRefPtr::*UnspecifiedBoolType); 63 74 operator UnspecifiedBoolType() const { return m_ptr ? &PassRefPtr::m_ptr : 0; } 64 #endif 75 65 76 PassRefPtr& operator=(T*); 66 77 PassRefPtr& operator=(const PassRefPtr&);
Note: See TracChangeset
for help on using the changeset viewer.