Title: [187862] releases/WebKitGTK/webkit-2.8/Source
Revision
187862
Author
carlo...@webkit.org
Date
2015-08-04 06:51:03 -0700 (Tue, 04 Aug 2015)

Log Message

Merge r187338 - [GStreamer] Crashes during plugin installation
https://bugs.webkit.org/show_bug.cgi?id=144099

Reviewed by Philippe Normand.

Source/WebCore:

Add new methods to MediaPlayerClient and ChromeClient to request
the API layer to start the installer when there are missing media
plugins.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::requestInstallMissingPlugins): Pass
the request to the ChromeClient.
* html/HTMLMediaElement.h:
* page/ChromeClient.h:
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::requestInstallMissingPlugins):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
Invalidate any pending request to install missing media plugins.
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): In case of
missing plugins message, start a request to install them if
supported by GST.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create):
(WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback):
(WebCore::MediaPlayerRequestInstallMissingPluginsCallback::invalidate):
(WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete):

Source/WebKit2:

Move the missing plugins installation to the UI process, ensuring
there's a single installer running and cancelling the request when
the page is closed or the media player is deleted.

* PlatformEfl.cmake: Add new files to compilation.
* PlatformGTK.cmake: Ditto.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in: Add
RequestInstallMissingMediaPlugins message.
* UIProcess/gstreamer/WebPageProxyGStreamer.cpp: Added.
(WebKit::WebPageProxy::requestInstallMissingMediaPlugins): Call
gst_install_plugins_async() and send
DidEndRequestInstallMissingMediaPlugins message back to the web
process when done.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::requestInstallMissingMediaPlugins): Call
WebPage::requestInstallMissingMediaPlugins().
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::close): Invalidate the install missing plugins
request callback.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Add
DidEndRequestInstallMissingMediaPlugins message.
* WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp: Added.
(WebKit::WebPage::requestInstallMissingMediaPlugins): Send
RequestInstallMissingMediaPlugins to the UI process or complete
the request early if there's already a request in progress.
(WebKit::WebPage::didEndRequestInstallMissingMediaPlugins):
Complete the request.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-08-04 13:51:03 UTC (rev 187862)
@@ -1,3 +1,33 @@
+2015-07-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GStreamer] Crashes during plugin installation
+        https://bugs.webkit.org/show_bug.cgi?id=144099
+
+        Reviewed by Philippe Normand.
+
+        Add new methods to MediaPlayerClient and ChromeClient to request
+        the API layer to start the installer when there are missing media
+        plugins.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::requestInstallMissingPlugins): Pass
+        the request to the ChromeClient.
+        * html/HTMLMediaElement.h:
+        * page/ChromeClient.h:
+        * platform/graphics/MediaPlayer.h:
+        (WebCore::MediaPlayerClient::requestInstallMissingPlugins):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
+        Invalidate any pending request to install missing media plugins.
+        (WebCore::MediaPlayerPrivateGStreamer::handleMessage): In case of
+        missing plugins message, start a request to install them if
+        supported by GST.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create):
+        (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback):
+        (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::invalidate):
+        (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete):
+
 2015-07-22  Jinyoung Hur  <hur....@navercorp.com>
 
         [WinCairo] SVG path not rendered with all-zero dasharray

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLMediaElement.cpp (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLMediaElement.cpp	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLMediaElement.cpp	2015-08-04 13:51:03 UTC (rev 187862)
@@ -5821,6 +5821,16 @@
     return potentiallyPlaying() ? requestedPlaybackRate() : 0;
 }
 
+#if USE(GSTREAMER)
+void HTMLMediaElement::requestInstallMissingPlugins(const String& details, MediaPlayerRequestInstallMissingPluginsCallback& callback)
+{
+    if (!document().page())
+        return;
+
+    document().page()->chrome().client().requestInstallMissingMediaPlugins(details, callback);
+}
+#endif
+
 void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
 {
     m_mediaSession->removeBehaviorRestriction(HTMLMediaSession::RequireUserGestureForLoad);

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLMediaElement.h (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLMediaElement.h	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLMediaElement.h	2015-08-04 13:51:03 UTC (rev 187862)
@@ -616,6 +616,11 @@
     virtual double mediaPlayerRequestedPlaybackRate() const override final;
 
     void loadTimerFired();
+
+#if USE(GSTREAMER)
+    virtual void requestInstallMissingPlugins(const String&, MediaPlayerRequestInstallMissingPluginsCallback&) override final;
+#endif
+
     void progressEventTimerFired();
     void playbackProgressTimerFired();
     void scanTimerFired();

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/page/ChromeClient.h (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/page/ChromeClient.h	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/page/ChromeClient.h	2015-08-04 13:51:03 UTC (rev 187862)
@@ -84,6 +84,10 @@
 class ViewportConstraints;
 class Widget;
 
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+class MediaPlayerRequestInstallMissingPluginsCallback;
+#endif
+
 struct DateTimeChooserParameters;
 struct FrameLoadRequest;
 struct GraphicsDeviceAdapter;
@@ -437,6 +441,12 @@
 
     virtual bool shouldDispatchFakeMouseMoveEvents() const { return true; }
 
+#if ENABLE(VIDEO)
+#if USE(GSTREAMER)
+    virtual void requestInstallMissingMediaPlugins(const String& /*details*/, MediaPlayerRequestInstallMissingPluginsCallback&) { };
+#endif
+#endif
+
 protected:
     virtual ~ChromeClient() { }
 };

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/MediaPlayer.h (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/MediaPlayer.h	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/MediaPlayer.h	2015-08-04 13:51:03 UTC (rev 187862)
@@ -139,6 +139,10 @@
 struct GraphicsDeviceAdapter;
 #endif
 
+#if USE(GSTREAMER)
+class MediaPlayerRequestInstallMissingPluginsCallback;
+#endif
+
 class MediaPlayerClient {
 public:
     virtual ~MediaPlayerClient() { }
@@ -267,6 +271,10 @@
     virtual void mediaPlayerEngineFailedToLoad() const { }
 
     virtual double mediaPlayerRequestedPlaybackRate() const { return 0; }
+
+#if USE(GSTREAMER)
+    virtual void requestInstallMissingPlugins(const String&, MediaPlayerRequestInstallMissingPluginsCallback&) { };
+#endif
 };
 
 class MediaPlayerSupportsTypeClient {

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2015-08-04 13:51:03 UTC (rev 187862)
@@ -31,6 +31,7 @@
 #include "URL.h"
 #include "MIMETypeRegistry.h"
 #include "MediaPlayer.h"
+#include "MediaPlayerRequestInstallMissingPluginsCallback.h"
 #include "NotImplemented.h"
 #include "SecurityOrigin.h"
 #include "TimeRanges.h"
@@ -123,12 +124,6 @@
 }
 #endif
 
-static void mediaPlayerPrivatePluginInstallerResultFunction(GstInstallPluginsReturn result, gpointer userData)
-{
-    MediaPlayerPrivateGStreamer* player = reinterpret_cast<MediaPlayerPrivateGStreamer*>(userData);
-    player->handlePluginInstallerResult(result);
-}
-
 void MediaPlayerPrivateGStreamer::setAudioStreamProperties(GObject* object)
 {
     if (g_strcmp0(G_OBJECT_TYPE_NAME(object), "GstPulseSink"))
@@ -220,7 +215,6 @@
     , m_audioSourceProvider(AudioSourceProviderGStreamer::create())
 #endif
     , m_requestedState(GST_STATE_VOID_PENDING)
-    , m_missingPlugins(false)
 {
 }
 
@@ -249,6 +243,10 @@
             reinterpret_cast<gpointer>(setAudioStreamPropertiesCallback), this);
 
     m_readyTimerHandler.cancel();
+    if (m_missingPluginsCallback) {
+        m_missingPluginsCallback->invalidate();
+        m_missingPluginsCallback = nullptr;
+    }
 
     if (m_playBin) {
         GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_playBin.get())));
@@ -936,7 +934,7 @@
     case GST_MESSAGE_ERROR:
         if (m_resetPipeline)
             break;
-        if (m_missingPlugins)
+        if (m_missingPluginsCallback)
             break;
         gst_message_parse_error(message, &err.outPtr(), &debug.outPtr());
         ERROR_MEDIA_MESSAGE("Error %d: %s (url="" err->code, err->message, m_url.string().utf8().data());
@@ -1031,11 +1029,18 @@
         break;
     case GST_MESSAGE_ELEMENT:
         if (gst_is_missing_plugin_message(message)) {
-            gchar* detail = gst_missing_plugin_message_get_installer_detail(message);
-            gchar* detailArray[2] = {detail, 0};
-            GstInstallPluginsReturn result = gst_install_plugins_async(detailArray, 0, mediaPlayerPrivatePluginInstallerResultFunction, this);
-            m_missingPlugins = result == GST_INSTALL_PLUGINS_STARTED_OK;
-            g_free(detail);
+            GUniquePtr<char> detail(gst_missing_plugin_message_get_installer_detail(message));
+            if (gst_install_plugins_supported()) {
+                m_missingPluginsCallback = MediaPlayerRequestInstallMissingPluginsCallback::create([this](uint32_t result) {
+                    m_missingPluginsCallback = nullptr;
+                    if (result != GST_INSTALL_PLUGINS_SUCCESS)
+                        return;
+
+                    changePipelineState(GST_STATE_READY);
+                    changePipelineState(GST_STATE_PAUSED);
+                });
+                m_player->client().requestInstallMissingPlugins(String::fromUTF8(detail.get()), *m_missingPluginsCallback);
+            }
         }
 #if ENABLE(VIDEO_TRACK) && USE(GSTREAMER_MPEGTS)
         else {
@@ -1060,15 +1065,6 @@
     return TRUE;
 }
 
-void MediaPlayerPrivateGStreamer::handlePluginInstallerResult(GstInstallPluginsReturn result)
-{
-    m_missingPlugins = false;
-    if (result == GST_INSTALL_PLUGINS_SUCCESS) {
-        changePipelineState(GST_STATE_READY);
-        changePipelineState(GST_STATE_PAUSED);
-    }
-}
-
 void MediaPlayerPrivateGStreamer::processBufferingStats(GstMessage* message)
 {
     m_buffering = true;

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2015-08-04 13:51:03 UTC (rev 187862)
@@ -58,6 +58,7 @@
 class AudioTrackPrivateGStreamer;
 class InbandMetadataTextTrackPrivateGStreamer;
 class InbandTextTrackPrivateGStreamer;
+class MediaPlayerRequestInstallMissingPluginsCallback;
 class VideoTrackPrivateGStreamer;
 
 class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateGStreamerBase {
@@ -234,7 +235,7 @@
 #endif
     GstState m_requestedState;
     GRefPtr<GstElement> m_autoAudioSink;
-    bool m_missingPlugins;
+    RefPtr<MediaPlayerRequestInstallMissingPluginsCallback> m_missingPluginsCallback;
 #if ENABLE(VIDEO_TRACK)
     Vector<RefPtr<AudioTrackPrivateGStreamer>> m_audioTracks;
     Vector<RefPtr<InbandTextTrackPrivateGStreamer>> m_textTracks;

Added: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h (0 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h	2015-08-04 13:51:03 UTC (rev 187862)
@@ -0,0 +1,61 @@
+/*
+ * 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
+ * aint 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.
+ */
+
+#ifndef MediaPlayerRequestInstallMissingPluginsCallback_h
+#define MediaPlayerRequestInstallMissingPluginsCallback_h
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class MediaPlayerRequestInstallMissingPluginsCallback : public RefCounted<MediaPlayerRequestInstallMissingPluginsCallback> {
+    WTF_MAKE_FAST_ALLOCATED();
+public:
+    static Ref<MediaPlayerRequestInstallMissingPluginsCallback> create(std::function<void (uint32_t)>&& function)
+    {
+        return adoptRef(*new MediaPlayerRequestInstallMissingPluginsCallback(WTF::move(function)));
+    }
+
+    void invalidate()
+    {
+        m_function = nullptr;
+    }
+
+    void complete(uint32_t result)
+    {
+        if (!m_function)
+            return;
+        m_function(result);
+        m_function = nullptr;
+    }
+
+private:
+    MediaPlayerRequestInstallMissingPluginsCallback(std::function<void (uint32_t)>&& function)
+        : m_function(WTF::move(function))
+    {
+    }
+
+    std::function<void (uint32_t)> m_function;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(VIDEO) && USE(GSTREAMER)
+#endif // MediaPlayerRequestInstallMissingPluginsCallback_h

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/ChangeLog	2015-08-04 13:51:03 UTC (rev 187862)
@@ -1,3 +1,41 @@
+2015-07-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GStreamer] Crashes during plugin installation
+        https://bugs.webkit.org/show_bug.cgi?id=144099
+
+        Reviewed by Philippe Normand.
+
+        Move the missing plugins installation to the UI process, ensuring
+        there's a single installer running and cancelling the request when
+        the page is closed or the media player is deleted.
+
+        * PlatformEfl.cmake: Add new files to compilation.
+        * PlatformGTK.cmake: Ditto.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in: Add
+        RequestInstallMissingMediaPlugins message.
+        * UIProcess/gstreamer/WebPageProxyGStreamer.cpp: Added.
+        (WebKit::WebPageProxy::requestInstallMissingMediaPlugins): Call
+        gst_install_plugins_async() and send
+        DidEndRequestInstallMissingMediaPlugins message back to the web
+        process when done.
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::requestInstallMissingMediaPlugins): Call
+        WebPage::requestInstallMissingMediaPlugins().
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::close): Invalidate the install missing plugins
+        request callback.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in: Add
+        DidEndRequestInstallMissingMediaPlugins message.
+        * WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp: Added.
+        (WebKit::WebPage::requestInstallMissingMediaPlugins): Send
+        RequestInstallMissingMediaPlugins to the UI process or complete
+        the request early if there's already a request in progress.
+        (WebKit::WebPage::didEndRequestInstallMissingMediaPlugins):
+        Complete the request.
+
 2015-07-21  Andreas Kling  <akl...@apple.com>
 
         API::Session should clean up its storage in the network process when destroyed.

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/PlatformEfl.cmake (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/PlatformEfl.cmake	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/PlatformEfl.cmake	2015-08-04 13:51:03 UTC (rev 187862)
@@ -174,6 +174,8 @@
     UIProcess/efl/WebUIPopupMenuClient.cpp
     UIProcess/efl/WebViewEfl.cpp
 
+    UIProcess/gstreamer/WebPageProxyGStreamer.cpp
+
     UIProcess/soup/WebCookieManagerProxySoup.cpp
     UIProcess/soup/WebProcessPoolSoup.cpp
 
@@ -206,6 +208,8 @@
     WebProcess/WebPage/efl/WebInspectorUIEfl.cpp
     WebProcess/WebPage/efl/WebPageEfl.cpp
 
+    WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp
+
     WebProcess/efl/ExtensionManagerEfl.cpp
     WebProcess/efl/SeccompFiltersWebProcessEfl.cpp
     WebProcess/efl/WebProcessMainEfl.cpp
@@ -269,6 +273,7 @@
     ${EO_INCLUDE_DIRS}
     ${EVAS_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
+    ${GSTREAMER_INCLUDE_DIRS}
     ${HARFBUZZ_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
     ${LIBXML2_INCLUDE_DIR}

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/PlatformGTK.cmake (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/PlatformGTK.cmake	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/PlatformGTK.cmake	2015-08-04 13:51:03 UTC (rev 187862)
@@ -270,6 +270,8 @@
 
     UIProcess/cairo/BackingStoreCairo.cpp
 
+    UIProcess/gstreamer/WebPageProxyGStreamer.cpp
+
     UIProcess/gtk/DragAndDropHandler.cpp
     UIProcess/gtk/ExperimentalFeatures.cpp
     UIProcess/gtk/GestureController.cpp
@@ -320,6 +322,8 @@
 
     WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp
 
+    WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp
+
     WebProcess/WebPage/gtk/PrinterListGtk.cpp
     WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp
     WebProcess/WebPage/gtk/WebPageGtk.cpp
@@ -474,6 +478,7 @@
     ${CAIRO_INCLUDE_DIRS}
     ${ENCHANT_INCLUDE_DIRS}
     ${GEOCLUE_INCLUDE_DIRS}
+    ${GSTREAMER_INCLUDE_DIRS}
     ${HARFBUZZ_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
 )

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.h (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.h	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.h	2015-08-04 13:51:03 UTC (rev 187862)
@@ -1377,6 +1377,12 @@
     void didPerformActionMenuHitTest(const ActionMenuHitTestResult&, bool forImmediateAction, const UserData&);
 #endif
 
+#if ENABLE(VIDEO)
+#if USE(GSTREAMER)
+    void requestInstallMissingMediaPlugins(const String& details);
+#endif
+#endif
+
     PageClient& m_pageClient;
     std::unique_ptr<API::LoaderClient> m_loaderClient;
     std::unique_ptr<API::PolicyClient> m_policyClient;

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.messages.in (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2015-08-04 13:51:03 UTC (rev 187862)
@@ -421,4 +421,8 @@
 #if PLATFORM(MAC)
     DidPerformActionMenuHitTest(struct WebKit::ActionMenuHitTestResult result, bool forImmediateAction, WebKit::UserData userData)
 #endif
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+    RequestInstallMissingMediaPlugins(String details)
+#endif
 }

Added: releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/gstreamer/WebPageProxyGStreamer.cpp (0 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/gstreamer/WebPageProxyGStreamer.cpp	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/UIProcess/gstreamer/WebPageProxyGStreamer.cpp	2015-08-04 13:51:03 UTC (rev 187862)
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "WebPageProxy.h"
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+
+#include "WebPageMessages.h"
+#include <gst/pbutils/install-plugins.h>
+
+namespace WebKit {
+
+void WebPageProxy::requestInstallMissingMediaPlugins(const String& details)
+{
+    CString detail = details.utf8();
+    const char* detailArray[2] = { detail.data(), nullptr };
+    ref();
+    // FIXME: Use a proper GstInstallPluginsContext instead of nullptr.
+    GstInstallPluginsReturn result = gst_install_plugins_async(detailArray, nullptr, [](GstInstallPluginsReturn result, gpointer userData) {
+        RefPtr<WebPageProxy> page = adoptRef(static_cast<WebPageProxy*>(userData));
+        if (page->isValid())
+            page->send(Messages::WebPage::DidEndRequestInstallMissingMediaPlugins(static_cast<uint32_t>(result)));
+    }, this);
+
+    if (result != GST_INSTALL_PLUGINS_STARTED_OK) {
+        // If the installer didn't start, the callback will not be called, so remove the ref manually.
+        deref();
+        send(Messages::WebPage::DidEndRequestInstallMissingMediaPlugins(static_cast<uint32_t>(result)));
+        WTFLogAlways("Missing GStreamer Plugin: %s\n", detail.data());
+    }
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(VIDEO) && USE(GSTREAMER)

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-08-04 13:51:03 UTC (rev 187862)
@@ -1102,4 +1102,13 @@
     return m_page->shouldDispatchFakeMouseMoveEvents();
 }
 
+#if ENABLE(VIDEO)
+#if USE(GSTREAMER)
+void WebChromeClient::requestInstallMissingMediaPlugins(const String& details, WebCore::MediaPlayerRequestInstallMissingPluginsCallback& callback)
+{
+    m_page->requestInstallMissingMediaPlugins(details, callback);
+}
+#endif
+#endif // ENABLE(VIDEO)
+
 } // namespace WebKit

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-08-04 13:51:03 UTC (rev 187862)
@@ -310,6 +310,12 @@
 
     virtual bool shouldDispatchFakeMouseMoveEvents() const override;
 
+#if ENABLE(VIDEO)
+#if USE(GSTREAMER)
+    virtual void requestInstallMissingMediaPlugins(const String&, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&) override;
+#endif
+#endif
+
     String m_cachedToolTip;
     mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
     mutable bool m_cachedMainFrameHasHorizontalScrollbar;

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-08-04 13:51:03 UTC (rev 187862)
@@ -213,6 +213,10 @@
 #include "CoordinatedLayerTreeHostMessages.h"
 #endif
 
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+#include <WebCore/MediaPlayerRequestInstallMissingPluginsCallback.h>
+#endif
+
 using namespace JSC;
 using namespace WebCore;
 
@@ -1013,6 +1017,13 @@
     }
 #endif
 
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+    if (m_installMediaPluginsCallback) {
+        m_installMediaPluginsCallback->invalidate();
+        m_installMediaPluginsCallback = nullptr;
+    }
+#endif
+
     m_sandboxExtensionTracker.invalidate();
 
 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.h (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-08-04 13:51:03 UTC (rev 187862)
@@ -139,6 +139,10 @@
 struct Highlight;
 struct KeypressCommand;
 struct TextCheckingResult;
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+class MediaPlayerRequestInstallMissingPluginsCallback;
+#endif
 }
 
 namespace WebKit {
@@ -865,6 +869,12 @@
 
     void setPageActivityState(WebCore::PageActivityState::Flags);
 
+#if ENABLE(VIDEO)
+#if USE(GSTREAMER)
+    void requestInstallMissingMediaPlugins(const String& details, WebCore::MediaPlayerRequestInstallMissingPluginsCallback&);
+#endif
+#endif
+
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
 
@@ -1092,6 +1102,10 @@
 
     void setShouldDispatchFakeMouseMoveEvents(bool dispatch) { m_shouldDispatchFakeMouseMoveEvents = dispatch; }
 
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+    void didEndRequestInstallMissingMediaPlugins(uint32_t result);
+#endif
+
     uint64_t m_pageID;
 
     std::unique_ptr<WebCore::Page> m_page;
@@ -1337,6 +1351,10 @@
 
     bool m_mainFrameProgressCompleted;
     bool m_shouldDispatchFakeMouseMoveEvents;
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+    RefPtr<WebCore::MediaPlayerRequestInstallMissingPluginsCallback> m_installMediaPluginsCallback;
+#endif
 };
 
 } // namespace WebKit

Modified: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (187861 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-08-04 13:50:19 UTC (rev 187861)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2015-08-04 13:51:03 UTC (rev 187862)
@@ -409,4 +409,8 @@
 #endif
 
     SetShouldDispatchFakeMouseMoveEvents(bool shouldDispatchFakeMouseMoveEvents)
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+    DidEndRequestInstallMissingMediaPlugins(uint32_t result)
+#endif
 }

Added: releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp (0 => 187862)


--- releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.8/Source/WebKit2/WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp	2015-08-04 13:51:03 UTC (rev 187862)
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "WebPage.h"
+
+#if ENABLE(VIDEO) && USE(GSTREAMER)
+
+#include "WebPageProxyMessages.h"
+#include <WebCore/MediaPlayerRequestInstallMissingPluginsCallback.h>
+#include <gst/pbutils/install-plugins.h>
+
+namespace WebKit {
+
+void WebPage::requestInstallMissingMediaPlugins(const String& details, WebCore::MediaPlayerRequestInstallMissingPluginsCallback& callback)
+{
+    if (m_installMediaPluginsCallback) {
+        callback.complete(GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS);
+        return;
+    }
+
+    m_installMediaPluginsCallback = &callback;
+    send(Messages::WebPageProxy::RequestInstallMissingMediaPlugins(details));
+}
+
+void WebPage::didEndRequestInstallMissingMediaPlugins(uint32_t result)
+{
+    if (!m_installMediaPluginsCallback)
+        return;
+
+    m_installMediaPluginsCallback->complete(result);
+    m_installMediaPluginsCallback = nullptr;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(VIDEO) && USE(GSTREAMER)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to