Changeset 37556 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Oct 13, 2008, 4:44:35 AM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Darin Adler. Landed by Jan Alonzo.

WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)
http://bugs.webkit.org/show_bug.cgi?id=20483

Start the conversion to use GOwnPtr and fix a memory leak.

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

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

Reviewed by Darin Adler. Landed by Jan Alonzo.

WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)
http://bugs.webkit.org/show_bug.cgi?id=20483

Add a GOwnPtr smart pointer (similar to OwnPtr) to handle memory
allocated by GLib and start the conversion to use it.

  • GNUmakefile.am:
  • wtf/GOwnPtr.cpp: Added. (WTF::GError): (WTF::GList): (WTF::GCond): (WTF::GMutex): (WTF::GPatternSpec): (WTF::GDir):
  • wtf/GOwnPtr.h: Added. (WTF::freeOwnedPtr): (WTF::GOwnPtr::GOwnPtr): (WTF::GOwnPtr::~GOwnPtr): (WTF::GOwnPtr::get): (WTF::GOwnPtr::release): (WTF::GOwnPtr::rawPtr): (WTF::GOwnPtr::set): (WTF::GOwnPtr::clear): (WTF::GOwnPtr::operator*): (WTF::GOwnPtr::operator->): (WTF::GOwnPtr::operator!): (WTF::GOwnPtr::operator UnspecifiedBoolType): (WTF::GOwnPtr::swap): (WTF::swap): (WTF::operator==): (WTF::operator!=): (WTF::getPtr):
  • wtf/Threading.h:
  • wtf/ThreadingGtk.cpp: (WTF::Mutex::~Mutex): (WTF::Mutex::lock): (WTF::Mutex::tryLock): (WTF::Mutex::unlock): (WTF::ThreadCondition::~ThreadCondition): (WTF::ThreadCondition::wait): (WTF::ThreadCondition::timedWait): (WTF::ThreadCondition::signal): (WTF::ThreadCondition::broadcast):
Location:
trunk/JavaScriptCore
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37553 r37556  
     12008-10-13  Marco Barisione  <[email protected]>
     2
     3        Reviewed by Darin Adler. Landed by Jan Alonzo.
     4
     5        WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)
     6        http://bugs.webkit.org/show_bug.cgi?id=20483
     7
     8        Add a GOwnPtr smart pointer (similar to OwnPtr) to handle memory
     9        allocated by GLib and start the conversion to use it.
     10
     11        * GNUmakefile.am:
     12        * wtf/GOwnPtr.cpp: Added.
     13        (WTF::GError):
     14        (WTF::GList):
     15        (WTF::GCond):
     16        (WTF::GMutex):
     17        (WTF::GPatternSpec):
     18        (WTF::GDir):
     19        * wtf/GOwnPtr.h: Added.
     20        (WTF::freeOwnedPtr):
     21        (WTF::GOwnPtr::GOwnPtr):
     22        (WTF::GOwnPtr::~GOwnPtr):
     23        (WTF::GOwnPtr::get):
     24        (WTF::GOwnPtr::release):
     25        (WTF::GOwnPtr::rawPtr):
     26        (WTF::GOwnPtr::set):
     27        (WTF::GOwnPtr::clear):
     28        (WTF::GOwnPtr::operator*):
     29        (WTF::GOwnPtr::operator->):
     30        (WTF::GOwnPtr::operator!):
     31        (WTF::GOwnPtr::operator UnspecifiedBoolType):
     32        (WTF::GOwnPtr::swap):
     33        (WTF::swap):
     34        (WTF::operator==):
     35        (WTF::operator!=):
     36        (WTF::getPtr):
     37        * wtf/Threading.h:
     38        * wtf/ThreadingGtk.cpp:
     39        (WTF::Mutex::~Mutex):
     40        (WTF::Mutex::lock):
     41        (WTF::Mutex::tryLock):
     42        (WTF::Mutex::unlock):
     43        (WTF::ThreadCondition::~ThreadCondition):
     44        (WTF::ThreadCondition::wait):
     45        (WTF::ThreadCondition::timedWait):
     46        (WTF::ThreadCondition::signal):
     47        (WTF::ThreadCondition::broadcast):
     48
    1492008-10-12  Gabriella Toth  <[email protected]>
    250
  • trunk/JavaScriptCore/GNUmakefile.am

    r37457 r37556  
    241241        JavaScriptCore/wtf/Forward.h \
    242242        JavaScriptCore/wtf/GetPtr.h \
     243        JavaScriptCore/wtf/GOwnPtr.cpp \
     244        JavaScriptCore/wtf/GOwnPtr.h \
    243245        JavaScriptCore/wtf/HashCountedSet.h \
    244246        JavaScriptCore/wtf/HashFunctions.h \
  • trunk/JavaScriptCore/wtf/Threading.h

    r37409 r37556  
    6363#include <wtf/Locker.h>
    6464#include <wtf/Noncopyable.h>
     65#if PLATFORM(GTK)
     66#include <wtf/GOwnPtr.h>
     67#endif
    6568
    6669#if PLATFORM(WIN_OS)
     
    118121typedef pthread_cond_t PlatformCondition;
    119122#elif PLATFORM(GTK)
    120 typedef GMutex* PlatformMutex;
    121 typedef GCond* PlatformCondition;
     123typedef GOwnPtr<GMutex> PlatformMutex;
     124typedef GOwnPtr<GCond> PlatformCondition;
    122125#elif PLATFORM(QT)
    123126typedef QT_PREPEND_NAMESPACE(QMutex)* PlatformMutex;
  • trunk/JavaScriptCore/wtf/ThreadingGtk.cpp

    r36846 r37556  
    158158Mutex::~Mutex()
    159159{
    160     g_mutex_free(m_mutex);
    161160}
    162161
    163162void Mutex::lock()
    164163{
    165     g_mutex_lock(m_mutex);
     164    g_mutex_lock(m_mutex.get());
    166165}
    167166
    168167bool Mutex::tryLock()
    169168{
    170     return g_mutex_trylock(m_mutex);
     169    return g_mutex_trylock(m_mutex.get());
    171170}
    172171
    173172void Mutex::unlock()
    174173{
    175     g_mutex_unlock(m_mutex);
     174    g_mutex_unlock(m_mutex.get());
    176175}
    177176
     
    183182ThreadCondition::~ThreadCondition()
    184183{
    185     g_cond_free(m_condition);
    186184}
    187185
    188186void ThreadCondition::wait(Mutex& mutex)
    189187{
    190     g_cond_wait(m_condition, mutex.impl());
     188    g_cond_wait(m_condition.get(), mutex.impl().get());
    191189}
    192190
     
    211209    }
    212210
    213     return g_cond_timed_wait(m_condition, mutex.impl(), &targetTime);
     211    return g_cond_timed_wait(m_condition.get(), mutex.impl().get(), &targetTime);
    214212}
    215213
    216214void ThreadCondition::signal()
    217215{
    218     g_cond_signal(m_condition);
     216    g_cond_signal(m_condition.get());
    219217}
    220218
    221219void ThreadCondition::broadcast()
    222220{
    223     g_cond_broadcast(m_condition);
    224 }
    225 
    226 
    227 }
     221    g_cond_broadcast(m_condition.get());
     222}
     223
     224
     225}
Note: See TracChangeset for help on using the changeset viewer.