Changeset 48825 in webkit for trunk/JavaScriptCore/wtf/RefPtr.h


Ignore:
Timestamp:
Sep 28, 2009, 1:09:40 PM (16 years ago)
Author:
[email protected]
Message:

2009-09-28 Yongjun Zhang <[email protected]>

Reviewed by Eric Seidel.

https://bugs.webkit.org/show_bug.cgi?id=28054

Use derefInNotNull() to work around winscw compiler forward declaration bug
regarding templated classes.

The compiler bug is reported at
https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812.

The change should be reverted when the above bug is fixed in winscw compiler.

Add parenthesis around (RefPtr::*UnspecifiedBoolType) to make winscw compiler
work with the default UnSpecifiedBoolType() operator, which removes the winscw hack.

  • wtf/RefPtr.h: (WTF::RefPtr::~RefPtr): (WTF::RefPtr::clear): (WTF::RefPtr::operator UnspecifiedBoolType):

2009-09-28 Yongjun Zhang <[email protected]>

Reviewed by Eric Seidel.

Make JObjectWrapper::ref() and deref() public accessible to derefIfNull().

Will be reverted when the following winscw compiler bug is fixed.
https://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=9812

  • bridge/jni/jni_instance.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/RefPtr.h

    r45072 r48825  
    4949        bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
    5050
    51         ~RefPtr() { if (T* ptr = m_ptr) ptr->deref(); }
     51        ~RefPtr() { derefIfNotNull(m_ptr); }
    5252       
    5353        template <typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); }
     
    5555        T* get() const { return m_ptr; }
    5656       
    57         void clear() { if (T* ptr = m_ptr) ptr->deref(); m_ptr = 0; }
     57        void clear() { derefIfNotNull(m_ptr); m_ptr = 0; }
    5858        PassRefPtr<T> release() { PassRefPtr<T> tmp = adoptRef(m_ptr); m_ptr = 0; return tmp; }
    5959
     
    6464   
    6565        // This conversion operator allows implicit conversion to bool but not to other integer types.
    66 #if COMPILER(WINSCW)
    67         operator bool() const { return m_ptr; }
    68 #else
    69         typedef T* RefPtr::*UnspecifiedBoolType;
     66        typedef T* (RefPtr::*UnspecifiedBoolType);
    7067        operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : 0; }
    71 #endif
    7268       
    7369        RefPtr& operator=(const RefPtr&);
Note: See TracChangeset for help on using the changeset viewer.