[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
kov at webkit.org
kov at webkit.org
Wed Dec 22 11:59:41 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e8adf3e9e20c91985dab21179a7ac965a9ff4456
Author: kov at webkit.org <kov at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Aug 12 17:33:35 2010 +0000
2010-08-12 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
Reviewed by Martin Robinson.
[GTK] Use GSettings to save/restore Web Inspector settings
https://bugs.webkit.org/show_bug.cgi?id=43512
* GNUmakefile.am: GSettings rules.
* configure.ac: GSettings infrastructure, and check if we should
use it by looking for an appropriate version of GIO.
JavaScriptCore
2010-08-12 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
Reviewed by Martin Robinson.
[GTK] Use GSettings to save/restore Web Inspector settings
https://bugs.webkit.org/show_bug.cgi?id=43512
* wtf/gobject/GRefPtr.cpp: Added support for GVariant, used by our
GSettings support.
(WTF::refGPtr):
(WTF::derefGPtr):
* wtf/gobject/GRefPtr.h:
WebKit/gtk
2010-08-12 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
Reviewed by Martin Robinson.
[GTK] Use GSettings to save/restore Web Inspector settings
https://bugs.webkit.org/show_bug.cgi?id=43512
Use GSettings to save/restore settings used by the Web Inspector.
A few helper functions were added to have settings that use
boolean values be actual booleans, and also to conform with the
GSettings naming requirements for keys.
* WebCoreSupport/InspectorClientGtk.cpp:
(WebKit::toGSettingName):
(WebKit::truthStringFromVariant):
(WebKit::variantFromTruthString):
(WebKit::InspectorClient::populateSetting):
(WebKit::InspectorClient::storeSetting):
* org.webkit.gtk.gschema.xml: Added.
* webkit/webkitprivate.cpp:
(inspectorGSettings):
(webkit_init):
* webkit/webkitprivate.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65255 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index 6ea40de..239013e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-12 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Use GSettings to save/restore Web Inspector settings
+ https://bugs.webkit.org/show_bug.cgi?id=43512
+
+ * GNUmakefile.am: GSettings rules.
+ * configure.ac: GSettings infrastructure, and check if we should
+ use it by looking for an appropriate version of GIO.
+
2010-08-12 Rafael Antognolli <antognolli at profusion.mobi>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/GNUmakefile.am b/GNUmakefile.am
index 87ff31d..91653cf 100644
--- a/GNUmakefile.am
+++ b/GNUmakefile.am
@@ -924,6 +924,13 @@ WebKit/gtk/webkit/webkitenumtypes.cpp: $(webkitgtk_h_api) GNUmakefile
&& cp xgen-gtc $@ \
&& rm -f xgen-gtc
+# GSettings
+if USE_GSETTINGS
+gsettings_SCHEMAS = $(top_builddir)/WebKit/gtk/org.webkitgtk- at WEBKITGTK_API_VERSION@.gschema.xml
+
+ at GSETTINGS_RULES@
+endif
+
# Files that will be distributed
EXTRA_DIST += \
$(srcdir)/gtk-doc.make \
@@ -940,7 +947,8 @@ EXTRA_DIST += \
$(srcdir)/WebKit/gtk/po/* \
$(srcdir)/WebKit/gtk/resources/* \
$(srcdir)/WebKit/gtk/tests/resources/* \
- $(srcdir)/WebKit/gtk/tests/test_utils.h
+ $(srcdir)/WebKit/gtk/tests/test_utils.h \
+ $(srcdir)/WebKit/gtk/org.webkitgtk.gschema.xml.in
# extra resource files
resourcesdir = ${datadir}/webkit- at WEBKITGTK_API_VERSION@/resources
@@ -1145,7 +1153,8 @@ DISTCLEANFILES += \
$(top_builddir)/WebKit/gtk/docs/version.xml \
$(top_builddir)/WebKit/gtk/docs/GNUmakefile \
$(top_builddir)/WebKit/gtk/@WEBKITGTK_PC_NAME at -@WEBKITGTK_API_VERSION at .pc \
- $(top_builddir)/WebKit/gtk/webkit/webkitversion.h
+ $(top_builddir)/WebKit/gtk/webkit/webkitversion.h \
+ $(top_builddir)/WebKit/gtk/org.webkitgtk- at WEBKITGTK_API_VERSION@.gschema.xml
MAINTAINERCLEANFILES += \
$(CLEANFILES) \
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index a2fafec..135bfc7 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-08-12 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Use GSettings to save/restore Web Inspector settings
+ https://bugs.webkit.org/show_bug.cgi?id=43512
+
+ * wtf/gobject/GRefPtr.cpp: Added support for GVariant, used by our
+ GSettings support.
+ (WTF::refGPtr):
+ (WTF::derefGPtr):
+ * wtf/gobject/GRefPtr.h:
+
2010-08-12 Gabor Loki <loki at webkit.org>
Reviewed by Simon Hausmann.
diff --git a/JavaScriptCore/wtf/gobject/GRefPtr.cpp b/JavaScriptCore/wtf/gobject/GRefPtr.cpp
index e7cf34b..9d16cb5 100644
--- a/JavaScriptCore/wtf/gobject/GRefPtr.cpp
+++ b/JavaScriptCore/wtf/gobject/GRefPtr.cpp
@@ -35,4 +35,18 @@ template <> void derefGPtr(GHashTable* ptr)
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);
+}
+#endif
+
} // namespace WTF
diff --git a/JavaScriptCore/wtf/gobject/GRefPtr.h b/JavaScriptCore/wtf/gobject/GRefPtr.h
index c4d4107..9a07d93 100644
--- a/JavaScriptCore/wtf/gobject/GRefPtr.h
+++ b/JavaScriptCore/wtf/gobject/GRefPtr.h
@@ -25,11 +25,7 @@
#include "AlwaysInline.h"
#include <algorithm>
-
-typedef struct _GHashTable GHashTable;
-typedef void* gpointer;
-extern "C" void g_object_unref(gpointer object);
-extern "C" gpointer g_object_ref_sink(gpointer object);
+#include <glib.h>
namespace WTF {
@@ -41,6 +37,11 @@ template <typename T> GRefPtr<T> adoptGRef(T*);
template <> GHashTable* refGPtr(GHashTable* ptr);
template <> void derefGPtr(GHashTable* ptr);
+#if GLIB_CHECK_VERSION(2, 24, 0)
+template <> GVariant* refGPtr(GVariant* ptr);
+template <> void derefGPtr(GVariant* ptr);
+#endif
+
template <typename T> class GRefPtr {
public:
GRefPtr() : m_ptr(0) { }
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 477a1b8..f3e4244 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,27 @@
+2010-08-12 Gustavo Noronha Silva <gustavo.noronha at collabora.co.uk>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Use GSettings to save/restore Web Inspector settings
+ https://bugs.webkit.org/show_bug.cgi?id=43512
+
+ Use GSettings to save/restore settings used by the Web Inspector.
+ A few helper functions were added to have settings that use
+ boolean values be actual booleans, and also to conform with the
+ GSettings naming requirements for keys.
+
+ * WebCoreSupport/InspectorClientGtk.cpp:
+ (WebKit::toGSettingName):
+ (WebKit::truthStringFromVariant):
+ (WebKit::variantFromTruthString):
+ (WebKit::InspectorClient::populateSetting):
+ (WebKit::InspectorClient::storeSetting):
+ * org.webkit.gtk.gschema.xml: Added.
+ * webkit/webkitprivate.cpp:
+ (inspectorGSettings):
+ (webkit_init):
+ * webkit/webkitprivate.h:
+
2010-08-11 Joone Hur <joone at kldp.org>
Reviewed by Martin Robinson.
diff --git a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
index 1256000..331535c 100644
--- a/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008 Gustavo Noronha Silva
+ * Copyright (C) 2010 Collabora Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -118,15 +119,116 @@ void InspectorClient::hideHighlight()
gtk_widget_queue_draw(GTK_WIDGET(m_inspectedWebView));
}
+#if HAVE_GSETTINGS
+static String toGSettingName(String inspectorSettingName)
+{
+ if (inspectorSettingName == "resourceTrackingEnabled")
+ return String("resource-tracking-enabled");
+
+ if (inspectorSettingName == "xhrMonitor")
+ return String("xhr-monitor-enabled");
+
+ if (inspectorSettingName == "frontendSettings")
+ return String("frontend-settings");
+
+ if (inspectorSettingName == "debuggerEnabled")
+ return String("debugger-enabled");
+
+ if (inspectorSettingName == "profilerEnabled")
+ return String("profiler-enabled");
+
+ return inspectorSettingName;
+}
+
+static String truthStringFromVariant(GVariant* variant)
+{
+ if (g_variant_get_boolean(variant))
+ return String("true");
+
+ return String("false");
+}
+
+static GVariant* variantFromTruthString(const String& truth)
+{
+ if (truth == "true")
+ return g_variant_new_boolean(TRUE);
+
+ return g_variant_new_boolean(FALSE);
+}
+
+static bool shouldIgnoreSetting(const String& key)
+{
+ // Ignore this setting for now, it doesn't seem to be used for
+ // anything right now.
+ if (key == "lastActivePanel")
+ return true;
+
+ // GSettings considers trying to fetch or set a setting that is
+ // not backed by a schema as programmer error, and aborts the
+ // program's execution. We check here to avoid having an unhandled
+ // setting as a fatal error.
+ if (key == "resourceTrackingEnabled" || key == "xhrMonitor"
+ || key == "frontendSettings" || key == "debuggerEnabled"
+ || key == "profilerEnabled")
+ return false;
+
+ LOG_VERBOSE(NotYetImplemented, "Unknown key ignored: %s", key.ascii().data());
+ return true;
+}
+
void InspectorClient::populateSetting(const String& key, String* value)
{
- notImplemented();
+ if (shouldIgnoreSetting(key))
+ return;
+
+ GSettings* settings = inspectorGSettings();
+ if (!settings)
+ return;
+
+ GRefPtr<GVariant> variant = adoptGRef(g_settings_get_value(settings, toGSettingName(key).utf8().data()));
+
+ if (key == "resourceTrackingEnabled" || key == "xhrMonitor"
+ || key == "debuggerEnabled" || key == "profilerEnabled")
+ *value = truthStringFromVariant(variant.get());
+ else if (key == "frontendSettings")
+ *value = String(g_variant_get_string(variant.get(), 0));
}
void InspectorClient::storeSetting(const String& key, const String& value)
{
+ if (shouldIgnoreSetting(key))
+ return;
+
+ GSettings* settings = inspectorGSettings();
+ if (!settings)
+ return;
+
+ GRefPtr<GVariant> variant(0);
+
+ // Set the key with the appropriate type, and also avoid setting
+ // unknown keys to avoid aborting the execution.
+ if (key == "resourceTrackingEnabled" || key == "xhrMonitor"
+ || key == "debuggerEnabled" || key == "profilerEnabled")
+ variant = adoptGRef(variantFromTruthString(value));
+ else if (key == "frontendSettings")
+ variant = adoptGRef(g_variant_new_string(value.utf8().data()));
+
+ if (!variant)
+ return;
+
+ g_settings_set_value(settings, toGSettingName(key).utf8().data(), variant.get());
+}
+#else
+void InspectorClient::populateSetting(const String&, String*)
+{
+ notImplemented();
+}
+
+void InspectorClient::storeSetting(const String&, const String&)
+{
notImplemented();
}
+#endif // HAVE_GSETTINGS
bool InspectorClient::sendMessageToFrontend(const String& message)
{
diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp
index 41de76e..001b3cc 100644
--- a/WebKit/gtk/webkit/webkitprivate.cpp
+++ b/WebKit/gtk/webkit/webkitprivate.cpp
@@ -44,6 +44,7 @@
#include "WebKitDOMBinding.h"
#include "webkitnetworkresponse.h"
#include "webkitsoupauthdialog.h"
+#include "webkitversion.h"
#include <libintl.h>
#include <runtime/InitializeThreading.h>
#include <stdlib.h>
@@ -214,6 +215,45 @@ static void closeIconDatabaseOnExit()
iconDatabase()->close();
}
+#if HAVE_GSETTINGS
+static bool isSchemaAvailable(char* schemaID)
+{
+ const char* const* availableSchemas = g_settings_list_schemas();
+ char* const* iter = const_cast<char* const*>(availableSchemas);
+
+ while (*iter) {
+ if (g_str_equal(schemaID, *iter))
+ return true;
+ iter++;
+ }
+
+ return false;
+}
+
+GSettings* inspectorGSettings()
+{
+ static GSettings* settings = 0;
+
+ if (settings)
+ return settings;
+
+ GOwnPtr<gchar> schemaID(g_strdup_printf("org.webkitgtk-%.1f.inspector", WEBKITGTK_API_VERSION));
+
+ // Unfortunately GSettings will abort the process execution if the
+ // schema is not installed, which is the case for when running
+ // tests, or even the introspection dump at build time, so check
+ // if we have the schema before trying to initialize it.
+ if (!isSchemaAvailable(schemaID.get())) {
+ g_warning("GSettings schema not found - settings will not be used or saved.");
+ return 0;
+ }
+
+ settings = g_settings_new(schemaID.get());
+
+ return settings;
+}
+#endif
+
void webkit_init()
{
static bool isInitialized = false;
@@ -238,6 +278,12 @@ void webkit_init()
// FIXME: Expose this with an API and/or calculate based on available resources
webkit_set_cache_model(WEBKIT_CACHE_MODEL_WEB_BROWSER);
+#if HAVE_GSETTINGS
+ // Initialize settings variables here to make sure this happens in
+ // the main thread.
+ inspectorGSettings();
+#endif
+
#if ENABLE(DATABASE)
gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL);
webkit_set_web_database_directory_path(databaseDirectory);
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index a6e0072..4f5a119 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -120,6 +120,10 @@ namespace WebKit {
extern "C" {
void webkit_init();
+#if HAVE_GSETTINGS
+ GSettings* inspectorGSettings();
+#endif
+
#define WEBKIT_PARAM_READABLE ((GParamFlags)(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
#define WEBKIT_PARAM_READWRITE ((GParamFlags)(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
diff --git a/configure.ac b/configure.ac
index 365de72..897fd02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -260,6 +260,15 @@ ENCHANT_REQUIRED_VERSION=0.22
# todo: webcore gtk
WEBKIT_CHECK_DEPENDENCIES([glib unicode])
+# Check if we can use GSettings
+PKG_CHECK_MODULES([GSETTINGS],
+ [gio-2.0 >= 2.25.0],
+ [have_gsettings=yes],
+ [have_gsettings=no])
+if test "$have_gsettings" = "yes"; then
+ AC_DEFINE([HAVE_GSETTINGS], 1, [Whether we can use GSettings])
+fi
+
GETTEXT_PACKAGE=$PACKAGE-$GTK_API_VERSION
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
@@ -825,6 +834,9 @@ if test "$enable_geolocation" = "yes"; then
AC_SUBST([GEOCLUE_LIBS])
fi
+# GSettings
+GLIB_GSETTINGS
+
# check if gstreamer is available
if test "$enable_video" = "yes"; then
PKG_CHECK_MODULES([GSTREAMER],
@@ -874,6 +886,9 @@ AM_CONDITIONAL([USE_GLIB_UNICODE], [test "$with_unicode_backend" = "glib"])
AM_CONDITIONAL([USE_FREETYPE], [test "$with_font_backend" = "freetype"])
AM_CONDITIONAL([USE_PANGO], [test "$with_font_backend" = "pango"])
+# GLib/GIO feature conditionals
+AM_CONDITIONAL([USE_GSETTINGS], [test "$have_gsettings" = "yes"])
+
# WebKit feature conditionals
AM_CONDITIONAL([ENABLE_DEBUG],[test "$enable_debug" = "yes"])
AM_CONDITIONAL([ENABLE_3D_TRANSFORMS],[test "$enable_3D_transforms" = "yes"])
@@ -934,7 +949,9 @@ WebKit/gtk/docs/version.xml
AC_CONFIG_FILES([
WebKit/gtk/${WEBKITGTK_PC_NAME}-${WEBKITGTK_API_VERSION}.pc:WebKit/gtk/webkit.pc.in
-WebKit/gtk/JSCore-${WEBKITGTK_API_VERSION}.gir:WebKit/gtk/JSCore.gir.in]
+WebKit/gtk/JSCore-${WEBKITGTK_API_VERSION}.gir:WebKit/gtk/JSCore.gir.in
+WebKit/gtk/org.webkitgtk-${WEBKITGTK_API_VERSION}.gschema.xml:WebKit/gtk/org.webkitgtk.gschema.xml.in
+]
,[WEBKITGTK_API_VERSION=$WEBKITGTK_API_VERSION,WEBKITGTK_PC_NAME=$WEBKITGTK_PC_NAME]
)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list