Title: [96225] trunk
Revision
96225
Author
carlo...@webkit.org
Date
2011-09-28 09:20:57 -0700 (Wed, 28 Sep 2011)

Log Message

[GTK] Add WebKitError to GTK+ WebKit2 API
https://bugs.webkit.org/show_bug.cgi?id=68508

Reviewed by Martin Robinson.

Source/WebKit2:

Add WebKitNetworkError enum to define network errors.

* GNUmakefile.am: Add new files to compilation.
* UIProcess/API/gtk/WebKitError.cpp: Added.
(webkit_network_error_quark):
* UIProcess/API/gtk/WebKitError.h:
* UIProcess/API/gtk/WebKitPrivate.h: Add
COMPILE_ASSERT_MATCHING_ENUM macro.
* UIProcess/API/gtk/webkit2.h: Add WebKitError.h and
WebKitEnumTypes.h

Tools:

* GNUmakefile.am: Add path to webkitgtk derived sources to the
include path.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (96224 => 96225)


--- trunk/Source/WebKit2/ChangeLog	2011-09-28 15:52:19 UTC (rev 96224)
+++ trunk/Source/WebKit2/ChangeLog	2011-09-28 16:20:57 UTC (rev 96225)
@@ -1,5 +1,23 @@
 2011-09-28  Carlos Garcia Campos  <cgar...@igalia.com>
 
+        [GTK] Add WebKitError to GTK+ WebKit2 API
+        https://bugs.webkit.org/show_bug.cgi?id=68508
+
+        Reviewed by Martin Robinson.
+
+        Add WebKitNetworkError enum to define network errors.
+
+        * GNUmakefile.am: Add new files to compilation.
+        * UIProcess/API/gtk/WebKitError.cpp: Added.
+        (webkit_network_error_quark):
+        * UIProcess/API/gtk/WebKitError.h:
+        * UIProcess/API/gtk/WebKitPrivate.h: Add
+        COMPILE_ASSERT_MATCHING_ENUM macro.
+        * UIProcess/API/gtk/webkit2.h: Add WebKitError.h and
+        WebKitEnumTypes.h
+
+2011-09-28  Carlos Garcia Campos  <cgar...@igalia.com>
+
         [GTK] Fix Programs/unittests/webkit2/testwebview
         https://bugs.webkit.org/show_bug.cgi?id=68993
 

Modified: trunk/Source/WebKit2/GNUmakefile.am (96224 => 96225)


--- trunk/Source/WebKit2/GNUmakefile.am	2011-09-28 15:52:19 UTC (rev 96224)
+++ trunk/Source/WebKit2/GNUmakefile.am	2011-09-28 16:20:57 UTC (rev 96225)
@@ -68,7 +68,8 @@
 	$(WebKit2)/UIProcess/API/cpp/WKRetainPtr.h
 
 libwebkit2gtkincludedir = $(libwebkitgtkincludedir)/webkit2
-libwebkit2gtkinclude_HEADERS = \
+webkit2gtk_headers = \
+	$(WebKit2)/UIProcess/API/gtk/WebKitError.h \
 	$(WebKit2)/UIProcess/API/gtk/WebKitWebContext.h \
 	$(WebKit2)/UIProcess/API/gtk/WebKitWebView.h \
 	$(WebKit2)/UIProcess/API/gtk/WebKitWebViewBase.h \
@@ -453,6 +454,8 @@
 	Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h \
 	Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h \
 	Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp \
+	Source/WebKit2/UIProcess/API/gtk/WebKitError.h \
+	Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp \
 	Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h \
 	Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.h \
 	Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp \
@@ -857,7 +860,8 @@
 	-I$(srcdir)/Source/WebKit2/WebProcess/WebPage/gtk \
 	-I$(top_builddir)/DerivedSources/WebKit2 \
 	-I$(top_builddir)/DerivedSources/WebKit2/include \
-	-I$(top_builddir)/DerivedSources/WebKit2/include/webkit2gtk \
+	-I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk \
+	-I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk/include \
 	-I$(top_builddir)/DerivedSources/WebKit2/include/_javascript_Core \
 	-I$(top_builddir)/DerivedSources/WebKit2/include/WebCore \
 	-I$(top_builddir)/DerivedSources/WebKit2/include/WebKit2 \
@@ -936,11 +940,11 @@
 
 BUILT_SOURCES += generate-webkit2-forwarding-headers
 
-$(GENSOURCES_WEBKIT2)/include/webkit2gtk/webkit2: $(libwebkit2gtkinclude_HEADERS)
-	$(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/include/webkit2gtk \
+$(GENSOURCES_WEBKIT2)/webkit2gtk/include/webkit2: $(webkit2gtk_headers)
+	$(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/include \
 	&& ln -s -f ${shell pwd}/$(WebKit2)/UIProcess/API/gtk $@
 
-BUILT_SOURCES += $(GENSOURCES_WEBKIT2)/include/webkit2gtk/webkit2
+BUILT_SOURCES += $(GENSOURCES_WEBKIT2)/webkit2gtk/include/webkit2
 
 vpath %.messages.in = \
 	$(WebKit2)/PluginProcess \
@@ -980,8 +984,62 @@
 DerivedSources/WebKit2/%Messages.h: %.messages.in $(message_gen_scripts)
 	$(AM_V_GEN)$(PYTHON) $(WebKit2)/Scripts/generate-messages-header.py $< > $@
 
+webkit2gtk_built_headers_dir := $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2
+$(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.h: stamp-webkit2enumtypes
+	@true
+
+stamp-webkit2enumtypes: $(webkit2gtk_headers) $(WebKit2)/GNUmakefile.am
+	$(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2 \
+	&& glib-mkenums \
+			--fhead "#ifndef WEBKIT_ENUM_TYPES_H\n" \
+			--fhead "#define WEBKIT_ENUM_TYPES_H\n\n" \
+			--fhead "#include <glib-object.h>\n\n" \
+			--fhead "#include <WebKit2/WKBase.h>\n\n" \
+			--fhead "G_BEGIN_DECLS\n\n" \
+			--ftail "G_END_DECLS\n\n" \
+			--ftail "#endif\n" \
+			--fprod "#include <webkit2/@basename@>\n\n" \
+			--eprod "#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n\n" \
+			--eprod "WK_EXPORT GType\n@enum_name@_get_type(void);\n\n" \
+		$(webkit2gtk_headers) | \
+		sed 's,web_kit,webkit,' | \
+		sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
+		> xgen-gth \
+	&& (cmp -s xgen-gth $(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h || cp xgen-gth $(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h) \
+	&& rm -f xgen-gth \
+	&& echo timestamp > $(@F)
+
+$(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.cpp: $(webkit2gtk_headers) $(WebKit2)/GNUmakefile.am
+	$(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2 \
+	&& glib-mkenums \
+			--fhead "#include <config.h>\n" \
+			--fhead "#include <glib-object.h>\n" \
+			--fhead "#include \"$(webkit2gtk_built_headers_dir)/WebKitEnumTypes.h\"\n\n" \
+			--fhead "extern \"C\" {\n\n" \
+			--fprod "\n/* Enumerations from \"@filename@\". */" \
+			--vhead "static const G@Type@Value _@enum_name@_values[] = {" \
+			--vprod "    { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+			--vtail "    { 0, NULL, NULL }\n};\n\n" \
+			--vtail "GType @enum_name@_get_type(void)\n{\n" \
+			--vtail "    static GType type = 0;\n\n" \
+			--vtail "    if (!type)\n" \
+			--vtail "        type = g_@type@_register_static(\"@EnumName@\", _@enum_name@_values);\n\n" \
+			--vtail "    return type;\n}\n\n" \
+			--ftail "}\n" \
+		$(webkit2gtk_headers) | \
+		sed 's,web_kit,webkit,' \
+		> xgen-gtc \
+	&& cp xgen-gtc $@ \
+	&& rm -f xgen-gtc
+
+
+BUILT_SOURCES += \
+	$(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.cpp \
+	$(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.h
+
 CLEANFILES += \
 	$(BUILT_SOURCES) \
+	$(top_builddir)/stamp-webkit2enumtypes \
 	$(top_builddir)/Programs/WebKitWebProcess
 
 DISTCLEANFILES += \
@@ -998,7 +1056,8 @@
 	-I$(srcdir)/Source \
 	-I$(srcdir)/Source/WebKit2 \
 	-I$(top_builddir)/DerivedSources/WebKit2/include \
-	-I$(top_builddir)/DerivedSources/WebKit2/include/webkit2gtk \
+	-I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk \
+	-I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk/include \
 	-I$(srcdir)/Source/WebKit2/UIProcess/API/gtk \
 	$(global_cflags) \
 	$(global_cppflags) \

Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp (0 => 96225)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp	2011-09-28 16:20:57 UTC (rev 96225)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ * Copyright (C) 2008 Luca Bruno <lethalma...@gmail.com>
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "WebKitError.h"
+
+#include "WebKitPrivate.h"
+#include <WebCore/ErrorsGtk.h>
+
+GQuark webkit_network_error_quark(void)
+{
+    return g_quark_from_static_string(WebCore::errorDomainNetwork);
+}
+
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_FAILED, NetworkErrorFailed);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_TRANSPORT, NetworkErrorTransport);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL, NetworkErrorUnknownProtocol);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_CANCELLED, NetworkErrorCancelled);
+COMPILE_ASSERT_MATCHING_ENUM(WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST, NetworkErrorFileDoesNotExist);

Copied: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitError.h (from rev 96224, trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h) (0 => 96225)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitError.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitError.h	2011-09-28 16:20:57 UTC (rev 96225)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2011 Igalia S.L.
+ * Copyright (C) 2008 Luca Bruno <lethalma...@gmail.com>
+ *
+ * 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 WebKitError_h
+#define WebKitError_h
+
+#include <WebKit2/WKBase.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_NETWORK_ERROR webkit_network_error_quark ()
+
+typedef enum {
+    WEBKIT_NETWORK_ERROR_FAILED = 399,
+    WEBKIT_NETWORK_ERROR_TRANSPORT = 300,
+    WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL = 301,
+    WEBKIT_NETWORK_ERROR_CANCELLED = 302,
+    WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST = 303
+} WebKitNetworkError;
+
+WK_EXPORT GQuark
+webkit_network_error_quark (void);
+
+G_END_DECLS
+
+#endif

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h (96224 => 96225)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h	2011-09-28 15:52:19 UTC (rev 96224)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h	2011-09-28 16:20:57 UTC (rev 96225)
@@ -27,6 +27,7 @@
 #define WebKitPrivate_h
 
 #include <glib.h>
+#include <wtf/Assertions.h>
 
 G_BEGIN_DECLS
 
@@ -34,6 +35,9 @@
 #define WEBKIT_PARAM_WRITABLE (static_cast<GParamFlags>(G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
 #define WEBKIT_PARAM_READWRITE (static_cast<GParamFlags>(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB))
 
+#define COMPILE_ASSERT_MATCHING_ENUM(webkitName, webcoreName) \
+        COMPILE_ASSERT(int(webkitName) == int(WebCore::webcoreName), mismatchingEnums)
+
 G_END_DECLS
 
 #endif // WebKitPrivate_h

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h (96224 => 96225)


--- trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h	2011-09-28 15:52:19 UTC (rev 96224)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h	2011-09-28 16:20:57 UTC (rev 96225)
@@ -20,6 +20,8 @@
 #ifndef __WEBKIT2_H__
 #define __WEBKIT2_H__
 
+#include <webkit2/WebKitEnumTypes.h>
+#include <webkit2/WebKitError.h>
 #include <webkit2/WebKitWebContext.h>
 #include <webkit2/WebKitWebViewBase.h>
 #include <webkit2/WebKitWebView.h>

Modified: trunk/Tools/ChangeLog (96224 => 96225)


--- trunk/Tools/ChangeLog	2011-09-28 15:52:19 UTC (rev 96224)
+++ trunk/Tools/ChangeLog	2011-09-28 16:20:57 UTC (rev 96225)
@@ -1,3 +1,13 @@
+2011-09-28  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK] Add WebKitError to GTK+ WebKit2 API
+        https://bugs.webkit.org/show_bug.cgi?id=68508
+
+        Reviewed by Martin Robinson.
+
+        * GNUmakefile.am: Add path to webkitgtk derived sources to the
+        include path.
+
 2011-09-28  Philippe Normand  <pnorm...@igalia.com>
 
         [GTK] missing WebKit2 support in run-gtk-tests

Modified: trunk/Tools/GNUmakefile.am (96224 => 96225)


--- trunk/Tools/GNUmakefile.am	2011-09-28 15:52:19 UTC (rev 96224)
+++ trunk/Tools/GNUmakefile.am	2011-09-28 16:20:57 UTC (rev 96225)
@@ -57,7 +57,8 @@
 	-I$(srcdir)/Source/WebKit2/UIProcess/API/gtk \
 	-I$(top_builddir)/Source/WebKit2/UIProcess/API/gtk \
 	-I$(srcdir)/Source/WebKit/gtk \
-	-I$(top_builddir)/DerivedSources/WebKit2/include/webkit2gtk \
+	-I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk \
+	-I$(top_builddir)/DerivedSources/WebKit2/webkit2gtk/include \
 	-I$(top_builddir)/Source/WebKit/gtk \
 	-I$(top_builddir)/DerivedSources \
 	$(global_cppflags) \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to