Commit 38edc137 authored by jmalonzo@webkit.org's avatar jmalonzo@webkit.org

2008-10-17 Marco Barisione <marco.barisione@collabora.co.uk>

        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  <marco.barisione@collabora.co.uk>

        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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 22edf579
2008-10-17 Marco Barisione <marco.barisione@collabora.co.uk>
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 Maciej Stachowiak <mjs@apple.com>
Reviewed by Cameron Zwarich.
......
......@@ -21,36 +21,36 @@
namespace WTF {
template <> void freeOwnedPtr<GError>(GError* ptr)
template <> void freeOwnedGPtr<GError>(GError* ptr)
{
if (ptr)
g_error_free(ptr);
}
template <> void freeOwnedPtr<GList>(GList* ptr)
template <> void freeOwnedGPtr<GList>(GList* ptr)
{
g_list_free(ptr);
}
template <> void freeOwnedPtr<GCond>(GCond* ptr)
template <> void freeOwnedGPtr<GCond>(GCond* ptr)
{
if (ptr)
g_cond_free(ptr);
}
template <> void freeOwnedPtr<GMutex>(GMutex* ptr)
template <> void freeOwnedGPtr<GMutex>(GMutex* ptr)
{
if (ptr)
g_mutex_free(ptr);
}
template <> void freeOwnedPtr<GPatternSpec>(GPatternSpec* ptr)
template <> void freeOwnedGPtr<GPatternSpec>(GPatternSpec* ptr)
{
if (ptr)
g_pattern_spec_free(ptr);
}
template <> void freeOwnedPtr<GDir>(GDir* ptr)
template <> void freeOwnedGPtr<GDir>(GDir* ptr)
{
if (ptr)
g_dir_close(ptr);
......
......@@ -28,25 +28,25 @@
#include <wtf/Noncopyable.h>
namespace WTF {
template <typename T> inline void freeOwnedPtr(T* ptr) { g_free(reinterpret_cast<void*>(ptr)); }
template<> void freeOwnedPtr<GError>(GError*);
template<> void freeOwnedPtr<GList>(GList*);
template<> void freeOwnedPtr<GCond>(GCond*);
template<> void freeOwnedPtr<GMutex>(GMutex*);
template<> void freeOwnedPtr<GPatternSpec>(GPatternSpec*);
template<> void freeOwnedPtr<GDir>(GDir*);
template <typename T> inline void freeOwnedGPtr(T* ptr) { g_free(reinterpret_cast<void*>(ptr)); }
template<> void freeOwnedGPtr<GError>(GError*);
template<> void freeOwnedGPtr<GList>(GList*);
template<> void freeOwnedGPtr<GCond>(GCond*);
template<> void freeOwnedGPtr<GMutex>(GMutex*);
template<> void freeOwnedGPtr<GPatternSpec>(GPatternSpec*);
template<> void freeOwnedGPtr<GDir>(GDir*);
template <typename T> class GOwnPtr : Noncopyable {
public:
explicit GOwnPtr(T* ptr = 0) : m_ptr(ptr) { }
~GOwnPtr() { freeOwnedPtr(m_ptr); }
~GOwnPtr() { freeOwnedGPtr(m_ptr); }
T* get() const { return m_ptr; }
T* release() { T* ptr = m_ptr; m_ptr = 0; return ptr; }
T*& rawPtr() { return m_ptr; }
T*& outPtr() { ASSERT(!m_ptr); return m_ptr; }
void set(T* ptr) { ASSERT(!ptr || m_ptr != ptr); freeOwnedPtr(m_ptr); m_ptr = ptr; }
void clear() { freeOwnedPtr(m_ptr); m_ptr = 0; }
void set(T* ptr) { ASSERT(!ptr || m_ptr != ptr); freeOwnedGPtr(m_ptr); m_ptr = ptr; }
void clear() { freeOwnedGPtr(m_ptr); m_ptr = 0; }
T& operator*() const { ASSERT(m_ptr); return *m_ptr; }
T* operator->() const { ASSERT(m_ptr); return m_ptr; }
......
......@@ -62,6 +62,7 @@
#include <wtf/Assertions.h>
#include <wtf/Locker.h>
#include <wtf/Noncopyable.h>
#if PLATFORM(GTK)
#include <wtf/GOwnPtr.h>
#endif
......
2008-10-17 Marco Barisione <marco.barisione@collabora.co.uk>
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):
2008-10-17 Timothy Hatcher <timothy@apple.com>
Recompile the JavaScript functions when removing any listener, so functions that are
......
......@@ -57,7 +57,7 @@ gboolean mediaPlayerPrivateErrorCallback(GstBus* bus, GstMessage* message, gpoin
GOwnPtr<GError> err;
GOwnPtr<gchar> debug;
gst_message_parse_error(message, &err.rawPtr(), &debug.rawPtr());
gst_message_parse_error(message, &err.outPtr(), &debug.outPtr());
if (err->code == 3) {
LOG_VERBOSE(Media, "File not found");
MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment