Title: [250517] trunk
Revision
250517
Author
carlo...@webkit.org
Date
2019-09-30 05:06:23 -0700 (Mon, 30 Sep 2019)

Log Message

[GTK][WPE] Add about:gpu
https://bugs.webkit.org/show_bug.cgi?id=202305

Reviewed by Žan Doberšek.

.:

Add SVN_REVISION definition to the build.

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:

Source/WebKit:

A builtin protocol handler to show information about hardware acceleration. This is useful information we need
from people reporting issues in accelerated compositing mode.

* SourcesGTK.txt:
* SourcesWPE.txt:
* UIProcess/API/glib/WebKitProtocolHandler.cpp: Added.
(WebKit::WebKitProtocolHandler::WebKitProtocolHandler):
(WebKit::WebKitProtocolHandler::handleRequest):
(WebKit::webkitPortName):
(WebKit::hardwareAccelerationPolicy):
(WebKit::webGLEnabled):
(WebKit::openGLAPI):
(WebKit::nativeInterface):
(WebKit::WebKitProtocolHandler::handleGPU):
* UIProcess/API/glib/WebKitProtocolHandler.h: Added.
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextConstructed):

Tools:

Allow to use about:gpu in MiniBrowser. Add a script to get the current svn revision.

* MiniBrowser/gtk/BrowserTab.c:
(getInternalURI):
* MiniBrowser/gtk/main.c:
(argumentToURL):
* MiniBrowser/wpe/main.cpp:
(main):
* glib/svn-revision: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (250516 => 250517)


--- trunk/ChangeLog	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/ChangeLog	2019-09-30 12:06:23 UTC (rev 250517)
@@ -1,3 +1,15 @@
+2019-09-30  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK][WPE] Add about:gpu
+        https://bugs.webkit.org/show_bug.cgi?id=202305
+
+        Reviewed by Žan Doberšek.
+
+        Add SVN_REVISION definition to the build.
+
+        * Source/cmake/OptionsGTK.cmake:
+        * Source/cmake/OptionsWPE.cmake:
+
 2019-09-23  Zan Dobersek  <zdober...@igalia.com>
 
         run-web-platform-tests: remove support for in-repository manifest, expectation management

Modified: trunk/Source/WebKit/ChangeLog (250516 => 250517)


--- trunk/Source/WebKit/ChangeLog	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Source/WebKit/ChangeLog	2019-09-30 12:06:23 UTC (rev 250517)
@@ -1,3 +1,28 @@
+2019-09-30  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK][WPE] Add about:gpu
+        https://bugs.webkit.org/show_bug.cgi?id=202305
+
+        Reviewed by Žan Doberšek.
+
+        A builtin protocol handler to show information about hardware acceleration. This is useful information we need
+        from people reporting issues in accelerated compositing mode.
+
+        * SourcesGTK.txt:
+        * SourcesWPE.txt:
+        * UIProcess/API/glib/WebKitProtocolHandler.cpp: Added.
+        (WebKit::WebKitProtocolHandler::WebKitProtocolHandler):
+        (WebKit::WebKitProtocolHandler::handleRequest):
+        (WebKit::webkitPortName):
+        (WebKit::hardwareAccelerationPolicy):
+        (WebKit::webGLEnabled):
+        (WebKit::openGLAPI):
+        (WebKit::nativeInterface):
+        (WebKit::WebKitProtocolHandler::handleGPU):
+        * UIProcess/API/glib/WebKitProtocolHandler.h: Added.
+        * UIProcess/API/glib/WebKitWebContext.cpp:
+        (webkitWebContextConstructed):
+
 2019-09-30  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r250291.

Modified: trunk/Source/WebKit/SourcesGTK.txt (250516 => 250517)


--- trunk/Source/WebKit/SourcesGTK.txt	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Source/WebKit/SourcesGTK.txt	2019-09-30 12:06:23 UTC (rev 250517)
@@ -163,6 +163,7 @@
 UIProcess/API/glib/WebKitPlugin.cpp @no-unify
 UIProcess/API/glib/WebKitPolicyDecision.cpp @no-unify
 UIProcess/API/glib/WebKitPrivate.cpp @no-unify
+UIProcess/API/glib/WebKitProtocolHandler.cpp @no-unify
 UIProcess/API/glib/WebKitResponsePolicyDecision.cpp @no-unify
 UIProcess/API/glib/WebKitScriptDialog.cpp @no-unify
 UIProcess/API/glib/WebKitSecurityManager.cpp @no-unify

Modified: trunk/Source/WebKit/SourcesWPE.txt (250516 => 250517)


--- trunk/Source/WebKit/SourcesWPE.txt	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Source/WebKit/SourcesWPE.txt	2019-09-30 12:06:23 UTC (rev 250517)
@@ -151,6 +151,7 @@
 UIProcess/API/glib/WebKitPlugin.cpp @no-unify
 UIProcess/API/glib/WebKitPolicyDecision.cpp @no-unify
 UIProcess/API/glib/WebKitPrivate.cpp @no-unify
+UIProcess/API/glib/WebKitProtocolHandler.cpp @no-unify
 UIProcess/API/glib/WebKitResponsePolicyDecision.cpp @no-unify
 UIProcess/API/glib/WebKitScriptDialog.cpp @no-unify
 UIProcess/API/glib/WebKitSecurityManager.cpp @no-unify

Added: trunk/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp (0 => 250517)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.cpp	2019-09-30 12:06:23 UTC (rev 250517)
@@ -0,0 +1,468 @@
+/*
+ * Copyright (C) 2019 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 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 "WebKitProtocolHandler.h"
+
+#include "WebKitError.h"
+#include "WebKitVersion.h"
+#include "WebKitWebView.h"
+#include <WebCore/FloatRect.h>
+#include <WebCore/GLContext.h>
+#include <WebCore/IntRect.h>
+#include <WebCore/PlatformDisplay.h>
+#include <WebCore/PlatformScreen.h>
+#include <cairo.h>
+#include <gio/gio.h>
+#include <wtf/URL.h>
+#include <wtf/glib/GRefPtr.h>
+#include <wtf/glib/GUniquePtr.h>
+
+#if OS(UNIX)
+#include <sys/utsname.h>
+#endif
+
+#if PLATFORM(GTK)
+#include <gtk/gtk.h>
+
+#if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
+#include <wpe/fdo.h>
+#endif
+#endif
+
+#if PLATFORM(X11)
+#include <WebCore/PlatformDisplayX11.h>
+#endif
+
+#if USE(LIBEPOXY)
+#include <epoxy/gl.h>
+#endif
+
+#if USE(EGL)
+#if USE(LIBEPOXY)
+#include <epoxy/egl.h>
+#else
+#include <EGL/egl.h>
+#endif
+#endif
+
+#if USE(GLX)
+#include <GL/glx.h>
+#endif
+
+namespace WebKit {
+using namespace WebCore;
+
+WebKitProtocolHandler::WebKitProtocolHandler(WebKitWebContext* context)
+    : m_context(context)
+{
+    webkit_web_context_register_uri_scheme(context, "webkit", [](WebKitURISchemeRequest* request, gpointer userData) {
+        static_cast<WebKitProtocolHandler*>(userData)->handleRequest(request);
+    }, this, nullptr);
+
+    auto* manager = webkit_web_context_get_security_manager(context);
+    webkit_security_manager_register_uri_scheme_as_display_isolated(manager, "webkit");
+}
+
+void WebKitProtocolHandler::handleRequest(WebKitURISchemeRequest* request)
+{
+    URL requestURL = URL({ }, webkit_uri_scheme_request_get_uri(request));
+    if (requestURL.host() == "gpu") {
+        handleGPU(request);
+        return;
+    }
+
+    GUniquePtr<GError> error(g_error_new_literal(WEBKIT_POLICY_ERROR, WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI, "Not found"));
+        webkit_uri_scheme_request_finish_error(request, error.get());
+}
+
+static inline const char* webkitPortName()
+{
+#if PLATFORM(GTK)
+    return "WebKitGTK";
+#elif PLATFORM(WPE)
+    return "WPE WebKit";
+#endif
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+static const char* hardwareAccelerationPolicy(WebKitURISchemeRequest* request)
+{
+#if PLATFORM(WPE)
+    return "always";
+#elif PLATFORM(GTK)
+    auto* webView = webkit_uri_scheme_request_get_web_view(request);
+    ASSERT(webView);
+
+    switch (webkit_settings_get_hardware_acceleration_policy(webkit_web_view_get_settings(webView))) {
+    case WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER:
+        return "never";
+    case WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS:
+        return "always";
+    case WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND:
+        return "on demand";
+    }
+#endif
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+static bool webGLEnabled(WebKitURISchemeRequest* request)
+{
+    auto* webView = webkit_uri_scheme_request_get_web_view(request);
+    ASSERT(webView);
+    return webkit_settings_get_enable_webgl(webkit_web_view_get_settings(webView));
+}
+
+static const char* openGLAPI()
+{
+#if USE(LIBEPOXY)
+    if (epoxy_is_desktop_gl())
+        return "OpenGL (libepoxy)";
+    return "OpenGL ES 2 (libepoxy)";
+#else
+#if USE(GLX)
+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11)
+        return "OpenGL";
+#endif
+#if USE(EGL)
+#if USE(OPENGL_ES)
+    return "OpenGL ES 2";
+#else
+    return "OpenGL";
+#endif
+#endif
+#endif
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+static const char* nativeInterface()
+{
+#if PLATFORM(GTK)
+#if USE(GLX)
+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11)
+        return "GLX";
+#endif
+#endif
+
+#if USE(EGL)
+    return "EGL";
+#endif
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+void WebKitProtocolHandler::handleGPU(WebKitURISchemeRequest* request)
+{
+    GString* html = g_string_new(
+        "<html><head><title>GPU information</title>"
+        "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
+        "<style>"
+        "  h1 { color: #babdb6; text-shadow: 0 1px 0 white; margin-bottom: 0; }"
+        "  html { font-family: -webkit-system-font; font-size: 11pt; color: #2e3436; padding: 20px 20px 0 20px; background-color: #f6f6f4; "
+        "         background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #eeeeec), color-stop(1, #f6f6f4));"
+        "         background-size: 100% 5em; background-repeat: no-repeat; }"
+        "  table { width: 100%; border-collapse: collapse; }"
+        "  table, td { border: 1px solid #d3d7cf; border-left: none; border-right: none; }"
+        "  p { margin-bottom: 30px; }"
+        "  td { padding: 15px; }"
+        "  td.data { width: 200px; }"
+        "  .titlename { font-weight: bold; }"
+        "</style></head><body>");
+
+    g_string_append(html,
+        "<h1>Version Information</h1>"
+        "<table>");
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">WebKit version</div></td>"
+        "  <td>%s %d.%d.%d (%s)</td>"
+        " </tbody></tr>",
+        webkitPortName(), WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION, WEBKIT_MICRO_VERSION, SVN_REVISION);
+
+#if OS(UNIX)
+    struct utsname osName;
+    uname(&osName);
+    g_string_append_printf(
+        html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Operating system</div></td>"
+        "  <td>%s %s %s %s</td>"
+        " </tbody></tr>",
+        osName.sysname, osName.release, osName.version, osName.machine);
+#endif
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Desktop</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        g_getenv("XDG_CURRENT_DESKTOP"));
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Cairo version</div></td>"
+        "  <td>%s (build) %s (runtime)</td>"
+        " </tbody></tr>",
+        CAIRO_VERSION_STRING, cairo_version_string());
+
+#if PLATFORM(GTK)
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">GTK version</div></td>"
+        "  <td>%d.%d.%d (build) %d.%d.%d (runtime)</td>"
+        " </tbody></tr>",
+        GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION,
+        gtk_get_major_version(), gtk_get_minor_version(), gtk_get_micro_version());
+
+#if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland) {
+        g_string_append_printf(html,
+            " <tbody><tr>"
+            "  <td><div class=\"titlename\">WPE version</div></td>"
+            "  <td>%d.%d.%d (using fdo backend %d.%d.%d)</td>"
+            " </tbody></tr>",
+            WPE_FDO_MAJOR_VERSION, WPE_FDO_MINOR_VERSION, WPE_FDO_MICRO_VERSION,
+            WPE_MAJOR_VERSION, WPE_MINOR_VERSION, WPE_MICRO_VERSION);
+    }
+#endif
+#endif
+
+#if PLATFORM(WPE)
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">WPE version</div></td>"
+        "  <td>%d.%d.%d (build) %d.%d.%d (runtime)</td>"
+        " </tbody></tr>",
+        WPE_MAJOR_VERSION, WPE_MINOR_VERSION, WPE_MICRO_VERSION,
+        wpe_get_major_version(), wpe_get_minor_version(), wpe_get_micro_version());
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">WPE backend</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        wpe_loader_get_loaded_implementation_library_name());
+#endif
+    g_string_append(html, "<table>");
+
+    g_string_append(html,
+        "<h1>Display Information</h1>"
+        "<table>");
+
+#if PLATFORM(GTK)
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Type</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland ? "Wayland" : "X11");
+#endif
+
+    auto rect = IntRect(screenRect(nullptr));
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Screen geometry</div></td>"
+        "  <td>%d,%d %dx%d</td>"
+        " </tbody></tr>",
+        rect.x(), rect.y(), rect.width(), rect.height());
+
+    rect = IntRect(screenAvailableRect(nullptr));
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Screen work area</div></td>"
+        "  <td>%d,%d %dx%d</td>"
+        " </tbody></tr>",
+        rect.x(), rect.y(), rect.width(), rect.height());
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Depth</div></td>"
+        "  <td>%d</td>"
+        " </tbody></tr>",
+        screenDepth(nullptr));
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Bits per color component</div></td>"
+        "  <td>%d</td>"
+        " </tbody></tr>",
+        screenDepthPerComponent(nullptr));
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">DPI</div></td>"
+        "  <td>%.2f</td>"
+        " </tbody></tr>",
+        screenDPI());
+
+    g_string_append(html, "<table>");
+
+    g_string_append(html,
+        "<h1>Hardware Acceleration Information</h1>"
+        "<table>");
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Policy</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        hardwareAccelerationPolicy(request));
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">WebGL enabled</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        webGLEnabled(request) ? "Yes" : "No");
+
+    auto glContext = GLContext::createOffscreenContext();
+    glContext->makeContextCurrent();
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">API</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        openGLAPI());
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">Native interface</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        nativeInterface());
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">GL_RENDERER</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">GL_VENDOR</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">GL_VERSION</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        reinterpret_cast<const char*>(glGetString(GL_VERSION)));
+
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">GL_SHADING_LANGUAGE_VERSION</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION)));
+
+#if USE(OPENGL_ES)
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">GL_EXTENSIONS</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)));
+#else
+    GString* extensions = g_string_new(nullptr);
+    GLint numExtensions = 0;
+    glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
+    for (GLint i = 0; i < numExtensions; ++i) {
+        if (i)
+            g_string_append_c(extensions, ' ');
+        g_string_append(extensions, reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i)));
+    }
+    g_string_append_printf(html,
+        " <tbody><tr>"
+        "  <td><div class=\"titlename\">GL_EXTENSIONS</div></td>"
+        "  <td>%s</td>"
+        " </tbody></tr>",
+        extensions->str);
+    g_string_free(extensions, TRUE);
+#endif
+
+    bool isGLX = false;
+#if USE(GLX)
+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11) {
+        isGLX = true;
+        auto* x11Display = downcast<PlatformDisplayX11>(PlatformDisplay::sharedDisplay()).native();
+
+        g_string_append_printf(html,
+            " <tbody><tr>"
+            "  <td><div class=\"titlename\">GLX_VERSION</div></td>"
+            "  <td>%s</td>"
+            " </tbody></tr>",
+            glXGetClientString(x11Display, GLX_VERSION));
+
+        g_string_append_printf(html,
+            " <tbody><tr>"
+            "  <td><div class=\"titlename\">GLX_VENDOR</div></td>"
+            "  <td>%s</td>"
+            " </tbody></tr>",
+            glXGetClientString(x11Display, GLX_VENDOR));
+
+        g_string_append_printf(html,
+            " <tbody><tr>"
+            "  <td><div class=\"titlename\">GLX_EXTENSIONS</div></td>"
+            "  <td>%s</td>"
+            " </tbody></tr>",
+            glXGetClientString(x11Display, GLX_EXTENSIONS));
+    }
+#endif
+
+#if USE(EGL)
+    if (!isGLX) {
+        auto eglDisplay = PlatformDisplay::sharedDisplay().eglDisplay();
+
+        g_string_append_printf(html,
+            " <tbody><tr>"
+            "  <td><div class=\"titlename\">EGL_VERSION</div></td>"
+            "  <td>%s</td>"
+            " </tbody></tr>",
+            eglQueryString(eglDisplay, EGL_VERSION));
+
+        g_string_append_printf(html,
+            " <tbody><tr>"
+            "  <td><div class=\"titlename\">EGL_VENDOR</div></td>"
+            "  <td>%s</td>"
+            " </tbody></tr>",
+            eglQueryString(eglDisplay, EGL_VENDOR));
+
+        g_string_append_printf(html,
+            " <tbody><tr>"
+            "  <td><div class=\"titlename\">EGL_EXTENSIONS</div></td>"
+            "  <td>%s</td>"
+            " </tbody></tr>",
+            eglQueryString(eglDisplay, EGL_EXTENSIONS));
+    }
+#endif
+
+    g_string_append(html, "<table>");
+
+    g_string_append(html, "</body></html>");
+    gsize streamLength = html->len;
+    GRefPtr<GInputStream> stream = adoptGRef(g_memory_input_stream_new_from_data(g_string_free(html, FALSE), streamLength, g_free));
+    webkit_uri_scheme_request_finish(request, stream.get(), streamLength, "text/html");
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.h (0 => 250517)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitProtocolHandler.h	2019-09-30 12:06:23 UTC (rev 250517)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 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.
+ */
+
+#pragma once
+
+#include "WebKitURISchemeRequest.h"
+#include "WebKitWebContext.h"
+
+namespace WebKit {
+
+class WebKitProtocolHandler {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit WebKitProtocolHandler(WebKitWebContext*);
+    ~WebKitProtocolHandler() = default;
+
+private:
+    void handleRequest(WebKitURISchemeRequest*);
+    void handleGPU(WebKitURISchemeRequest*);
+
+    WebKitWebContext* m_context { nullptr };
+};
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp (250516 => 250517)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp	2019-09-30 12:06:23 UTC (rev 250517)
@@ -43,6 +43,7 @@
 #include "WebKitNotificationProvider.h"
 #include "WebKitPluginPrivate.h"
 #include "WebKitPrivate.h"
+#include "WebKitProtocolHandler.h"
 #include "WebKitSecurityManagerPrivate.h"
 #include "WebKitSecurityOriginPrivate.h"
 #include "WebKitSettingsPrivate.h"
@@ -192,6 +193,7 @@
     std::unique_ptr<WebKitAutomationClient> automationClient;
     GRefPtr<WebKitAutomationSession> automationSession;
 #endif
+    std::unique_ptr<WebKitProtocolHandler> webkitProtocolHandler;
 };
 
 static guint signals[LAST_SIGNAL] = { 0, };
@@ -353,6 +355,7 @@
 #if PLATFORM(GTK) && ENABLE(REMOTE_INSPECTOR)
     priv->remoteInspectorProtocolHandler = makeUnique<RemoteInspectorProtocolHandler>(webContext);
 #endif
+    priv->webkitProtocolHandler = makeUnique<WebKitProtocolHandler>(webContext);
 }
 
 static void webkitWebContextDispose(GObject* object)

Modified: trunk/Source/cmake/OptionsGTK.cmake (250516 => 250517)


--- trunk/Source/cmake/OptionsGTK.cmake	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Source/cmake/OptionsGTK.cmake	2019-09-30 12:06:23 UTC (rev 250517)
@@ -189,6 +189,13 @@
 add_definitions(-DWEBKITGTK_API_VERSION_STRING="${WEBKITGTK_API_VERSION}")
 add_definitions(-DJSC_GLIB_API_ENABLED)
 
+if (EXISTS "${TOOLS_DIR}/glib/svn-revision")
+    execute_process(COMMAND ${TOOLS_DIR}/glib/svn-revision ERROR_QUIET OUTPUT_VARIABLE SVN_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE)
+else ()
+    set(SVN_REVISION "tarball")
+endif ()
+add_definitions(-DSVN_REVISION="${SVN_REVISION}")
+
 set(GTK_LIBRARIES ${GTK3_LIBRARIES})
 set(GTK_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS})
 set(GDK_LIBRARIES ${GDK3_LIBRARIES})

Modified: trunk/Source/cmake/OptionsWPE.cmake (250516 => 250517)


--- trunk/Source/cmake/OptionsWPE.cmake	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Source/cmake/OptionsWPE.cmake	2019-09-30 12:06:23 UTC (rev 250517)
@@ -171,6 +171,13 @@
 add_definitions(-DGETTEXT_PACKAGE="WPE")
 add_definitions(-DJSC_GLIB_API_ENABLED)
 
+if (EXISTS "${TOOLS_DIR}/glib/svn-revision")
+    execute_process(COMMAND ${TOOLS_DIR}/glib/svn-revision ERROR_QUIET OUTPUT_VARIABLE SVN_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE)
+else ()
+    set(SVN_REVISION "tarball")
+endif ()
+add_definitions(-DSVN_REVISION="${SVN_REVISION}")
+
 SET_AND_EXPOSE_TO_BUILD(HAVE_ACCESSIBILITY ${ENABLE_ACCESSIBILITY})
 SET_AND_EXPOSE_TO_BUILD(USE_ATK ${ENABLE_ACCESSIBILITY})
 SET_AND_EXPOSE_TO_BUILD(USE_CAIRO TRUE)

Modified: trunk/Tools/ChangeLog (250516 => 250517)


--- trunk/Tools/ChangeLog	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Tools/ChangeLog	2019-09-30 12:06:23 UTC (rev 250517)
@@ -1,3 +1,20 @@
+2019-09-30  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK][WPE] Add about:gpu
+        https://bugs.webkit.org/show_bug.cgi?id=202305
+
+        Reviewed by Žan Doberšek.
+
+        Allow to use about:gpu in MiniBrowser. Add a script to get the current svn revision.
+
+        * MiniBrowser/gtk/BrowserTab.c:
+        (getInternalURI):
+        * MiniBrowser/gtk/main.c:
+        (argumentToURL):
+        * MiniBrowser/wpe/main.cpp:
+        (main):
+        * glib/svn-revision: Added.
+
 2019-09-27  Andres Gonzalez  <andresg...@apple.com>
 
         Support accessibility for <figure> element on iOS.

Modified: trunk/Tools/MiniBrowser/gtk/BrowserTab.c (250516 => 250517)


--- trunk/Tools/MiniBrowser/gtk/BrowserTab.c	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Tools/MiniBrowser/gtk/BrowserTab.c	2019-09-30 12:06:23 UTC (rev 250517)
@@ -462,6 +462,9 @@
 
 static char *getInternalURI(const char *uri)
 {
+    if (g_str_equal(uri, "about:gpu"))
+        return g_strdup("webkit://gpu");
+
     /* Internally we use minibrowser-about: as about: prefix is ignored by WebKit. */
     if (g_str_has_prefix(uri, "about:") && !g_str_equal(uri, "about:blank"))
         return g_strconcat(BROWSER_ABOUT_SCHEME, uri + strlen ("about"), NULL);

Modified: trunk/Tools/MiniBrowser/gtk/main.c (250516 => 250517)


--- trunk/Tools/MiniBrowser/gtk/main.c	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Tools/MiniBrowser/gtk/main.c	2019-09-30 12:06:23 UTC (rev 250517)
@@ -66,6 +66,9 @@
 
 static gchar *argumentToURL(const char *filename)
 {
+    if (g_str_equal(filename, "about:gpu"))
+        filename = "webkit://gpu";
+
     GFile *gfile = g_file_new_for_commandline_arg(filename);
     gchar *fileURL = g_file_get_uri(gfile);
     g_object_unref(gfile);

Modified: trunk/Tools/MiniBrowser/wpe/main.cpp (250516 => 250517)


--- trunk/Tools/MiniBrowser/wpe/main.cpp	2019-09-30 11:18:14 UTC (rev 250516)
+++ trunk/Tools/MiniBrowser/wpe/main.cpp	2019-09-30 12:06:23 UTC (rev 250517)
@@ -306,7 +306,11 @@
         webkit_web_view_set_background_color(webView, &color);
 
     if (uriArguments) {
-        GFile* file = g_file_new_for_commandline_arg(uriArguments[0]);
+        const char* uri = uriArguments[0];
+        if (g_str_equal(uri, "about:gpu"))
+            uri = "webkit://gpu";
+
+        GFile* file = g_file_new_for_commandline_arg(uri);
         char* url = ""
         g_object_unref(file);
         webkit_web_view_load_uri(webView, url);

Added: trunk/Tools/glib/svn-revision (0 => 250517)


--- trunk/Tools/glib/svn-revision	                        (rev 0)
+++ trunk/Tools/glib/svn-revision	2019-09-30 12:06:23 UTC (rev 250517)
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2019 Igalia S.L.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+import os
+import sys
+
+top_level_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", ".."))
+sys.path.insert(0, os.path.join(top_level_directory, "Tools", "Scripts"))
+
+from webkitpy.common.checkout.scm.detection import SCMDetector
+from webkitpy.common.system.executive import Executive
+from webkitpy.common.system.filesystem import FileSystem
+
+scm = SCMDetector(FileSystem(), Executive()).default_scm()
+print ("r" + scm.head_svn_revision())
Property changes on: trunk/Tools/glib/svn-revision
___________________________________________________________________

Added: svn:executable

+* \ No newline at end of property
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to