⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 282307 in webkit


Ignore:
Timestamp:
Sep 11, 2021, 4:34:42 AM (5 years ago)
Author:
Philippe Normand
Message:

[GLIB] MediaSession is not enabled
​https://bugs.webkit.org/show_bug.cgi?id=217991
<rdar://problem/70740119>

Reviewed by Michael Catanzaro.

.:

Enable MediaSession as an experimental build feature in CMake ports. The spec status is
currently Draft.

  • Source/cmake/OptionsGTK.cmake:
  • Source/cmake/OptionsWPE.cmake:
  • Source/cmake/WebKitFeatures.cmake:

Source/WebCore:

Implementation of a GLib MediaSessionManager, able to provide a MPRIS DBus service, so that
third-party host tools can query the media playback status and potentially emit remote
control commands as well.

Covered by media-session layout tests now unskipped.

  • Modules/mediasession/MediaImage.h:
  • Modules/mediasession/MediaSession.cpp:

(WebCore::logChannel):
(WebCore::logClassName):

  • Modules/mediasession/MediaSession.h:
  • PlatformGTK.cmake:
  • PlatformWPE.cmake:
  • platform/LogInitialization.cpp:

(WebCore::getLogChannel):

  • platform/PlatformScreen.h:
  • platform/RemoteCommandListener.cpp:

(WebCore::RemoteCommandListener::resetCreationFunction):

  • platform/SourcesGLib.txt:
  • platform/audio/PlatformMediaSessionManager.cpp:
  • platform/audio/glib/MediaSessionManagerGLib.cpp: Added.

(WebCore::PlatformMediaSessionManager::create):
(WebCore::MediaSessionManagerGLib::MediaSessionManagerGLib):
(WebCore::MediaSessionManagerGLib::~MediaSessionManagerGLib):
(WebCore::getCommand):
(WebCore::handleMethodCall):
(WebCore::getProperty):
(WebCore::handleGetProperty):
(WebCore::handleSetProperty):
(WebCore::MediaSessionManagerGLib::setupMpris):
(WebCore::MediaSessionManagerGLib::busAcquired):
(WebCore::MediaSessionManagerGLib::nameLost):
(WebCore::MediaSessionManagerGLib::beginInterruption):
(WebCore::MediaSessionManagerGLib::scheduleSessionStatusUpdate):
(WebCore::MediaSessionManagerGLib::sessionWillBeginPlayback):
(WebCore::MediaSessionManagerGLib::sessionDidEndRemoteScrubbing):
(WebCore::MediaSessionManagerGLib::addSession):
(WebCore::MediaSessionManagerGLib::removeSession):
(WebCore::MediaSessionManagerGLib::setCurrentSession):
(WebCore::MediaSessionManagerGLib::sessionWillEndPlayback):
(WebCore::MediaSessionManagerGLib::sessionStateChanged):
(WebCore::MediaSessionManagerGLib::clientCharacteristicsChanged):
(WebCore::MediaSessionManagerGLib::sessionCanProduceAudioChanged):
(WebCore::MediaSessionManagerGLib::addSupportedCommand):
(WebCore::MediaSessionManagerGLib::removeSupportedCommand):
(WebCore::MediaSessionManagerGLib::nowPlayingEligibleSession):
(WebCore::MediaSessionManagerGLib::updateNowPlayingInfo):
(WebCore::MediaSessionManagerGLib::getPlaybackStatusAsGVariant):
(WebCore::MediaSessionManagerGLib::getActiveSessionPosition):
(WebCore::MediaSessionManagerGLib::dispatch):
(WebCore::MediaSessionManagerGLib::emitPropertiesChanged):

  • platform/audio/glib/MediaSessionManagerGLib.h: Added.

(WebCore::MediaSessionManagerGLib::nameAcquired):
(WebCore::MediaSessionManagerGLib::getMetadataAsGVariant const):
(WebCore::MediaSessionManagerGLib::providePresentingApplicationPIDIfNecessary):

  • platform/glib/ApplicationGLib.cpp: Added.

(WebCore::setApplicationName):
(WebCore::getApplicationName):
(WebCore::setApplicationID):
(WebCore::getApplicationID):

  • platform/glib/ApplicationGLib.h: Added.
  • platform/glib/RemoteCommandListenerGLib.cpp: Added.

(WebCore::RemoteCommandListenerGLib::create):
(WebCore::RemoteCommandListenerGLib::updateSupportedCommands):
(WebCore::RemoteCommandListenerGLib::RemoteCommandListenerGLib):

  • platform/glib/RemoteCommandListenerGLib.h: Added.
  • platform/graphics/ImageFrame.h:
  • platform/graphics/ImageOrientation.h:

Source/WebKit:

Pass Application name and unique ID from the UIProcess to the WebProcess in WPE and GTK
ports. The Bubblewrap launcher was also adapted to allow DBus MPRIS name ownership in the
sandboxed WebProcess.

  • Shared/WebProcessCreationParameters.cpp:

(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):

  • Shared/WebProcessCreationParameters.h:
  • UIProcess/API/glib/WebKitSettings.cpp:

(webKitSettingsConstructed):

  • UIProcess/Launcher/glib/BubblewrapLauncher.cpp:

(WebKit::applicationId):
(WebKit::createFlatpakInfo):
(WebKit::XDGDBusProxyLauncher::launch):

  • UIProcess/glib/WebProcessPoolGLib.cpp:

(WebKit::WebProcessPool::platformInitializeWebProcess):

  • WebProcess/glib/WebProcessGLib.cpp:

(WebKit::WebProcess::platformInitializeWebProcess):

Source/WTF:

GRefPtr template specialization for GDBusNodeInfo.

  • wtf/glib/GRefPtr.cpp:

(WTF::refGPtr):
(WTF::derefGPtr):

  • wtf/glib/GRefPtr.h:

LayoutTests:

  • platform/glib/TestExpectations: Unskip media-session tests.
Location:
trunk
Files:
6 added
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r282181 r282307  
     12021-09-11  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GLIB] MediaSession is not enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=217991
     5        <rdar://problem/70740119>
     6
     7        Reviewed by Michael Catanzaro.
     8
     9        Enable MediaSession as an experimental build feature in CMake ports. The spec status is
     10        currently Draft.
     11
     12        * Source/cmake/OptionsGTK.cmake:
     13        * Source/cmake/OptionsWPE.cmake:
     14        * Source/cmake/WebKitFeatures.cmake:
     15
    1162021-09-08  Justin Michaud  <justin_michaud@apple.com>
    217
  • trunk/LayoutTests/ChangeLog

    r282306 r282307  
     12021-09-11  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GLIB] MediaSession is not enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=217991
     5        <rdar://problem/70740119>
     6
     7        Reviewed by Michael Catanzaro.
     8
     9        * platform/glib/TestExpectations: Unskip media-session tests.
     10
    1112021-09-10  Alan Bujtas  <zalan@apple.com>
    212
  • trunk/LayoutTests/platform/glib/TestExpectations

    r282205 r282307  
    14181418# Failing since added in r268138.
    14191419webkit.org/b/217815 imported/w3c/web-platform-tests/css/css-masking/clip-path/clip-path-filter-order.html [ ImageOnlyFailure ]
    1420 
    1421 # MediaSession is not enabled in GTK/WPE.
    1422 webkit.org/b/217991 imported/w3c/web-platform-tests/mediasession/ [ Skip ]
    1423 webkit.org/b/217991 media/media-session/ [ Skip ]
    1424 webkit.org/b/217991 fast/mediasession/ [ Skip ]
    14251420
    14261421# This test uses an MPEG-4 video
  • trunk/Source/WTF/ChangeLog

    r282303 r282307  
     12021-09-11  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GLIB] MediaSession is not enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=217991
     5        <rdar://problem/70740119>
     6
     7        Reviewed by Michael Catanzaro.
     8
     9        GRefPtr template specialization for GDBusNodeInfo.
     10
     11        * wtf/glib/GRefPtr.cpp:
     12        (WTF::refGPtr):
     13        (WTF::derefGPtr):
     14        * wtf/glib/GRefPtr.h:
     15
    1162021-09-10  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Source/WTF/wtf/glib/GRefPtr.cpp

    r273236 r282307  
    196196}
    197197
     198template <> GDBusNodeInfo* refGPtr(GDBusNodeInfo* ptr)
     199{
     200    if (ptr)
     201        g_dbus_node_info_ref(ptr);
     202    return ptr;
     203}
     204
     205template <> void derefGPtr(GDBusNodeInfo* ptr)
     206{
     207    if (ptr)
     208        g_dbus_node_info_unref(ptr);
     209}
     210
    198211#if HAVE(GURI)
    199212template <> GUri* refGPtr(GUri* ptr)
  • trunk/Source/WTF/wtf/glib/GRefPtr.h

    r273236 r282307  
    2525#if USE(GLIB)
    2626
    27 #include <wtf/HashTraits.h>
    2827#include <algorithm>
    2928#include <glib.h>
    30 
     29#include <wtf/HashTraits.h>
     30
     31extern "C" {
     32    typedef struct _GDBusNodeInfo GDBusNodeInfo;
     33    GDBusNodeInfo* g_dbus_node_info_ref(GDBusNodeInfo*);
     34    void g_dbus_node_info_unref(GDBusNodeInfo*);
     35};
    3136extern "C" void g_object_unref(gpointer);
    3237extern "C" gpointer g_object_ref_sink(gpointer);
    … …  
    243248template <> WTF_EXPORT_PRIVATE GDateTime* refGPtr(GDateTime* ptr);
    244249template <> WTF_EXPORT_PRIVATE void derefGPtr(GDateTime* ptr);
     250template <> WTF_EXPORT_PRIVATE GDBusNodeInfo* refGPtr(GDBusNodeInfo* ptr);
     251template <> WTF_EXPORT_PRIVATE void derefGPtr(GDBusNodeInfo* ptr);
    245252
    246253#if HAVE(GURI)
  • trunk/Source/WebCore/ChangeLog

    r282306 r282307  
     12021-09-11  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GLIB] MediaSession is not enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=217991
     5        <rdar://problem/70740119>
     6
     7        Reviewed by Michael Catanzaro.
     8
     9        Implementation of a GLib MediaSessionManager, able to provide a MPRIS DBus service, so that
     10        third-party host tools can query the media playback status and potentially emit remote
     11        control commands as well.
     12
     13        Covered by media-session layout tests now unskipped.
     14
     15        * Modules/mediasession/MediaImage.h:
     16        * Modules/mediasession/MediaSession.cpp:
     17        (WebCore::logChannel):
     18        (WebCore::logClassName):
     19        * Modules/mediasession/MediaSession.h:
     20        * PlatformGTK.cmake:
     21        * PlatformWPE.cmake:
     22        * platform/LogInitialization.cpp:
     23        (WebCore::getLogChannel):
     24        * platform/PlatformScreen.h:
     25        * platform/RemoteCommandListener.cpp:
     26        (WebCore::RemoteCommandListener::resetCreationFunction):
     27        * platform/SourcesGLib.txt:
     28        * platform/audio/PlatformMediaSessionManager.cpp:
     29        * platform/audio/glib/MediaSessionManagerGLib.cpp: Added.
     30        (WebCore::PlatformMediaSessionManager::create):
     31        (WebCore::MediaSessionManagerGLib::MediaSessionManagerGLib):
     32        (WebCore::MediaSessionManagerGLib::~MediaSessionManagerGLib):
     33        (WebCore::getCommand):
     34        (WebCore::handleMethodCall):
     35        (WebCore::getProperty):
     36        (WebCore::handleGetProperty):
     37        (WebCore::handleSetProperty):
     38        (WebCore::MediaSessionManagerGLib::setupMpris):
     39        (WebCore::MediaSessionManagerGLib::busAcquired):
     40        (WebCore::MediaSessionManagerGLib::nameLost):
     41        (WebCore::MediaSessionManagerGLib::beginInterruption):
     42        (WebCore::MediaSessionManagerGLib::scheduleSessionStatusUpdate):
     43        (WebCore::MediaSessionManagerGLib::sessionWillBeginPlayback):
     44        (WebCore::MediaSessionManagerGLib::sessionDidEndRemoteScrubbing):
     45        (WebCore::MediaSessionManagerGLib::addSession):
     46        (WebCore::MediaSessionManagerGLib::removeSession):
     47        (WebCore::MediaSessionManagerGLib::setCurrentSession):
     48        (WebCore::MediaSessionManagerGLib::sessionWillEndPlayback):
     49        (WebCore::MediaSessionManagerGLib::sessionStateChanged):
     50        (WebCore::MediaSessionManagerGLib::clientCharacteristicsChanged):
     51        (WebCore::MediaSessionManagerGLib::sessionCanProduceAudioChanged):
     52        (WebCore::MediaSessionManagerGLib::addSupportedCommand):
     53        (WebCore::MediaSessionManagerGLib::removeSupportedCommand):
     54        (WebCore::MediaSessionManagerGLib::nowPlayingEligibleSession):
     55        (WebCore::MediaSessionManagerGLib::updateNowPlayingInfo):
     56        (WebCore::MediaSessionManagerGLib::getPlaybackStatusAsGVariant):
     57        (WebCore::MediaSessionManagerGLib::getActiveSessionPosition):
     58        (WebCore::MediaSessionManagerGLib::dispatch):
     59        (WebCore::MediaSessionManagerGLib::emitPropertiesChanged):
     60        * platform/audio/glib/MediaSessionManagerGLib.h: Added.
     61        (WebCore::MediaSessionManagerGLib::nameAcquired):
     62        (WebCore::MediaSessionManagerGLib::getMetadataAsGVariant const):
     63        (WebCore::MediaSessionManagerGLib::providePresentingApplicationPIDIfNecessary):
     64        * platform/glib/ApplicationGLib.cpp: Added.
     65        (WebCore::setApplicationName):
     66        (WebCore::getApplicationName):
     67        (WebCore::setApplicationID):
     68        (WebCore::getApplicationID):
     69        * platform/glib/ApplicationGLib.h: Added.
     70        * platform/glib/RemoteCommandListenerGLib.cpp: Added.
     71        (WebCore::RemoteCommandListenerGLib::create):
     72        (WebCore::RemoteCommandListenerGLib::updateSupportedCommands):
     73        (WebCore::RemoteCommandListenerGLib::RemoteCommandListenerGLib):
     74        * platform/glib/RemoteCommandListenerGLib.h: Added.
     75        * platform/graphics/ImageFrame.h:
     76        * platform/graphics/ImageOrientation.h:
     77
    1782021-09-10  Alan Bujtas  <zalan@apple.com>
    279
  • trunk/Source/WebCore/Modules/mediasession/MediaImage.h

    r278253 r282307  
    2727
    2828#if ENABLE(MEDIA_SESSION)
     29
     30#include <wtf/Forward.h>
     31#include <wtf/text/WTFString.h>
    2932
    3033namespace WebCore {
  • trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp

    r281013 r282307  
    5252}
    5353
    54 static WTFLogChannel& logChannel() { return LogMedia; }
    55 static const char* logClassName() { return "MediaSession"; }
     54#if !RELEASE_LOG_DISABLED
     55static WTFLogChannel& logChannel()
     56{
     57    return LogMedia;
     58}
     59
     60static const char* logClassName()
     61{
     62    return "MediaSession";
     63}
     64#endif
    5665
    5766static PlatformMediaSession::RemoteControlCommandType platformCommandForMediaSessionAction(MediaSessionAction action)
  • trunk/Source/WebCore/Modules/mediasession/MediaSession.h

    r279786 r282307  
    9494    WEBCORE_EXPORT bool callActionHandler(const MediaSessionActionDetails&, TriggerGestureIndicator = TriggerGestureIndicator::Yes);
    9595
     96#if !RELEASE_LOG_DISABLED
    9697    const Logger& logger() const { return *m_logger.get(); }
     98#endif
    9799
    98100    class Observer : public CanMakeWeakPtr<Observer> {
  • trunk/Source/WebCore/PlatformGTK.cmake

    r281333 r282307  
    2727    "${WEBCORE_DIR}/page/gtk"
    2828    "${WEBCORE_DIR}/platform/adwaita"
     29    "${WEBCORE_DIR}/platform/audio/glib"
    2930    "${WEBCORE_DIR}/platform/generic"
     31    "${WEBCORE_DIR}/platform/glib"
    3032    "${WEBCORE_DIR}/platform/gtk"
    3133    "${WEBCORE_DIR}/platform/graphics/egl"
    … …  
    5355list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS
    5456    platform/adwaita/ScrollbarThemeAdwaita.h
     57
     58    platform/glib/ApplicationGLib.h
    5559
    5660    platform/graphics/x11/PlatformDisplayX11.h
  • trunk/Source/WebCore/PlatformWPE.cmake

    r279987 r282307  
    2020    "${WEBCORE_DIR}/accessibility/atk"
    2121    "${WEBCORE_DIR}/platform/adwaita"
     22    "${WEBCORE_DIR}/platform/audio/glib"
     23    "${WEBCORE_DIR}/platform/glib"
    2224    "${WEBCORE_DIR}/platform/graphics/egl"
    2325    "${WEBCORE_DIR}/platform/graphics/epoxy"
    … …  
    3739
    3840list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS
     41    platform/glib/ApplicationGLib.h
     42
    3943    platform/graphics/wayland/PlatformDisplayWayland.h
    4044    platform/graphics/wayland/WlUniquePtr.h
  • trunk/Source/WebCore/platform/LogInitialization.cpp

    r280758 r282307  
    6666WTFLogChannel* getLogChannel(const String& name)
    6767{
     68    UNUSED_PARAM(name);
    6869    return nullptr;
    6970}
  • trunk/Source/WebCore/platform/PlatformScreen.h

    r280976 r282307  
    4747#if USE(CG)
    4848typedef struct CGColorSpace *CGColorSpaceRef;
     49#endif
     50
     51// X11 headers define a bunch of macros with common terms, interfering with WebCore and WTF enum values.
     52// As a workaround, we explicitly undef them here.
     53#if defined(None)
     54#undef None
    4955#endif
    5056
  • trunk/Source/WebCore/platform/RemoteCommandListener.cpp

    r278392 r282307  
    3131#endif
    3232
     33#if USE(GLIB)
     34#include "RemoteCommandListenerGLib.h"
     35#endif
     36
    3337namespace WebCore {
    3438
    … …  
    4953#if PLATFORM(COCOA)
    5054        return RemoteCommandListenerCocoa::create(client);
     55#elif USE(GLIB)
     56        return RemoteCommandListenerGLib::create(client);
    5157#else
    52         return RemoteCommandListener::create(client);
     58        UNUSED_PARAM(client);
     59        return nullptr;
    5360#endif
    5461    };
  • trunk/Source/WebCore/platform/SourcesGLib.txt

    r271452 r282307  
    2323
    2424platform/audio/glib/AudioBusGLib.cpp
     25platform/audio/glib/MediaSessionManagerGLib.cpp
    2526
     27platform/glib/ApplicationGLib.cpp
    2628platform/glib/FileMonitorGLib.cpp
    2729platform/glib/KeyedDecoderGlib.cpp
    2830platform/glib/KeyedEncoderGlib.cpp
    2931platform/glib/LowPowerModeNotifierGLib.cpp
     32platform/glib/RemoteCommandListenerGLib.cpp
    3033platform/glib/SharedBufferGlib.cpp
    3134platform/glib/UserAgentGLib.cpp
  • trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp

    r280702 r282307  
    7575}
    7676
    77 #if !PLATFORM(COCOA)
     77#if !PLATFORM(COCOA) && !USE(GLIB)
    7878std::unique_ptr<PlatformMediaSessionManager> PlatformMediaSessionManager::create()
    7979{
    8080    return std::unique_ptr<PlatformMediaSessionManager>(new PlatformMediaSessionManager);
    8181}
    82 #endif // !PLATFORM(COCOA)
     82#endif // !PLATFORM(COCOA) && !USE(GLIB)
    8383
    8484void PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary()
  • trunk/Source/WebCore/platform/graphics/ImageFrame.h

    r278338 r282307  
    3333#include "NativeImage.h"
    3434#include <wtf/Seconds.h>
     35
     36// X11 headers define a bunch of macros with common terms, interfering with WebCore and WTF enum values.
     37// As a workaround, we explicitly undef them here.
     38#if defined(None)
     39#undef None
     40#endif
    3541
    3642namespace WebCore {
  • trunk/Source/WebCore/platform/graphics/ImageOrientation.h

    r253249 r282307  
    3030#include "FloatSize.h"
    3131#include <wtf/EnumTraits.h>
     32
     33// X11 headers define a bunch of macros with common terms, interfering with WebCore and WTF enum values.
     34// As a workaround, we explicitly undef them here.
     35#if defined(None)
     36#undef None
     37#endif
    3238
    3339namespace WebCore {
  • trunk/Source/WebKit/ChangeLog

    r282305 r282307  
     12021-09-11  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GLIB] MediaSession is not enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=217991
     5        <rdar://problem/70740119>
     6
     7        Reviewed by Michael Catanzaro.
     8
     9        Pass Application name and unique ID from the UIProcess to the WebProcess in WPE and GTK
     10        ports. The Bubblewrap launcher was also adapted to allow DBus MPRIS name ownership in the
     11        sandboxed WebProcess.
     12
     13        * Shared/WebProcessCreationParameters.cpp:
     14        (WebKit::WebProcessCreationParameters::encode const):
     15        (WebKit::WebProcessCreationParameters::decode):
     16        * Shared/WebProcessCreationParameters.h:
     17        * UIProcess/API/glib/WebKitSettings.cpp:
     18        (webKitSettingsConstructed):
     19        * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
     20        (WebKit::applicationId):
     21        (WebKit::createFlatpakInfo):
     22        (WebKit::XDGDBusProxyLauncher::launch):
     23        * UIProcess/glib/WebProcessPoolGLib.cpp:
     24        (WebKit::WebProcessPool::platformInitializeWebProcess):
     25        * WebProcess/glib/WebProcessGLib.cpp:
     26        (WebKit::WebProcess::platformInitializeWebProcess):
     27
    1282021-09-10  Chris Dumez  <cdumez@apple.com>
    229
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp

    r281832 r282307  
    215215    encoder << memoryPressureHandlerConfiguration;
    216216#endif
     217#if USE(GLIB)
     218    encoder << applicationID;
     219    encoder << applicationName;
     220#endif
    217221}
    218222
    … …  
    588592#endif
    589593
     594#if USE(GLIB)
     595    if (!decoder.decode(parameters.applicationID))
     596        return false;
     597    if (!decoder.decode(parameters.applicationName))
     598        return false;
     599#endif
     600
    590601    return true;
    591602}
  • trunk/Source/WebKit/Shared/WebProcessCreationParameters.h

    r281832 r282307  
    261261    std::optional<MemoryPressureHandler::Configuration> memoryPressureHandlerConfiguration;
    262262#endif
     263
     264#if USE(GLIB)
     265    String applicationID;
     266    String applicationName;
     267#endif
    263268};
    264269
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp

    r281085 r282307  
    197197#endif
    198198#endif
     199
     200    // FIXME: Expose API for this when this feature is officially non-experimental.
     201#if ENABLE(MEDIA_SESSION)
     202    prefs->setMediaSessionEnabled(true);
     203    prefs->setMediaSessionCoordinatorEnabled(true);
     204    prefs->setMediaSessionPlaylistEnabled(true);
     205#endif
    199206}
    200207
  • trunk/Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp

    r279369 r282307  
    131131}
    132132
     133static const char* applicationId(GError** error)
     134{
     135    GApplication* app = g_application_get_default();
     136    if (!app) {
     137        g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "GApplication is required.");
     138        return nullptr;
     139    }
     140
     141    const char* appID = g_application_get_application_id(app);
     142    if (!appID) {
     143        g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "GApplication must have a valid ID.");
     144        return nullptr;
     145    }
     146    return appID;
     147}
     148
    133149static int createFlatpakInfo()
    134150{
    … …  
    139155        // xdg-desktop-portal relates your name to certain permissions so we want
    140156        // them to be application unique which is best done via GApplication.
    141         GApplication* app = g_application_get_default();
    142         if (!app)
    143             g_error("GApplication is required for xdg-desktop-portal access in the WebKit sandbox.");
    144 
    145         const char* appID = g_application_get_application_id(app);
     157        GUniqueOutPtr<GError> error;
     158        const char* appID = applicationId(&error.outPtr());
    146159        if (!appID)
    147             g_error("GApplication must have a valid ID for xdg-desktop-portal access in the WebKit sandbox.");
     160            g_error("Unable to configure xdg-desktop-portal access in the WebKit sandbox: %s", error->message);
    148161
    149162        GUniquePtr<GKeyFile> keyFile(g_key_file_new());
    … …  
    208221            proxyArgs.append("--log");
    209222
     223        GUniqueOutPtr<GError> error;
     224#if ENABLE(MEDIA_SESSION)
     225        const char* appID = applicationId(&error.outPtr());
     226        if (!appID)
     227            g_warning("Unable to own D-Bus MPRIS name in the WebKit sandbox: %s", error->message);
     228
     229        auto mprisSessionID = makeString("--own=org.mpris.MediaPlayer2.", appID);
     230        proxyArgs.append(mprisSessionID.ascii().data());
     231#endif
     232
    210233        proxyArgs.appendVector(m_permissions);
    211234
    … …  
    237260        ProcessLauncher::LaunchOptions launchOptions;
    238261        launchOptions.processType = ProcessLauncher::ProcessType::DBusProxy;
    239         GUniqueOutPtr<GError> error;
    240262        GRefPtr<GSubprocess> process = bubblewrapSpawn(launcher.get(), launchOptions, argv, &error.outPtr());
    241263        if (!process.get())
  • trunk/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp

    r280155 r282307  
    110110
    111111    parameters.memoryPressureHandlerConfiguration = m_configuration->memoryPressureHandlerConfiguration();
     112
     113    GApplication* app = g_application_get_default();
     114    if (app)
     115        parameters.applicationID = g_application_get_application_id(app);
     116    parameters.applicationName = g_get_application_name();
    112117}
    113118
  • trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp

    r280155 r282307  
    3636#endif
    3737
     38#include <WebCore/ApplicationGLib.h>
    3839#include <WebCore/MemoryCache.h>
    3940
    … …  
    109110    if (parameters.memoryPressureHandlerConfiguration)
    110111        MemoryPressureHandler::singleton().setConfiguration(WTFMove(*parameters.memoryPressureHandlerConfiguration));
     112
     113    if (!parameters.applicationID.isEmpty())
     114        WebCore::setApplicationID(parameters.applicationID);
     115
     116    if (!parameters.applicationName.isEmpty())
     117        WebCore::setApplicationName(parameters.applicationName);
    111118}
    112119
  • trunk/Source/cmake/OptionsGTK.cmake

    r281708 r282307  
    154154WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_WEEK PRIVATE ON)
    155155WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LAYOUT_FORMATTING_CONTEXT PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
     156WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SESSION PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
     157WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SESSION_PLAYLIST PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
    156158WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STREAM PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
    157159WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
  • trunk/Source/cmake/OptionsWPE.cmake

    r281708 r282307  
    5252WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GPU_PROCESS PRIVATE OFF)
    5353WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LAYOUT_FORMATTING_CONTEXT PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
     54WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SESSION PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
     55WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SESSION_PLAYLIST PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
    5456WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STREAM PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
    5557WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
  • trunk/Source/cmake/WebKitFeatures.cmake

    r281757 r282307  
    170170    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_CAPTURE "Toggle Media Capture support" PRIVATE OFF)
    171171    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_CONTROLS_SCRIPT "Toggle definition of media controls in Javascript" PRIVATE ON)
     172    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_SESSION "Toggle Media Session support" PRIVATE OFF)
     173    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_SESSION_COORDINATOR "Toggle Media Session Coordinator support" PRIVATE OFF)
     174    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_SESSION_PLAYLIST "Toggle Media Session Playlist support" PRIVATE OFF)
    172175    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_SOURCE "Toggle Media Source support" PRIVATE OFF)
    173176    WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_STATISTICS "Toggle Media Statistics support" PRIVATE OFF)
  • trunk/Tools/Scripts/webkitpy/style/checker.py

    r279985 r282307  
    180180      os.path.join('Source', 'WebKit', 'WebProcess', 'InjectedBundle', 'API', 'wpe')],
    181181     ["-readability/enum_casing"]),
     182
     183    ([
     184     # Forward declarations of GLib/GIO functions use underscores.
     185     os.path.join('Source', 'WTF', 'wtf', 'glib', 'GRefPtr.h')],
     186     ["-readability/naming/underscores"]),
    182187
    183188    ([
Note: See TracChangeset for help on using the changeset viewer.