#include "config.h"
#include "GRefPtr.h"
+#if ENABLE(GLIB_SUPPORT)
+
#include <glib.h>
namespace WTF {
g_hash_table_unref(ptr);
}
+#if GLIB_CHECK_VERSION(2, 24, 0)
+template <> GVariant* refGPtr(GVariant* ptr)
+{
+ if (ptr)
+ g_variant_ref(ptr);
+ return ptr;
+}
+
+template <> void derefGPtr(GVariant* ptr)
+{
+ g_variant_unref(ptr);
+}
+
+#else
+
+// We do this so that we can avoid including the glib.h header in GRefPtr.h.
+typedef struct _GVariant {
+ bool fake;
+} GVariant;
+
+template <> GVariant* refGPtr(GVariant* ptr)
+{
+ return ptr;
+}
+
+template <> void derefGPtr(GVariant* ptr)
+{
+}
+
+#endif
+
+template <> GSource* refGPtr(GSource* ptr)
+{
+ if (ptr)
+ g_source_ref(ptr);
+ return ptr;
+}
+
+template <> void derefGPtr(GSource* ptr)
+{
+ if (ptr)
+ g_source_unref(ptr);
+}
+
} // namespace WTF
+
+#endif // ENABLE(GLIB_SUPPORT)