[GTK] [WebKit2] Use a template file for generated GObject enum files
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 May 2013 15:45:52 +0000 (15:45 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 May 2013 15:45:52 +0000 (15:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115867

Reviewed by Carlos Garcia Campos.

* GNUmakefile.am: Use a template file instead of specifying portions of the file on the command-line.
* UIProcess/API/gtk/WebKitEnumTypes.cpp.template: Added.
* UIProcess/API/gtk/WebKitEnumTypes.h.template: Added.
* UIProcess/API/gtk/WebKitFindController.cpp: We can no longer rely on WebKitEnumTypes.h to pull in WebKitWebView.h.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150018 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.am
Source/WebKit2/UIProcess/API/gtk/WebKitEnumTypes.cpp.template [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitEnumTypes.h.template [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp

index 4d16680..fb954d7 100644 (file)
@@ -1,3 +1,15 @@
+2013-05-13  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [WebKit2] Use a template file for generated GObject enum files
+        https://bugs.webkit.org/show_bug.cgi?id=115867
+
+        Reviewed by Carlos Garcia Campos.
+
+        * GNUmakefile.am: Use a template file instead of specifying portions of the file on the command-line.
+        * UIProcess/API/gtk/WebKitEnumTypes.cpp.template: Added.
+        * UIProcess/API/gtk/WebKitEnumTypes.h.template: Added.
+        * UIProcess/API/gtk/WebKitFindController.cpp: We can no longer rely on WebKitEnumTypes.h to pull in WebKitWebView.h.
+
 2013-05-13  Noam Rosenthal  <noam@webkit.org>
 
         [CoordGfx] requestAnimationFrame performance issues
index 89115ad..436c2bc 100644 (file)
@@ -385,21 +385,7 @@ $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.h: stamp-webkit2enumtyp
 
 stamp-webkit2enumtypes: $(libwebkit2gtkinclude_HEADERS) $(WebKit2)/GNUmakefile.am
        $(AM_V_GEN)mkdir -p $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2 \
-       && glib-mkenums \
-                       --fhead "#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)\n" \
-                       --fhead "#error \"Only <webkit2/webkit2.h> can be included directly.\"\n" \
-                       --fhead "#endif\n\n" \
-                       --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/WebKitDefines.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 "WEBKIT_API GType\n@enum_name@_get_type(void);\n\n" \
-               $(libwebkit2gtkinclude_HEADERS) | \
+       && glib-mkenums --template $(WebKit2)/UIProcess/API/gtk/WebKitEnumTypes.h.template $(libwebkit2gtkinclude_HEADERS) | \
                sed 's,web_kit,webkit,' | \
                sed 's,WEBKIT_TYPE_KIT,WEBKIT_TYPE,' \
                > wk2-xgen-gth \
@@ -409,22 +395,7 @@ stamp-webkit2enumtypes: $(libwebkit2gtkinclude_HEADERS) $(WebKit2)/GNUmakefile.a
 
 $(GENSOURCES_WEBKIT2)/webkit2gtk/webkit2/WebKitEnumTypes.cpp: $(libwebkit2gtkinclude_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" \
-               $(libwebkit2gtkinclude_HEADERS) | \
+       && glib-mkenums --template $(WebKit2)/UIProcess/API/gtk/WebKitEnumTypes.cpp.template $(libwebkit2gtkinclude_HEADERS) | \
                sed 's,web_kit,webkit,' \
                > wk2-xgen-gtc \
        && cp wk2-xgen-gtc $@ \
@@ -720,6 +691,8 @@ EXTRA_DIST += \
        $(WebKit2)/Scripts/webkit2/model.py \
        $(WebKit2)/Scripts/webkit2/parser.py \
        $(WebKit2)/UIProcess/API/gtk/webkit2marshal.list \
+       $(WebKit2)/UIProcess/API/gtk/WebKitEnumTypes.h.template \
+       $(WebKit2)/UIProcess/API/gtk/WebKitEnumTypes.cpp.template \
        $(WebKit2)/UIProcess/InspectorServer/front-end/inspectorPageIndex.html \
        $(WebKit2)/Scripts/generate-forwarding-headers.pl \
        $(shell ls $(WebKit2)/PluginProcess/*.in) \
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitEnumTypes.cpp.template b/Source/WebKit2/UIProcess/API/gtk/WebKitEnumTypes.cpp.template
new file mode 100644 (file)
index 0000000..292e1e5
--- /dev/null
@@ -0,0 +1,62 @@
+/*** BEGIN file-header ***/
+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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 "WebKitEnumTypes.h"
+
+#include <webkit2/webkit2.h>
+extern "C" {
+/*** END file-header ***/
+
+
+/*** BEGIN file-production ***/
+// Enumerations from @filename@.
+/*** END file-production ***/
+
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type()
+{
+    static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+
+/*** BEGIN value-production ***/
+        { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+
+/*** BEGIN value-tail ***/
+        { 0, NULL, NULL }
+    };
+
+    static GType type = 0;
+    if (G_UNLIKELY(!type))
+        type = g_@type@_register_static("@EnumName@", values);
+
+    return type;
+}
+
+/*** END value-tail ***/
+
+
+/*** BEGIN file-tail ***/
+}
+/*** END file-tail ***/
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitEnumTypes.h.template b/Source/WebKit2/UIProcess/API/gtk/WebKitEnumTypes.h.template
new file mode 100644 (file)
index 0000000..1283e0b
--- /dev/null
@@ -0,0 +1,54 @@
+/*** BEGIN file-header ***/
+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WEBKIT_ENUM_TYPES_H
+#define WEBKIT_ENUM_TYPES_H
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+
+/*** BEGIN file-production ***/
+/* Enumerations from @filename@. */
+/*** END file-production ***/
+
+
+/*** BEGIN enumeration-production ***/
+#define WEBKIT_TYPE_@ENUMSHORT@ @enum_name@_get_type ()
+
+WEBKIT_API GType
+@enum_name@_get_type (void);
+
+/*** END enumeration-production ***/
+
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif
+/*** END file-tail ***/
+
index 35138c6..516c582 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "WebKitEnumTypes.h"
 #include "WebKitPrivate.h"
+#include "WebKitWebView.h"
 #include "WebKitWebViewBasePrivate.h"
 #include <glib/gi18n-lib.h>
 #include <wtf/gobject/GRefPtr.h>