Title: [217832] trunk
Revision
217832
Author
[email protected]
Date
2017-06-06 08:19:59 -0700 (Tue, 06 Jun 2017)

Log Message

[WPE] Enable remote inspector
https://bugs.webkit.org/show_bug.cgi?id=172971

Reviewed by Žan Doberšek.

.:

Add private option for remote inspector enabled by default.

* Source/cmake/OptionsWPE.cmake:

Source/_javascript_Core:

We can just build the current glib remote inspector, without adding a frontend implementation and using a
WebKitGTK+ browser as frontend for now.

* PlatformWPE.cmake: Add remote inspector files to compilation.
* inspector/remote/glib/RemoteInspectorUtils.cpp:
(Inspector::backendCommands): Load the inspector resources library.

Source/WebKit2:

Initialize the remote inpector if needed.

* UIProcess/wpe/WebProcessPoolWPE.cpp:
(WebKit::initializeRemoteInspectorServer):
(WebKit::WebProcessPool::platformInitialize):

Modified Paths

Diff

Modified: trunk/ChangeLog (217831 => 217832)


--- trunk/ChangeLog	2017-06-06 15:16:50 UTC (rev 217831)
+++ trunk/ChangeLog	2017-06-06 15:19:59 UTC (rev 217832)
@@ -1,3 +1,14 @@
+2017-06-06  Carlos Garcia Campos  <[email protected]>
+
+        [WPE] Enable remote inspector
+        https://bugs.webkit.org/show_bug.cgi?id=172971
+
+        Reviewed by Žan Doberšek.
+
+        Add private option for remote inspector enabled by default.
+
+        * Source/cmake/OptionsWPE.cmake:
+
 2017-06-02  Stephan Szabo  <[email protected]>
 
         [JSCOnly] Build static jsc.exe on Windows

Modified: trunk/Source/_javascript_Core/ChangeLog (217831 => 217832)


--- trunk/Source/_javascript_Core/ChangeLog	2017-06-06 15:16:50 UTC (rev 217831)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-06-06 15:19:59 UTC (rev 217832)
@@ -1,5 +1,19 @@
 2017-06-06  Carlos Garcia Campos  <[email protected]>
 
+        [WPE] Enable remote inspector
+        https://bugs.webkit.org/show_bug.cgi?id=172971
+
+        Reviewed by Žan Doberšek.
+
+        We can just build the current glib remote inspector, without adding a frontend implementation and using a
+        WebKitGTK+ browser as frontend for now.
+
+        * PlatformWPE.cmake: Add remote inspector files to compilation.
+        * inspector/remote/glib/RemoteInspectorUtils.cpp:
+        (Inspector::backendCommands): Load the inspector resources library.
+
+2017-06-06  Carlos Garcia Campos  <[email protected]>
+
         [GLIB] Make remote inspector DBus protocol common to all glib based ports
         https://bugs.webkit.org/show_bug.cgi?id=172970
 

Modified: trunk/Source/_javascript_Core/PlatformWPE.cmake (217831 => 217832)


--- trunk/Source/_javascript_Core/PlatformWPE.cmake	2017-06-06 15:16:50 UTC (rev 217831)
+++ trunk/Source/_javascript_Core/PlatformWPE.cmake	2017-06-06 15:19:59 UTC (rev 217832)
@@ -6,6 +6,20 @@
     ${WTF_DIR}
 )
 
+list(APPEND _javascript_Core_SOURCES
+    API/JSRemoteInspector.cpp
+
+    inspector/remote/RemoteAutomationTarget.cpp
+    inspector/remote/RemoteControllableTarget.cpp
+    inspector/remote/RemoteInspectionTarget.cpp
+    inspector/remote/RemoteInspector.cpp
+
+    inspector/remote/glib/RemoteConnectionToTargetGlib.cpp
+    inspector/remote/glib/RemoteInspectorGlib.cpp
+    inspector/remote/glib/RemoteInspectorServer.cpp
+    inspector/remote/glib/RemoteInspectorUtils.cpp
+)
+
 set(WPE_INSTALLED_JAVASCRIPTCORE_HEADERS
     API/JSBase.h
     API/JSContextRef.h

Modified: trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorUtils.cpp (217831 => 217832)


--- trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorUtils.cpp	2017-06-06 15:16:50 UTC (rev 217831)
+++ trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorUtils.cpp	2017-06-06 15:19:59 UTC (rev 217832)
@@ -29,10 +29,13 @@
 #if ENABLE(REMOTE_INSPECTOR)
 
 #include <gio/gio.h>
+#include <mutex>
 #include <wtf/SHA1.h>
 
 #if PLATFORM(GTK)
 #define INSPECTOR_BACKEND_COMMANDS_PATH "/org/webkitgtk/inspector/UserInterface/Protocol/InspectorBackendCommands.js"
+#elif PLATFORM(WPE)
+#define INSPECTOR_BACKEND_COMMANDS_PATH "/org/wpe/inspector/UserInterface/Protocol/InspectorBackendCommands.js"
 #endif
 
 namespace Inspector {
@@ -39,6 +42,18 @@
 
 GRefPtr<GBytes> backendCommands()
 {
+#if PLATFORM(WPE)
+    static std::once_flag flag;
+    std::call_once(flag, [] {
+        GModule* resourcesModule = g_module_open("libWPEWebInspectorResources.so", G_MODULE_BIND_LAZY);
+        if (!resourcesModule) {
+            WTFLogAlways("Error loading libWPEWebInspectorResources.so: %s", g_module_error());
+            return;
+        }
+
+        g_module_make_resident(resourcesModule);
+    });
+#endif
     GRefPtr<GBytes> bytes = adoptGRef(g_resources_lookup_data(INSPECTOR_BACKEND_COMMANDS_PATH, G_RESOURCE_LOOKUP_FLAGS_NONE, nullptr));
     ASSERT(bytes);
     return bytes;

Modified: trunk/Source/WebKit2/ChangeLog (217831 => 217832)


--- trunk/Source/WebKit2/ChangeLog	2017-06-06 15:16:50 UTC (rev 217831)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-06 15:19:59 UTC (rev 217832)
@@ -1,5 +1,18 @@
 2017-06-06  Carlos Garcia Campos  <[email protected]>
 
+        [WPE] Enable remote inspector
+        https://bugs.webkit.org/show_bug.cgi?id=172971
+
+        Reviewed by Žan Doberšek.
+
+        Initialize the remote inpector if needed.
+
+        * UIProcess/wpe/WebProcessPoolWPE.cpp:
+        (WebKit::initializeRemoteInspectorServer):
+        (WebKit::WebProcessPool::platformInitialize):
+
+2017-06-06  Carlos Garcia Campos  <[email protected]>
+
         [GLIB] Make remote inspector DBus protocol common to all glib based ports
         https://bugs.webkit.org/show_bug.cgi?id=172970
 

Modified: trunk/Source/WebKit2/UIProcess/wpe/WebProcessPoolWPE.cpp (217831 => 217832)


--- trunk/Source/WebKit2/UIProcess/wpe/WebProcessPoolWPE.cpp	2017-06-06 15:16:50 UTC (rev 217831)
+++ trunk/Source/WebKit2/UIProcess/wpe/WebProcessPoolWPE.cpp	2017-06-06 15:19:59 UTC (rev 217832)
@@ -35,6 +35,7 @@
 #include "WebInspectorServer.h"
 #include "WebProcessCreationParameters.h"
 #include "WebProcessMessages.h"
+#include <_javascript_Core/RemoteInspectorServer.h>
 #include <WebCore/FileSystem.h>
 #include <WebCore/NotImplemented.h>
 #include <WebCore/SchemeRegistry.h>
@@ -43,6 +44,41 @@
 
 namespace WebKit {
 
+#if ENABLE(REMOTE_INSPECTOR)
+static bool initializeRemoteInspectorServer(const char* address)
+{
+    if (Inspector::RemoteInspectorServer::singleton().isRunning())
+        return true;
+
+    if (!address[0])
+        return false;
+
+    GUniquePtr<char> inspectorAddress(g_strdup(address));
+    char* portPtr = g_strrstr(inspectorAddress.get(), ":");
+    if (!portPtr)
+        return false;
+
+    *portPtr = '\0';
+    portPtr++;
+    guint64 port = g_ascii_strtoull(portPtr, nullptr, 10);
+    if (!port)
+        return false;
+
+    return Inspector::RemoteInspectorServer::singleton().start(inspectorAddress.get(), port);
+}
+#endif
+
+void WebProcessPool::platformInitialize()
+{
+#if ENABLE(REMOTE_INSPECTOR)
+    if (const char* address = g_getenv("WEBKIT_INSPECTOR_SERVER")) {
+        if (!initializeRemoteInspectorServer(address))
+            g_unsetenv("WEBKIT_INSPECTOR_SERVER");
+    }
+#endif
+    m_websiteDataStore->websiteDataStore().registerSharedResourceLoadObserver();
+}
+
 WTF::String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()
 {
     GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "appcache", nullptr));
@@ -55,11 +91,6 @@
     return WebCore::stringFromFileSystemRepresentation(cacheDirectory.get());
 }
 
-void WebProcessPool::platformInitialize()
-{
-    m_websiteDataStore->websiteDataStore().registerSharedResourceLoadObserver();
-}
-
 void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
 {
     parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModelDocumentViewer;

Modified: trunk/Source/cmake/OptionsWPE.cmake (217831 => 217832)


--- trunk/Source/cmake/OptionsWPE.cmake	2017-06-06 15:16:50 UTC (rev 217831)
+++ trunk/Source/cmake/OptionsWPE.cmake	2017-06-06 15:19:59 UTC (rev 217832)
@@ -26,6 +26,7 @@
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SOURCE PUBLIC OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PUBLIC ON)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to