summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/wtf/gtk
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:31:00 +0100
committerSteve Block <steveblock@google.com>2010-05-11 14:42:12 +0100
commitdcc8cf2e65d1aa555cce12431a16547e66b469ee (patch)
tree92a8d65cd5383bca9749f5327fb5e440563926e6 /JavaScriptCore/wtf/gtk
parentccac38a6b48843126402088a309597e682f40fe6 (diff)
downloadexternal_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'JavaScriptCore/wtf/gtk')
-rw-r--r--JavaScriptCore/wtf/gtk/GOwnPtr.cpp67
-rw-r--r--JavaScriptCore/wtf/gtk/GOwnPtr.h148
-rw-r--r--JavaScriptCore/wtf/gtk/GRefPtr.cpp38
-rw-r--r--JavaScriptCore/wtf/gtk/GRefPtr.h187
4 files changed, 0 insertions, 440 deletions
diff --git a/JavaScriptCore/wtf/gtk/GOwnPtr.cpp b/JavaScriptCore/wtf/gtk/GOwnPtr.cpp
deleted file mode 100644
index da0d839..0000000
--- a/JavaScriptCore/wtf/gtk/GOwnPtr.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "GOwnPtr.h"
-
-#include <gio/gio.h>
-#include <glib.h>
-
-namespace WTF {
-
-template <> void freeOwnedGPtr<GError>(GError* ptr)
-{
- if (ptr)
- g_error_free(ptr);
-}
-
-template <> void freeOwnedGPtr<GList>(GList* ptr)
-{
- g_list_free(ptr);
-}
-
-template <> void freeOwnedGPtr<GCond>(GCond* ptr)
-{
- if (ptr)
- g_cond_free(ptr);
-}
-
-template <> void freeOwnedGPtr<GMutex>(GMutex* ptr)
-{
- if (ptr)
- g_mutex_free(ptr);
-}
-
-template <> void freeOwnedGPtr<GPatternSpec>(GPatternSpec* ptr)
-{
- if (ptr)
- g_pattern_spec_free(ptr);
-}
-
-template <> void freeOwnedGPtr<GDir>(GDir* ptr)
-{
- if (ptr)
- g_dir_close(ptr);
-}
-
-template <> void freeOwnedGPtr<GFile>(GFile* ptr)
-{
- if (ptr)
- g_object_unref(ptr);
-}
-} // namespace WTF
diff --git a/JavaScriptCore/wtf/gtk/GOwnPtr.h b/JavaScriptCore/wtf/gtk/GOwnPtr.h
deleted file mode 100644
index 1fc594c..0000000
--- a/JavaScriptCore/wtf/gtk/GOwnPtr.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef GOwnPtr_h
-#define GOwnPtr_h
-
-#include <algorithm>
-#include <wtf/Assertions.h>
-#include <wtf/Noncopyable.h>
-
-// Forward delcarations at this point avoid the need to include GLib includes
-// in WTF headers.
-typedef struct _GError GError;
-typedef struct _GList GList;
-typedef struct _GCond GCond;
-typedef struct _GMutex GMutex;
-typedef struct _GPatternSpec GPatternSpec;
-typedef struct _GDir GDir;
-typedef struct _GHashTable GHashTable;
-typedef struct _GFile GFile;
-extern "C" void g_free(void*);
-
-namespace WTF {
-
-template <typename T> inline void freeOwnedGPtr(T* 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<> void freeOwnedGPtr<GHashTable>(GHashTable*);
-template<> void freeOwnedGPtr<GFile>(GFile*);
-
-template <typename T> class GOwnPtr : public Noncopyable {
-public:
- explicit GOwnPtr(T* ptr = 0) : m_ptr(ptr) { }
- ~GOwnPtr() { freeOwnedGPtr(m_ptr); }
-
- T* get() const { return m_ptr; }
- T* release()
- {
- T* ptr = m_ptr;
- m_ptr = 0;
- return ptr;
- }
-
- T*& outPtr()
- {
- ASSERT(!m_ptr);
- return m_ptr;
- }
-
- 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;
- }
-
- bool operator!() const { return !m_ptr; }
-
- // This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef T* GOwnPtr::*UnspecifiedBoolType;
- operator UnspecifiedBoolType() const { return m_ptr ? &GOwnPtr::m_ptr : 0; }
-
- void swap(GOwnPtr& o) { std::swap(m_ptr, o.m_ptr); }
-
-private:
- T* m_ptr;
-};
-
-template <typename T> inline void swap(GOwnPtr<T>& a, GOwnPtr<T>& b)
-{
- a.swap(b);
-}
-
-template <typename T, typename U> inline bool operator==(const GOwnPtr<T>& a, U* b)
-{
- return a.get() == b;
-}
-
-template <typename T, typename U> inline bool operator==(T* a, const GOwnPtr<U>& b)
-{
- return a == b.get();
-}
-
-template <typename T, typename U> inline bool operator!=(const GOwnPtr<T>& a, U* b)
-{
- return a.get() != b;
-}
-
-template <typename T, typename U> inline bool operator!=(T* a, const GOwnPtr<U>& b)
-{
- return a != b.get();
-}
-
-template <typename T> inline typename GOwnPtr<T>::PtrType getPtr(const GOwnPtr<T>& p)
-{
- return p.get();
-}
-
-template <typename T> inline void freeOwnedGPtr(T* ptr)
-{
- g_free(ptr);
-}
-
-} // namespace WTF
-
-using WTF::GOwnPtr;
-
-#endif // GOwnPtr_h
diff --git a/JavaScriptCore/wtf/gtk/GRefPtr.cpp b/JavaScriptCore/wtf/gtk/GRefPtr.cpp
deleted file mode 100644
index e7cf34b..0000000
--- a/JavaScriptCore/wtf/gtk/GRefPtr.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009 Martin Robinson
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "GRefPtr.h"
-
-#include <glib.h>
-
-namespace WTF {
-
-template <> GHashTable* refGPtr(GHashTable* ptr)
-{
- if (ptr)
- g_hash_table_ref(ptr);
- return ptr;
-}
-
-template <> void derefGPtr(GHashTable* ptr)
-{
- g_hash_table_unref(ptr);
-}
-
-} // namespace WTF
diff --git a/JavaScriptCore/wtf/gtk/GRefPtr.h b/JavaScriptCore/wtf/gtk/GRefPtr.h
deleted file mode 100644
index 66739ef..0000000
--- a/JavaScriptCore/wtf/gtk/GRefPtr.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Collabora Ltd.
- * Copyright (C) 2009 Martin Robinson
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef WTF_GRefPtr_h
-#define WTF_GRefPtr_h
-
-#include "AlwaysInline.h"
-#include <algorithm>
-
-typedef struct _GHashTable GHashTable;
-
-namespace WTF {
-
-enum GRefPtrAdoptType { GRefPtrAdopt };
-template <typename T> inline T* refGPtr(T*);
-template <typename T> inline void derefGPtr(T*);
-template <typename T> class GRefPtr;
-template <typename T> GRefPtr<T> adoptGRef(T*);
-template <> GHashTable* refGPtr(GHashTable* ptr);
-template <> void derefGPtr(GHashTable* ptr);
-
-template <typename T> class GRefPtr {
-public:
- GRefPtr() : m_ptr(0) { }
- GRefPtr(T* ptr) : m_ptr(ptr) { if (ptr) refGPtr(ptr); }
- GRefPtr(const GRefPtr& o) : m_ptr(o.m_ptr) { if (T* ptr = m_ptr) refGPtr(ptr); }
- template <typename U> GRefPtr(const GRefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) refGPtr(ptr); }
-
- ~GRefPtr() { if (T* ptr = m_ptr) derefGPtr(ptr); }
-
- void clear()
- {
- if (T* ptr = m_ptr)
- derefGPtr(ptr);
- m_ptr = 0;
- }
-
- T* get() const { return m_ptr; }
- T& operator*() const { return *m_ptr; }
- ALWAYS_INLINE T* operator->() const { return m_ptr; }
-
- bool operator!() const { return !m_ptr; }
-
- // This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef T* GRefPtr::*UnspecifiedBoolType;
- operator UnspecifiedBoolType() const { return m_ptr ? &GRefPtr::m_ptr : 0; }
-
- GRefPtr& operator=(const GRefPtr&);
- GRefPtr& operator=(T*);
- template <typename U> GRefPtr& operator=(const GRefPtr<U>&);
-
- void swap(GRefPtr&);
- friend GRefPtr adoptGRef<T>(T*);
-
-private:
- static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
- // Adopting constructor.
- GRefPtr(T* ptr, GRefPtrAdoptType) : m_ptr(ptr) {}
-
- T* m_ptr;
-};
-
-template <typename T> inline GRefPtr<T>& GRefPtr<T>::operator=(const GRefPtr<T>& o)
-{
- T* optr = o.get();
- if (optr)
- refGPtr(optr);
- T* ptr = m_ptr;
- m_ptr = optr;
- if (ptr)
- derefGPtr(ptr);
- return *this;
-}
-
-template <typename T> inline GRefPtr<T>& GRefPtr<T>::operator=(T* optr)
-{
- T* ptr = m_ptr;
- if (optr)
- refGPtr(optr);
- m_ptr = optr;
- if (ptr)
- derefGPtr(ptr);
- return *this;
-}
-
-template <class T> inline void GRefPtr<T>::swap(GRefPtr<T>& o)
-{
- std::swap(m_ptr, o.m_ptr);
-}
-
-template <class T> inline void swap(GRefPtr<T>& a, GRefPtr<T>& b)
-{
- a.swap(b);
-}
-
-template <typename T, typename U> inline bool operator==(const GRefPtr<T>& a, const GRefPtr<U>& b)
-{
- return a.get() == b.get();
-}
-
-template <typename T, typename U> inline bool operator==(const GRefPtr<T>& a, U* b)
-{
- return a.get() == b;
-}
-
-template <typename T, typename U> inline bool operator==(T* a, const GRefPtr<U>& b)
-{
- return a == b.get();
-}
-
-template <typename T, typename U> inline bool operator!=(const GRefPtr<T>& a, const GRefPtr<U>& b)
-{
- return a.get() != b.get();
-}
-
-template <typename T, typename U> inline bool operator!=(const GRefPtr<T>& a, U* b)
-{
- return a.get() != b;
-}
-
-template <typename T, typename U> inline bool operator!=(T* a, const GRefPtr<U>& b)
-{
- return a != b.get();
-}
-
-template <typename T, typename U> inline GRefPtr<T> static_pointer_cast(const GRefPtr<U>& p)
-{
- return GRefPtr<T>(static_cast<T*>(p.get()));
-}
-
-template <typename T, typename U> inline GRefPtr<T> const_pointer_cast(const GRefPtr<U>& p)
-{
- return GRefPtr<T>(const_cast<T*>(p.get()));
-}
-
-template <typename T> inline T* getPtr(const GRefPtr<T>& p)
-{
- return p.get();
-}
-
-template <typename T> GRefPtr<T> adoptGRef(T* p)
-{
- return GRefPtr<T>(p, GRefPtrAdopt);
-}
-
-template <typename T> inline T* refGPtr(T* ptr)
-{
- if (ptr)
- g_object_ref_sink(ptr);
- return ptr;
-}
-
-template <typename T> inline void derefGPtr(T* ptr)
-{
- if (ptr)
- g_object_unref(ptr);
-}
-
-} // namespace WTF
-
-using WTF::GRefPtr;
-using WTF::refGPtr;
-using WTF::derefGPtr;
-using WTF::adoptGRef;
-using WTF::static_pointer_cast;
-using WTF::const_pointer_cast;
-
-#endif // WTF_GRefPtr_h