Title: [190660] trunk
Revision
190660
Author
mcatanz...@igalia.com
Date
2015-10-06 21:08:25 -0700 (Tue, 06 Oct 2015)

Log Message

[GTK] Add autocleanups
https://bugs.webkit.org/show_bug.cgi?id=149588

Reviewed by Darin Adler.

Source/WebCore:

* PlatformGTK.cmake:
* bindings/scripts/gobject-generate-headers.pl:

Source/WebKit2:

* PlatformGTK.cmake:
* UIProcess/API/gtk/WebKitAutocleanups.h: Added.
* UIProcess/API/gtk/webkit2.h:
* WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h: Added.
* WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h:

Tools:

* TestWebKitAPI/Tests/WebKit2Gtk/AutocleanupsTest.cpp: Added.
(AutocleanupsTest::create):
(AutocleanupsTest::testWebProcessAutocleanups):
(registerTests):
* TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt:
* TestWebKitAPI/Tests/WebKit2Gtk/TestAutocleanups.cpp: Added.
(testUIProcessAutocleanups):
(testWebProcessAutocleanups):
(beforeAll):
(afterAll):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (190659 => 190660)


--- trunk/Source/WebCore/ChangeLog	2015-10-07 03:35:26 UTC (rev 190659)
+++ trunk/Source/WebCore/ChangeLog	2015-10-07 04:08:25 UTC (rev 190660)
@@ -1,3 +1,13 @@
+2015-10-06  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [GTK] Add autocleanups
+        https://bugs.webkit.org/show_bug.cgi?id=149588
+
+        Reviewed by Darin Adler.
+
+        * PlatformGTK.cmake:
+        * bindings/scripts/gobject-generate-headers.pl:
+
 2015-10-06  Zalan Bujtas  <za...@apple.com>
 
         Paint artifacts when hovering on http://jsfiddle.net/Sherbrow/T87Mn/

Modified: trunk/Source/WebCore/PlatformGTK.cmake (190659 => 190660)


--- trunk/Source/WebCore/PlatformGTK.cmake	2015-10-07 03:35:26 UTC (rev 190659)
+++ trunk/Source/WebCore/PlatformGTK.cmake	2015-10-07 04:08:25 UTC (rev 190660)
@@ -559,6 +559,8 @@
     bindings/gobject/WebKitDOMObject.cpp
     bindings/gobject/WebKitDOMPrivate.cpp
     bindings/gobject/WebKitDOMXPathNSResolver.cpp
+    ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomautocleanups.h
+    ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomautocleanups-unstable.h
     ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines.h
     ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines-unstable.h
     ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
@@ -774,6 +776,7 @@
 
 set(GObjectDOMBindingsStable_CLASS_LIST ${GObjectDOMBindings_STATIC_CLASS_LIST})
 set(GObjectDOMBindingsStable_INSTALLED_HEADERS
+     ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomautocleanups.h
      ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines.h
      ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
      ${WEBCORE_DIR}/bindings/gobject/WebKitDOMCustom.h
@@ -785,6 +788,7 @@
 )
 
 set(GObjectDOMBindingsUnstable_INSTALLED_HEADERS
+     ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomautocleanups-unstable.h
      ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines-unstable.h
      ${WEBCORE_DIR}/bindings/gobject/WebKitDOMCustomUnstable.h
 )
@@ -826,6 +830,18 @@
     COMMAND echo ${GObjectDOMBindingsStable_CLASS_LIST} | ${PERL_EXECUTABLE} ${WEBCORE_DIR}/bindings/scripts/gobject-generate-headers.pl gdom > ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
 )
 
+add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomautocleanups.h
+    DEPENDS ${WEBCORE_DIR}/bindings/scripts/gobject-generate-headers.pl
+    COMMAND echo ${GObjectDOMBindingsStable_CLASS_LIST} | ${PERL_EXECUTABLE} ${WEBCORE_DIR}/bindings/scripts/gobject-generate-headers.pl autocleanups > ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomautocleanups.h
+)
+
+add_custom_command(
+    OUTPUT ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomautocleanups-unstable.h
+    DEPENDS ${WEBCORE_DIR}/bindings/scripts/gobject-generate-headers.pl
+    COMMAND echo ${GObjectDOMBindingsUnstable_CLASS_LIST} | ${PERL_EXECUTABLE} ${WEBCORE_DIR}/bindings/scripts/gobject-generate-headers.pl autocleanups > ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomautocleanups-unstable.h
+)
+
 # Some of the static headers are included by generated public headers with include <webkitdom/WebKitDOMFoo.h>.
 # We need those headers in the derived sources to be in webkitdom directory.
 set(GObjectDOMBindings_STATIC_HEADER_NAMES ${GObjectDOMBindings_STATIC_CLASS_LIST} CustomUnstable)

Modified: trunk/Source/WebCore/bindings/scripts/gobject-generate-headers.pl (190659 => 190660)


--- trunk/Source/WebCore/bindings/scripts/gobject-generate-headers.pl	2015-10-07 03:35:26 UTC (rev 190659)
+++ trunk/Source/WebCore/bindings/scripts/gobject-generate-headers.pl	2015-10-07 04:08:25 UTC (rev 190660)
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 #
 # Copyright (C) 2009 Adam Dingle <a...@yorba.org>
+# Copyright (C) 2015 Igalia S.L.
 #
 # This file is part of WebKit
 # 
@@ -55,6 +56,8 @@
     $header = "webkitdomdefines_unstable_h";
 } elsif ($outType eq "gdom") {
     $header = "webkitdom_h";
+} elsif ($outType eq "autocleanups") {
+    $header = "webkitdomautocleanups_h";
 } else {
     die "unknown output type";
 }
@@ -92,6 +95,7 @@
             print "\n";
         }
     }
+    print "#include <webkitdom/webkitdomautocleanups.h>\n";
 } elsif ($outType eq "defines-unstable") {
     print "#include <webkitdom/webkitdomdefines.h>\n\n";
     print "#ifdef WEBKIT_DOM_USE_UNSTABLE_API\n\n";
@@ -102,6 +106,7 @@
         print "\n";
     }
 
+    print "#include <webkitdom/webkitdomautocleanups-unstable.h>\n\n";
     print "#endif /* WEBKIT_DOM_USE_UNSTABLE_API */\n\n";
 } elsif ($outType eq "gdom") {
     print "#define __WEBKITDOM_H_INSIDE__\n\n";
@@ -109,6 +114,17 @@
         print "#include <webkitdom/WebKitDOM${class}.h>\n";
     }
     print "\n#undef __WEBKITDOM_H_INSIDE__\n";
+} elsif ($outType eq "autocleanups") {
+    print "#include <glib-object.h>\n\n";
+    print "#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC\n";
+    print "#ifndef __GI_SCANNER__\n\n";
+    foreach my $class (@classes) {
+        if ($class ne "Deprecated" && $class ne "Custom") {
+            print "G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDOM${class}, g_object_unref)\n";
+        }
+    }
+    print "\n#endif\n";
+    print "#endif\n";
 }
 
 print "\n";

Modified: trunk/Source/WebKit2/ChangeLog (190659 => 190660)


--- trunk/Source/WebKit2/ChangeLog	2015-10-07 03:35:26 UTC (rev 190659)
+++ trunk/Source/WebKit2/ChangeLog	2015-10-07 04:08:25 UTC (rev 190660)
@@ -1,3 +1,16 @@
+2015-10-06  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [GTK] Add autocleanups
+        https://bugs.webkit.org/show_bug.cgi?id=149588
+
+        Reviewed by Darin Adler.
+
+        * PlatformGTK.cmake:
+        * UIProcess/API/gtk/WebKitAutocleanups.h: Added.
+        * UIProcess/API/gtk/webkit2.h:
+        * WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h: Added.
+        * WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h:
+
 2015-10-06  Anders Carlsson  <ander...@apple.com>
 
         Try to fix the 32-bit build.

Modified: trunk/Source/WebKit2/PlatformGTK.cmake (190659 => 190660)


--- trunk/Source/WebKit2/PlatformGTK.cmake	2015-10-07 03:35:26 UTC (rev 190659)
+++ trunk/Source/WebKit2/PlatformGTK.cmake	2015-10-07 04:08:25 UTC (rev 190660)
@@ -108,6 +108,7 @@
     UIProcess/API/gtk/WebKitAuthenticationDialog.h
     UIProcess/API/gtk/WebKitAuthenticationRequest.cpp
     UIProcess/API/gtk/WebKitAuthenticationRequest.h
+    UIProcess/API/gtk/WebKitAutocleanups.h
     UIProcess/API/gtk/WebKitBackForwardList.cpp
     UIProcess/API/gtk/WebKitBackForwardList.h
     UIProcess/API/gtk/WebKitBackForwardListItem.cpp
@@ -375,6 +376,7 @@
     ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitEnumTypes.h
     ${DERIVED_SOURCES_WEBKIT2GTK_API_DIR}/WebKitVersion.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitAuthenticationRequest.h
+    ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitAutocleanups.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitBackForwardList.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitBackForwardListItem.h
     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitColorChooserRequest.h
@@ -431,6 +433,7 @@
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebEditor.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.h
+    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebHitTestResult.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.h
     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h

Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAutocleanups.h (0 => 190660)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAutocleanups.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAutocleanups.h	2015-10-07 04:08:25 UTC (rev 190660)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitAutocleanups_h
+#define WebKitAutocleanups_h
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+#ifndef __GI_SCANNER__
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitAuthenticationRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitBackForwardList, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitBackForwardListItem, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitColorChooserRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitContextMenu, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitContextMenuItem, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitCookieManager, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitDownload, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitEditorState, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitFaviconDatabase, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitFileChooserRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitFindController, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitFormSubmissionRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitGeolocationPermissionRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitHitTestResult, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitInstallMissingMediaPluginsPermissionRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitNavigationPolicyDecision, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitNotification, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitNotificationPermissionRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitPermissionRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitPlugin, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitPolicyDecision, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitPrintOperation, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitResponsePolicyDecision, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitSecurityManager, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitSettings, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURIRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURIResponse, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURISchemeRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserContentManager, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserMediaPermissionRequest, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebContext, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebInspector, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebResource, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebView, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebsiteDataManager, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWindowProperties, g_object_unref)
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitCredential, webkit_credential_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitJavascriptResult, webkit_javascript_result_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitMimeInfo, webkit_mime_info_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitNavigationAction, webkit_navigation_action_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserScript, webkit_user_script_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserStyleSheet, webkit_user_style_sheet_unref)
+
+#endif // __GI_SCANNER__
+#endif // G_DEFINE_AUTOPTR_CLEANUP_FUNC
+
+#endif // WebKitAutocleanups_h

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


--- trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h	2015-10-07 03:35:26 UTC (rev 190659)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h	2015-10-07 04:08:25 UTC (rev 190660)
@@ -77,6 +77,8 @@
 #include <webkit2/WebKitWebsiteDataManager.h>
 #include <webkit2/WebKitWindowProperties.h>
 
+#include <webkit2/WebKitAutocleanups.h>
+
 #undef __WEBKIT2_H_INSIDE__
 
 #endif /* __WEBKIT2_H__ */

Added: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h (0 => 190660)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h	                        (rev 0)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtensionAutocleanups.h	2015-10-07 04:08:25 UTC (rev 190660)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(__WEBKIT_WEB_EXTENSION_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit-web-extension.h> can be included directly."
+#endif
+
+#ifndef WebKitWebExtensionAutocleanups_h
+#define WebKitWebExtensionAutocleanups_h
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+#ifndef __GI_SCANNER__
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitFrame, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitScriptWorld, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebEditor, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebExtension, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebHitTestResult, g_object_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebPage, g_object_unref)
+
+#endif // __GI_SCANNER__
+#endif // G_DEFINE_AUTOPTR_CLEANUP_FUNC
+
+#endif // WebKitWebExtensionAutocleanups_h

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h (190659 => 190660)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h	2015-10-07 03:35:26 UTC (rev 190659)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/webkit-web-extension.h	2015-10-07 04:08:25 UTC (rev 190660)
@@ -39,6 +39,8 @@
 #include <webkit2/WebKitWebHitTestResult.h>
 #include <webkit2/WebKitWebPage.h>
 
+#include <webkit2/WebKitWebExtensionAutocleanups.h>
+
 #undef __WEBKIT_WEB_EXTENSION_H_INSIDE__
 
 #endif

Modified: trunk/Tools/ChangeLog (190659 => 190660)


--- trunk/Tools/ChangeLog	2015-10-07 03:35:26 UTC (rev 190659)
+++ trunk/Tools/ChangeLog	2015-10-07 04:08:25 UTC (rev 190660)
@@ -1,3 +1,21 @@
+2015-10-06  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [GTK] Add autocleanups
+        https://bugs.webkit.org/show_bug.cgi?id=149588
+
+        Reviewed by Darin Adler.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/AutocleanupsTest.cpp: Added.
+        (AutocleanupsTest::create):
+        (AutocleanupsTest::testWebProcessAutocleanups):
+        (registerTests):
+        * TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt:
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestAutocleanups.cpp: Added.
+        (testUIProcessAutocleanups):
+        (testWebProcessAutocleanups):
+        (beforeAll):
+        (afterAll):
+
 2015-10-06  Brian Burg  <bb...@apple.com>
 
         Unreviewed, try to fix the iOS 8 build after r190368.

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/AutocleanupsTest.cpp (0 => 190660)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/AutocleanupsTest.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/AutocleanupsTest.cpp	2015-10-07 04:08:25 UTC (rev 190660)
@@ -0,0 +1,72 @@
+/*
+ * 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 "WebProcessTest.h"
+#include <webkit2/webkit-web-extension.h>
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+
+class AutocleanupsTest : public WebProcessTest {
+public:
+    static std::unique_ptr<WebProcessTest> create() { return std::unique_ptr<WebProcessTest>(new AutocleanupsTest()); }
+
+private:
+    bool testWebProcessAutocleanups(WebKitWebPage* webPage)
+    {
+        // Transfer none
+        g_autoptr(WebKitWebPage) page = WEBKIT_WEB_PAGE(g_object_ref(G_OBJECT(webPage)));
+        g_assert(WEBKIT_IS_WEB_PAGE(page));
+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(page));
+
+        // Transfer none
+        g_autoptr(WebKitDOMDocument) document = WEBKIT_DOM_DOCUMENT(g_object_ref(G_OBJECT(webkit_web_page_get_dom_document(page))));
+        g_assert(WEBKIT_DOM_IS_DOCUMENT(document));
+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(document));
+
+        // Transfer full
+        g_autoptr(WebKitDOMDOMWindow) window = webkit_dom_document_get_default_view(document);
+        g_assert(WEBKIT_DOM_IS_DOM_WINDOW(window));
+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(window));
+
+        // Transfer full
+        g_autoptr(WebKitDOMRange) range = webkit_dom_document_create_range(document);
+        g_assert(WEBKIT_DOM_IS_RANGE(range));
+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(range));
+
+        return true;
+    }
+
+    bool runTest(const char* testName, WebKitWebPage* page) override
+    {
+        if (!strcmp(testName, "web-process-autocleanups"))
+            return testWebProcessAutocleanups(page);
+
+        g_assert_not_reached();
+        return false;
+    }
+};
+
+static void __attribute__((constructor)) registerTests()
+{
+    REGISTER_TEST(AutocleanupsTest, "Autocleanups/web-process-autocleanups");
+}
+
+#endif // G_DEFINE_AUTOPTR_CLEANUP_FUNC

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt (190659 => 190660)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt	2015-10-07 03:35:26 UTC (rev 190659)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt	2015-10-07 04:08:25 UTC (rev 190660)
@@ -90,10 +90,11 @@
 endmacro()
 
 ADD_WK2_TEST_WEB_EXTENSION(WebExtensionTest WebExtensionTest.cpp)
-ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest DOMNodeTest.cpp DOMNodeFilterTest.cpp DOMXPathNSResolverTest.cpp FrameTest.cpp WebProcessTest.cpp EditorTest.cpp)
+ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest AutocleanupsTest.cpp DOMNodeTest.cpp DOMNodeFilterTest.cpp DOMXPathNSResolverTest.cpp FrameTest.cpp WebProcessTest.cpp EditorTest.cpp)
 
 ADD_WK2_TEST(InspectorTestServer InspectorTestServer.cpp)
 ADD_WK2_TEST(TestAuthentication TestAuthentication.cpp)
+ADD_WK2_TEST(TestAutocleanups TestAutocleanups.cpp)
 ADD_WK2_TEST(TestBackForwardList TestBackForwardList.cpp)
 ADD_WK2_TEST(TestContextMenu TestContextMenu.cpp)
 ADD_WK2_TEST(TestCookieManager TestCookieManager.cpp)

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAutocleanups.cpp (0 => 190660)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAutocleanups.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAutocleanups.cpp	2015-10-07 04:08:25 UTC (rev 190660)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2015 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 "WebViewTest.h"
+#include <webkit2/webkit2.h>
+
+#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
+
+static void testUIProcessAutocleanups(WebViewTest* test, gconstpointer)
+{
+    // Sanity-check a couple UI process API autocleanups that are easy to test....
+    g_autoptr(WebKitWebContext) context = webkit_web_context_new();
+    g_assert(WEBKIT_IS_WEB_CONTEXT(context));
+    test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(context));
+
+    g_autoptr(WebKitWebsiteDataManager) manager = webkit_website_data_manager_new(nullptr);
+    g_assert(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager));
+    test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(context));
+
+    g_autoptr(WebKitUserScript) userScript = webkit_user_script_new("",
+        WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START,
+        nullptr, nullptr);
+    g_assert(userScript);
+    // Not a GObject, so just checking that this doesn't crash....
+}
+
+static void testWebProcessAutocleanups(WebViewTest* test, gconstpointer)
+{
+    static const char* testHTML = "<html><body></body></html>";
+    test->loadHtml(testHTML, nullptr);
+    test->waitUntilLoadFinished();
+
+    g_assert(test->runWebProcessTest("Autocleanups", "web-process-autocleanups"));
+}
+
+void beforeAll()
+{
+    WebViewTest::add("Autocleanups", "ui-process-autocleanups", testUIProcessAutocleanups);
+    WebViewTest::add("Autocleanups", "web-process-autocleanups", testWebProcessAutocleanups);
+}
+
+void afterAll()
+{
+}
+
+#endif // G_DEFINE_AUTOPTR_CLEANUP_FUNC
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to