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


Ignore:
Timestamp:
Feb 12, 2010, 6:29:02 AM (15 years ago)
Author:
[email protected]
Message:

Additional refptr/passrefptr workarounds for WINSCW compiler

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

Patch by Janne Koskinen <[email protected]> on 2010-02-12

Reviewed by Tor Arne Vestbø.

  • wtf/PassRefPtr.h:

(WTF::refIfNotNull):
(WTF::PassRefPtr::PassRefPtr):
(WTF::PassRefPtr::~PassRefPtr):
(WTF::PassRefPtr::clear):
(WTF::::operator):

  • wtf/RefPtr.h:

(WTF::RefPtr::RefPtr):
(WTF::::operator):

File:
1 edited

Legend:

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

    r54596 r54724  
    3939    public:
    4040        RefPtr() : m_ptr(0) { }
    41         RefPtr(T* ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
    42         RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { if (T* ptr = m_ptr) ptr->ref(); }
     41        RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
     42        RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { T* ptr = m_ptr; refIfNotNull(ptr); }
    4343        // see comment in PassRefPtr.h for why this takes const reference
    4444        template <typename U> RefPtr(const PassRefPtr<U>&);
     
    5454        ~RefPtr() { derefIfNotNull(m_ptr); }
    5555       
    56         template <typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); }
     56        template <typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { T* ptr = m_ptr; refIfNotNull(ptr); }
    5757       
    5858        T* get() const { return m_ptr; }
     
    9999    {
    100100        T* optr = o.get();
    101         if (optr)
    102             optr->ref();
     101        refIfNotNull(optr);
    103102        T* ptr = m_ptr;
    104103        m_ptr = optr;
    105         if (ptr)
    106             ptr->deref();
     104        derefIfNotNull(ptr);
    107105        return *this;
    108106    }
     
    111109    {
    112110        T* optr = o.get();
    113         if (optr)
    114             optr->ref();
     111        refIfNotNull(optr);
    115112        T* ptr = m_ptr;
    116113        m_ptr = optr;
    117         if (ptr)
    118             ptr->deref();
     114        derefIfNotNull(ptr);
    119115        return *this;
    120116    }
     
    122118    template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(T* optr)
    123119    {
    124         if (optr)
    125             optr->ref();
     120        refIfNotNull(optr);
    126121        T* ptr = m_ptr;
    127122        m_ptr = optr;
    128         if (ptr)
    129             ptr->deref();
     123        derefIfNotNull(ptr);
    130124        return *this;
    131125    }
     
    135129        T* ptr = m_ptr;
    136130        m_ptr = o.releaseRef();
    137         if (ptr)
    138             ptr->deref();
     131        derefIfNotNull(ptr);
    139132        return *this;
    140133    }
     
    144137        T* ptr = m_ptr;
    145138        m_ptr = o.releaseRef();
    146         if (ptr)
    147             ptr->deref();
     139        derefIfNotNull(ptr);
    148140        return *this;
    149141    }
     
    153145        T* ptr = m_ptr;
    154146        m_ptr = o.releaseRef();
    155         if (ptr)
    156             ptr->deref();
     147        derefIfNotNull(ptr);
    157148        return *this;
    158149    }
     
    162153        T* ptr = m_ptr;
    163154        m_ptr = o.releaseRef();
    164         if (ptr)
    165             ptr->deref();
     155        derefIfNotNull(ptr);
    166156        return *this;
    167157    }
Note: See TracChangeset for help on using the changeset viewer.