[GTK] Do not use the C API in WebGtkExtensionManager
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Jun 2017 15:37:31 +0000 (15:37 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Jun 2017 15:37:31 +0000 (15:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173408

Reviewed by Michael Catanzaro.

.:

Update exported symbol signature.

* Source/cmake/gtksymbols.filter:

Source/WebKit2:

Use the C++ API instead.

* WebProcess/gtk/WebGtkExtensionManager.cpp:
(WebKit::parseUserData):
(WebKit::WebGtkExtensionManager::initialize):
* WebProcess/gtk/WebGtkExtensionManager.h:
* WebProcess/gtk/WebGtkInjectedBundleMain.cpp:
(WKBundleInitialize):

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

ChangeLog
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/gtk/WebGtkExtensionManager.cpp
Source/WebKit2/WebProcess/gtk/WebGtkExtensionManager.h
Source/WebKit2/WebProcess/gtk/WebGtkInjectedBundleMain.cpp
Source/cmake/gtksymbols.filter

index 3f1045c..f50b868 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Do not use the C API in WebGtkExtensionManager
+        https://bugs.webkit.org/show_bug.cgi?id=173408
+
+        Reviewed by Michael Catanzaro.
+
+        Update exported symbol signature.
+
+        * Source/cmake/gtksymbols.filter:
+
 2017-06-09  Zan Dobersek  <zdobersek@igalia.com>
 
         [WPE] Enable ENCRYPTED_MEDIA for build-webkit builds
index ddd64e2..9a7d2d9 100644 (file)
@@ -1,3 +1,19 @@
+2017-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Do not use the C API in WebGtkExtensionManager
+        https://bugs.webkit.org/show_bug.cgi?id=173408
+
+        Reviewed by Michael Catanzaro.
+
+        Use the C++ API instead.
+
+        * WebProcess/gtk/WebGtkExtensionManager.cpp:
+        (WebKit::parseUserData):
+        (WebKit::WebGtkExtensionManager::initialize):
+        * WebProcess/gtk/WebGtkExtensionManager.h:
+        * WebProcess/gtk/WebGtkInjectedBundleMain.cpp:
+        (WKBundleInitialize):
+
 2017-06-15  Adrian Perez de Castro  <aperez@igalia.com>
 
         [GTK] Stop using GtkAction in WebPopupMenuProxyGtk
index 36b9bf0..32dad4b 100644 (file)
 #include "config.h"
 #include "WebGtkExtensionManager.h"
 
+#include "APIString.h"
 #include "InjectedBundle.h"
-#include "WKBundleAPICast.h"
-#include "WKDictionary.h"
-#include "WKString.h"
-#include "WKType.h"
 #include "WebKitWebExtensionPrivate.h"
 #include <WebCore/FileSystem.h>
 #include <memory>
@@ -51,12 +48,11 @@ void WebGtkExtensionManager::scanModules(const String& webExtensionsDirectory, V
     }
 }
 
-static void parseUserData(WKTypeRef userData, String& webExtensionsDirectory, GRefPtr<GVariant>& initializationUserData)
+static void parseUserData(API::Object* userData, String& webExtensionsDirectory, GRefPtr<GVariant>& initializationUserData)
 {
-    ASSERT(userData);
-    ASSERT(WKGetTypeID(userData) == WKStringGetTypeID());
+    ASSERT(userData->type() == API::Object::Type::String);
 
-    CString userDataString = toImpl(static_cast<WKStringRef>(userData))->string().utf8();
+    CString userDataString = static_cast<API::String*>(userData)->string().utf8();
     GRefPtr<GVariant> variant = g_variant_parse(nullptr, userDataString.data(),
         userDataString.data() + userDataString.length(), nullptr, nullptr);
 
@@ -90,13 +86,15 @@ bool WebGtkExtensionManager::initializeWebExtension(Module* extensionModule, GVa
     return false;
 }
 
-void WebGtkExtensionManager::initialize(WKBundleRef bundle, WKTypeRef userDataString)
+void WebGtkExtensionManager::initialize(InjectedBundle* bundle, API::Object* userDataObject)
 {
-    m_extension = adoptGRef(webkitWebExtensionCreate(toImpl(bundle)));
+    ASSERT(bundle);
+    ASSERT(userDataObject);
+    m_extension = adoptGRef(webkitWebExtensionCreate(bundle));
 
     String webExtensionsDirectory;
     GRefPtr<GVariant> userData;
-    parseUserData(userDataString, webExtensionsDirectory, userData);
+    parseUserData(userDataObject, webExtensionsDirectory, userData);
 
     if (webExtensionsDirectory.isNull())
         return;
index 884ca39..db48afa 100644 (file)
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef WebGtkExtensionManager_h
-#define WebGtkExtensionManager_h
+#pragma once
 
 #include "Module.h"
-#include "WKBundle.h"
 #include <wtf/NeverDestroyed.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
 
 typedef struct _WebKitWebExtension WebKitWebExtension;
 
-namespace WTF {
-class String;
+namespace API {
+class Object;
 }
 
 namespace WebKit {
 
+class InjectedBundle;
+
 class WebGtkExtensionManager {
     WTF_MAKE_NONCOPYABLE(WebGtkExtensionManager);
 
 public:
-    WK_EXPORT static WebGtkExtensionManager& singleton();
+    static WebGtkExtensionManager& singleton();
 
-    WK_EXPORT void initialize(WKBundleRef, WKTypeRef);
+    void initialize(InjectedBundle*, API::Object*);
 
 private:
     WebGtkExtensionManager();
@@ -56,5 +56,3 @@ private:
 };
 
 } // namespace WebKit
-
-#endif // WebGtkExtensionManager_h
index 0037cd4..e0a3d4f 100644 (file)
@@ -19,7 +19,9 @@
 
 #include "config.h"
 
+#include "InjectedBundle.h"
 #include "WebGtkExtensionManager.h"
+#include <WebKit/WKBundleAPICast.h>
 #include <WebKit/WKBundleInitialize.h>
 
 using namespace WebKit;
@@ -31,5 +33,5 @@ extern "C"
 #endif
 void WKBundleInitialize(WKBundleRef bundle, WKTypeRef userData)
 {
-    WebGtkExtensionManager::singleton().initialize(bundle, userData);
+    WebGtkExtensionManager::singleton().initialize(toImpl(bundle), toImpl(userData));
 }
index 39ab09c..0140883 100644 (file)
@@ -5,7 +5,7 @@ global:
   NetworkProcessMainUnix;
   PluginProcessMainUnix;
   DatabaseProcessMainUnix;
-  _ZN6WebKit22WebGtkExtensionManager10initializeEPK14OpaqueWKBundlePKv;
+  _ZN6WebKit22WebGtkExtensionManager10initializeEPNS_14InjectedBundleEPN3API6ObjectE;
   _ZN6WebKit22WebGtkExtensionManager9singletonEv;
 local:
   webkit_media_player_debug;