Changeset 37660 in webkit for trunk/JavaScriptCore/wtf/GOwnPtr.h


Ignore:
Timestamp:
Oct 17, 2008, 2:16:01 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-17 Marco Barisione <[email protected]>

Reviewed by Sam Weinig. Landed by Jan Alonzo.

https://bugs.webkit.org/show_bug.cgi?id=21603
[GTK] Minor fixes to GOwnPtr

  • wtf/GOwnPtr.cpp: (WTF::GError): (WTF::GList): (WTF::GCond): (WTF::GMutex): (WTF::GPatternSpec): (WTF::GDir):
  • wtf/GOwnPtr.h: (WTF::freeOwnedGPtr): (WTF::GOwnPtr::~GOwnPtr): (WTF::GOwnPtr::outPtr): (WTF::GOwnPtr::set): (WTF::GOwnPtr::clear):
  • wtf/Threading.h:

2008-10-17 Marco Barisione <[email protected]>

Reviewed by Sam Weinig. Landed by Jan Alonzo.

https://bugs.webkit.org/show_bug.cgi?id=21603
[GTK] Minor fixes to GOwnPtr

  • platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: (WebCore::mediaPlayerPrivateErrorCallback):
File:
1 edited

Legend:

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

    r37556 r37660  
    2929
    3030namespace WTF {
    31     template <typename T> inline void freeOwnedPtr(T* ptr) { g_free(reinterpret_cast<void*>(ptr)); }
    32     template<> void freeOwnedPtr<GError>(GError*);
    33     template<> void freeOwnedPtr<GList>(GList*);
    34     template<> void freeOwnedPtr<GCond>(GCond*);
    35     template<> void freeOwnedPtr<GMutex>(GMutex*);
    36     template<> void freeOwnedPtr<GPatternSpec>(GPatternSpec*);
    37     template<> void freeOwnedPtr<GDir>(GDir*);
     31    template <typename T> inline void freeOwnedGPtr(T* ptr) { g_free(reinterpret_cast<void*>(ptr)); }
     32    template<> void freeOwnedGPtr<GError>(GError*);
     33    template<> void freeOwnedGPtr<GList>(GList*);
     34    template<> void freeOwnedGPtr<GCond>(GCond*);
     35    template<> void freeOwnedGPtr<GMutex>(GMutex*);
     36    template<> void freeOwnedGPtr<GPatternSpec>(GPatternSpec*);
     37    template<> void freeOwnedGPtr<GDir>(GDir*);
    3838
    3939    template <typename T> class GOwnPtr : Noncopyable {
    4040    public:
    4141        explicit GOwnPtr(T* ptr = 0) : m_ptr(ptr) { }
    42         ~GOwnPtr() { freeOwnedPtr(m_ptr); }
     42        ~GOwnPtr() { freeOwnedGPtr(m_ptr); }
    4343
    4444        T* get() const { return m_ptr; }
    4545        T* release() { T* ptr = m_ptr; m_ptr = 0; return ptr; }
    46         T*& rawPtr() { return m_ptr; }
     46        T*& outPtr() { ASSERT(!m_ptr); return m_ptr; }
    4747
    48         void set(T* ptr) { ASSERT(!ptr || m_ptr != ptr); freeOwnedPtr(m_ptr); m_ptr = ptr; }
    49         void clear() { freeOwnedPtr(m_ptr); m_ptr = 0; }
     48        void set(T* ptr) { ASSERT(!ptr || m_ptr != ptr); freeOwnedGPtr(m_ptr); m_ptr = ptr; }
     49        void clear() { freeOwnedGPtr(m_ptr); m_ptr = 0; }
    5050
    5151        T& operator*() const { ASSERT(m_ptr); return *m_ptr; }
Note: See TracChangeset for help on using the changeset viewer.