Changeset 254392 in webkit


Ignore:
Timestamp:
Jan 10, 2020 9:32:23 PM (4 years ago)
Author:
eric.carlson@apple.com
Message:

[Media in GPU process] Extend the GPU process sandbox to allow access to local files when necessary
https://bugs.webkit.org/show_bug.cgi?id=205967
<rdar://problem/58425020>

Reviewed by youenn fablet.

Source/WebKit:

No new tests, un-skipped existing tests that pass because of this change.

The GPU process sandbox does not allow access to local files so extend it before
attempting to open a file:// url, and revoke the extension when the file is closed.

  • GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:

(WebKit::RemoteMediaPlayerManagerProxy::load):

  • GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
  • GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in:
  • GPUProcess/media/RemoteMediaPlayerProxy.cpp:

(WebKit::RemoteMediaPlayerProxy::invalidate):
(WebKit::RemoteMediaPlayerProxy::load):

  • GPUProcess/media/RemoteMediaPlayerProxy.h:
  • UIProcess/GPU/GPUProcessProxy.cpp:

(WebKit::GPUProcessProxy::openGPUProcessConnection):

  • UIProcess/GPU/GPUProcessProxy.h:
  • UIProcess/WebProcessProxy.cpp:
  • UIProcess/WebProcessProxy.h:
  • WebKit.xcodeproj/project.pbxproj:
  • WebProcess/GPU/GPUProcessConnection.h:

(WebKit::GPUProcessConnection::setAuditToken):
(WebKit::GPUProcessConnection::auditToken const):

  • WebProcess/GPU/GPUProcessConnectionInfo.h:

(WebKit::GPUProcessConnectionInfo::encode const):
(WebKit::GPUProcessConnectionInfo::decode):

  • WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:

(WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load):
(WebKit::MediaPlayerPrivateRemote::cancelLoad):
(WebKit::MediaPlayerPrivateRemote::prepareToPlay):
(WebKit::MediaPlayerPrivateRemote::play):
(WebKit::MediaPlayerPrivateRemote::pause):
(WebKit::MediaPlayerPrivateRemote::setPreservesPitch):
(WebKit::MediaPlayerPrivateRemote::setVolumeDouble):
(WebKit::MediaPlayerPrivateRemote::setMuted):
(WebKit::MediaPlayerPrivateRemote::setPreload):
(WebKit::MediaPlayerPrivateRemote::setPrivateBrowsingMode):
(WebKit::MediaPlayerPrivateRemote::seek):
(WebKit::MediaPlayerPrivateRemote::seekWithTolerance):
(WebKit::MediaPlayerPrivateRemote::prepareForRendering):
(WebKit::MediaPlayerPrivateRemote::setSize):
(WebKit::MediaPlayerPrivateRemote::setVisible):
(WebKit::MediaPlayerPrivateRemote::setShouldMaintainAspectRatio):
(WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrame):
(WebKit::MediaPlayerPrivateRemote::setVideoFullscreenGravity):
(WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged):
(WebKit::MediaPlayerPrivateRemote::setShouldDisableSleep):
(WebKit::MediaPlayerPrivateRemote::requestResource):

  • WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
  • WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.cpp:

(WebKit::RemoteMediaPlayerMIMETypeCache::canDecodeExtendedType):
(WebKit::RemoteMediaPlayerMIMETypeCache::supportsTypeAndCodecs):
(WebKit::RemoteMediaPlayerMIMETypeCache::initializeCache):

  • WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:

(WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):
(WebKit::RemoteMediaPlayerManager::deleteRemoteMediaPlayer):
(WebKit::RemoteMediaPlayerManager::getSupportedTypes):
(WebKit::RemoteMediaPlayerManager::originsInMediaCache):
(WebKit::RemoteMediaPlayerManager::clearMediaCache):
(WebKit::RemoteMediaPlayerManager::clearMediaCacheForOrigins):
(WebKit::RemoteMediaPlayerManager::gpuProcessConnection const):

  • WebProcess/GPU/media/RemoteMediaPlayerManager.h:

(WebKit::RemoteMediaPlayerManager::parentProcess const):

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::ensureGPUProcessConnection):

LayoutTests:

  • gpu-process/TestExpectations:
Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r254391 r254392  
     12020-01-10  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Media in GPU process] Extend the GPU process sandbox to allow access to local files when necessary
     4        https://bugs.webkit.org/show_bug.cgi?id=205967
     5        <rdar://problem/58425020>
     6
     7        Reviewed by youenn fablet.
     8
     9        * gpu-process/TestExpectations:
     10
    1112020-01-10  Myles C. Maxfield  <mmaxfield@apple.com>
    212
  • trunk/LayoutTests/gpu-process/TestExpectations

    r254019 r254392  
    180180
    181181media [ Skip ]
    182 media/audio-play-with-video-element.html [ Pass ]
    183 media/audio-play.html [ Pass ]
    184 media/media-can-play-mpeg-audio.html [ Pass ]
    185 media/media-can-play-wav-audio.html [ Pass ]
    186182media/media-controller.html [ Pass ]
    187183media/media-preload-no-delay-loadevent.html [ Pass ]
    188184media/video-src.html [ Pass ]
    189185media/video-source.html [ Pass ]
     186media/audio-as-video-fullscreen.html [ Pass ]
     187media/audio-background-playback-playlist.html [ Pass ]
     188media/audio-concurrent-supported.html [ Pass ]
     189media/audio-constructor-preload.html [ Pass ]
     190media/audio-constructor-src.html [ Pass ]
     191media/audio-constructor.html [ Pass ]
     192media/audio-controls-do-not-fade-out.html [ Pass ]
     193media/audio-controls-timeline-in-media-document.html [ Pass ]
     194media/audio-dealloc-crash.html [ Pass ]
     195media/audio-delete-while-slider-thumb-clicked.html [ Pass ]
     196media/audio-garbage-collect.html [ Pass ]
     197media/audio-mpeg-supported.html [ Pass ]
     198media/audio-mpeg4-supported.html [ Pass ]
     199media/audio-no-installed-engines.html [ Pass ]
     200media/audio-only-video-intrinsic-size.html [ Pass ]
     201media/audio-play-event.html [ Pass ]
     202media/audio-play-with-video-element.html [ Pass ]
     203media/audio-play.html [ Pass ]
     204media/audio-playback-restriction-autoplay.html [ Pass ]
     205media/audio-playback-restriction-play-muted.html [ Pass ]
     206media/audio-playback-restriction-play.html [ Pass ]
     207media/audio-playback-restriction-removed-muted.html [ Pass ]
     208media/audio-playback-volume-changes-with-restrictions-and-user-gestures.html [ Pass ]
     209media/audio-playback-volume-changes-with-restrictions.html [ Pass ]
     210media/deactivate-audio-session.html [ Pass ]
     211media/media-can-play-mpeg-audio.html [ Pass ]
     212media/media-can-play-wav-audio.html [ Pass ]
     213media/media-document-audio-controls-visible.html [ Pass ]
     214media/media-document-audio-repaint.html [ Pass ]
     215media/media-document-audio-size.html [ Pass ]
     216media/muted-video-is-playing-audio.html [ Pass ]
     217media/restricted-audio-playback-with-document-gesture.html [ Pass ]
     218media/restricted-audio-playback-with-multiple-settimeouts.html [ Pass ]
     219media/video-controls-visible-audio-only.html [ Pass ]
     220media/video-play-audio-require-user-gesture.html [ Pass ]
     221
    190222accessibility/media-element.html [ Skip ]
    191223fast/block/float/list-marker-is-float-crash.html [ Skip ]
  • trunk/Source/WebKit/ChangeLog

    r254387 r254392  
     12020-01-10  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [Media in GPU process] Extend the GPU process sandbox to allow access to local files when necessary
     4        https://bugs.webkit.org/show_bug.cgi?id=205967
     5        <rdar://problem/58425020>
     6
     7        Reviewed by youenn fablet.
     8
     9        No new tests, un-skipped existing tests that pass because of this change.
     10       
     11        The GPU process sandbox does not allow access to local files so extend it before
     12        attempting to open a file:// url, and revoke the extension when the file is closed.
     13
     14        * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
     15        (WebKit::RemoteMediaPlayerManagerProxy::load):
     16        * GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
     17        * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in:
     18        * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
     19        (WebKit::RemoteMediaPlayerProxy::invalidate):
     20        (WebKit::RemoteMediaPlayerProxy::load):
     21        * GPUProcess/media/RemoteMediaPlayerProxy.h:
     22        * UIProcess/GPU/GPUProcessProxy.cpp:
     23        (WebKit::GPUProcessProxy::openGPUProcessConnection):
     24        * UIProcess/GPU/GPUProcessProxy.h:
     25        * UIProcess/WebProcessProxy.cpp:
     26        * UIProcess/WebProcessProxy.h:
     27        * WebKit.xcodeproj/project.pbxproj:
     28        * WebProcess/GPU/GPUProcessConnection.h:
     29        (WebKit::GPUProcessConnection::setAuditToken):
     30        (WebKit::GPUProcessConnection::auditToken const):
     31        * WebProcess/GPU/GPUProcessConnectionInfo.h:
     32        (WebKit::GPUProcessConnectionInfo::encode const):
     33        (WebKit::GPUProcessConnectionInfo::decode):
     34        * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
     35        (WebKit::MediaPlayerPrivateRemote::prepareForPlayback):
     36        (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load):
     37        (WebKit::MediaPlayerPrivateRemote::cancelLoad):
     38        (WebKit::MediaPlayerPrivateRemote::prepareToPlay):
     39        (WebKit::MediaPlayerPrivateRemote::play):
     40        (WebKit::MediaPlayerPrivateRemote::pause):
     41        (WebKit::MediaPlayerPrivateRemote::setPreservesPitch):
     42        (WebKit::MediaPlayerPrivateRemote::setVolumeDouble):
     43        (WebKit::MediaPlayerPrivateRemote::setMuted):
     44        (WebKit::MediaPlayerPrivateRemote::setPreload):
     45        (WebKit::MediaPlayerPrivateRemote::setPrivateBrowsingMode):
     46        (WebKit::MediaPlayerPrivateRemote::seek):
     47        (WebKit::MediaPlayerPrivateRemote::seekWithTolerance):
     48        (WebKit::MediaPlayerPrivateRemote::prepareForRendering):
     49        (WebKit::MediaPlayerPrivateRemote::setSize):
     50        (WebKit::MediaPlayerPrivateRemote::setVisible):
     51        (WebKit::MediaPlayerPrivateRemote::setShouldMaintainAspectRatio):
     52        (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenFrame):
     53        (WebKit::MediaPlayerPrivateRemote::setVideoFullscreenGravity):
     54        (WebKit::MediaPlayerPrivateRemote::acceleratedRenderingStateChanged):
     55        (WebKit::MediaPlayerPrivateRemote::setShouldDisableSleep):
     56        (WebKit::MediaPlayerPrivateRemote::requestResource):
     57        * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
     58        * WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.cpp:
     59        (WebKit::RemoteMediaPlayerMIMETypeCache::canDecodeExtendedType):
     60        (WebKit::RemoteMediaPlayerMIMETypeCache::supportsTypeAndCodecs):
     61        (WebKit::RemoteMediaPlayerMIMETypeCache::initializeCache):
     62        * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
     63        (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):
     64        (WebKit::RemoteMediaPlayerManager::deleteRemoteMediaPlayer):
     65        (WebKit::RemoteMediaPlayerManager::getSupportedTypes):
     66        (WebKit::RemoteMediaPlayerManager::originsInMediaCache):
     67        (WebKit::RemoteMediaPlayerManager::clearMediaCache):
     68        (WebKit::RemoteMediaPlayerManager::clearMediaCacheForOrigins):
     69        (WebKit::RemoteMediaPlayerManager::gpuProcessConnection const):
     70        * WebProcess/GPU/media/RemoteMediaPlayerManager.h:
     71        (WebKit::RemoteMediaPlayerManager::parentProcess const):
     72        * WebProcess/WebProcess.cpp:
     73        (WebKit::WebProcess::ensureGPUProcessConnection):
     74
    1752020-01-10  Jer Noble  <jer.noble@apple.com>
    276
  • trunk/Source/WebKit/GPUProcess/GPUProcess.cpp

    r253900 r254392  
    3636#include "GPUProcessCreationParameters.h"
    3737#include "Logging.h"
     38#include "SandboxExtension.h"
    3839#include "WebPageProxyMessages.h"
    3940#include "WebProcessPoolMessages.h"
  • trunk/Source/WebKit/GPUProcess/GPUProcess.messages.in

    r253900 r254392  
    1 # Copyright (C) 2019 Apple Inc. All rights reserved.
     1# Copyright (C) 2019-2020 Apple Inc. All rights reserved.
    22#
    33# Redistribution and use in source and binary forms, with or without
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp

    r254098 r254392  
    204204}
    205205
    206 void RemoteMediaPlayerManagerProxy::load(MediaPlayerPrivateRemoteIdentifier id, URL&& url, WebCore::ContentType&& contentType, String&& keySystem, CompletionHandler<void(RemoteMediaPlayerConfiguration&&)>&& completionHandler)
    207 {
    208     if (auto player = m_proxies.get(id))
    209         player->load(WTFMove(url), WTFMove(contentType), WTFMove(keySystem), WTFMove(completionHandler));
     206void RemoteMediaPlayerManagerProxy::load(MediaPlayerPrivateRemoteIdentifier id, URL&& url, Optional<SandboxExtension::Handle>&& sandboxExtension, WebCore::ContentType&& contentType, String&& keySystem, CompletionHandler<void(RemoteMediaPlayerConfiguration&&)>&& completionHandler)
     207{
     208    if (auto player = m_proxies.get(id))
     209        player->load(WTFMove(url), WTFMove(sandboxExtension), WTFMove(contentType), WTFMove(keySystem), WTFMove(completionHandler));
    210210}
    211211
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h

    r254098 r254392  
    3131#include "MediaPlayerPrivateRemoteIdentifier.h"
    3232#include "MessageReceiver.h"
     33#include "SandboxExtension.h"
    3334#include <WebCore/MediaPlayer.h>
    3435#include <wtf/LoggerHelper.h>
     
    8384    void supportsKeySystem(WebCore::MediaPlayerEnums::MediaEngineIdentifier, const String&&, const String&&, CompletionHandler<void(bool)>&&);
    8485
    85     void load(MediaPlayerPrivateRemoteIdentifier, URL&&, WebCore::ContentType&&, String&&, CompletionHandler<void(RemoteMediaPlayerConfiguration&&)>&&);
     86    void load(MediaPlayerPrivateRemoteIdentifier, URL&&, Optional<SandboxExtension::Handle>&&, WebCore::ContentType&&, String&&, CompletionHandler<void(RemoteMediaPlayerConfiguration&&)>&&);
    8687    void prepareForPlayback(MediaPlayerPrivateRemoteIdentifier, bool privateMode, WebCore::MediaPlayerEnums::Preload, bool preservesPitch, bool prepareForRendering);
    8788    void cancelLoad(MediaPlayerPrivateRemoteIdentifier);
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in

    r254098 r254392  
    3838    PrepareForPlayback(WebKit::MediaPlayerPrivateRemoteIdentifier id, bool privateMode, enum:uint8_t WebCore::MediaPlayerEnums::Preload preload, bool preservesPitch, bool prepareForRendering)
    3939
    40     Load(WebKit::MediaPlayerPrivateRemoteIdentifier id, URL url, WebCore::ContentType contentType, String keySystem) -> (struct WebKit::RemoteMediaPlayerConfiguration playerConfiguration) Async
     40    Load(WebKit::MediaPlayerPrivateRemoteIdentifier id, URL url, Optional<WebKit::SandboxExtension::Handle> sandboxExtension, WebCore::ContentType contentType, String keySystem) -> (struct WebKit::RemoteMediaPlayerConfiguration playerConfiguration) Async
    4141    CancelLoad(WebKit::MediaPlayerPrivateRemoteIdentifier id)
    4242
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp

    r254098 r254392  
    7070    m_updateCachedStateMessageTimer.stop();
    7171    m_player->invalidate();
     72    if (m_sandboxExtension) {
     73        m_sandboxExtension->revoke();
     74        m_sandboxExtension = nullptr;
     75    }
    7276}
    7377
     
    8387}
    8488
    85 void RemoteMediaPlayerProxy::load(const URL& url, const ContentType& contentType, const String& keySystem, CompletionHandler<void(RemoteMediaPlayerConfiguration&&)>&& completionHandler)
    86 {
     89void RemoteMediaPlayerProxy::load(const URL& url, Optional<SandboxExtension::Handle>&& sandboxExtensionHandle, const ContentType& contentType, const String& keySystem, CompletionHandler<void(RemoteMediaPlayerConfiguration&&)>&& completionHandler)
     90{
     91    RemoteMediaPlayerConfiguration configuration;
     92
     93    if (sandboxExtensionHandle) {
     94        m_sandboxExtension = SandboxExtension::create(WTFMove(sandboxExtensionHandle.value()));
     95        if (m_sandboxExtension)
     96            m_sandboxExtension->consume();
     97        else
     98            WTFLogAlways("Unable to create sandbox extension for media url.\n");
     99    }
     100
    87101    m_player->load(url, contentType, keySystem);
    88 
    89     RemoteMediaPlayerConfiguration configuration;
    90102    getConfiguration(configuration);
    91103    completionHandler(WTFMove(configuration));
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h

    r254098 r254392  
    3434#include "RemoteMediaPlayerState.h"
    3535#include "RemoteMediaResourceIdentifier.h"
     36#include "SandboxExtension.h"
    3637#include <WebCore/Cookie.h>
    3738#include <WebCore/MediaPlayer.h>
     
    6162    void prepareForPlayback(bool privateMode, WebCore::MediaPlayerEnums::Preload, bool preservesPitch, bool prepareForRendering);
    6263
    63     void load(const URL&, const WebCore::ContentType&, const String&, CompletionHandler<void(RemoteMediaPlayerConfiguration&&)>&&);
     64    void load(const URL&, Optional<SandboxExtension::Handle>&&, const WebCore::ContentType&, const String&, CompletionHandler<void(RemoteMediaPlayerConfiguration&&)>&&);
    6465    void cancelLoad();
    6566
     
    187188
    188189    MediaPlayerPrivateRemoteIdentifier m_id;
     190    RefPtr<SandboxExtension> m_sandboxExtension;
    189191    Ref<IPC::Connection> m_webProcessConnection;
    190192    RefPtr<WebCore::MediaPlayer> m_player;
  • trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp

    r254259 r254392  
    11/*
    2  * Copyright (C) 2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4848#endif
    4949
    50 #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, connection())
     50#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, this->connection())
    5151
    5252namespace WebKit {
     
    126126void GPUProcessProxy::openGPUProcessConnection(ConnectionRequestIdentifier connectionRequestIdentifier, WebProcessProxy& webProcessProxy)
    127127{
    128     connection()->sendWithAsyncReply(Messages::GPUProcess::CreateGPUConnectionToWebProcess { webProcessProxy.coreProcessIdentifier(), webProcessProxy.sessionID() }, [this, weakThis = makeWeakPtr(this), webProcessProxy = makeWeakPtr(webProcessProxy), connectionRequestIdentifier](auto&& connectionIdentifier) mutable {
     128    auto& connection = *this->connection();
     129
     130    connection.sendWithAsyncReply(Messages::GPUProcess::CreateGPUConnectionToWebProcess { webProcessProxy.coreProcessIdentifier(), webProcessProxy.sessionID() }, [this, weakThis = makeWeakPtr(this), webProcessProxy = makeWeakPtr(webProcessProxy), connectionRequestIdentifier](auto&& connectionIdentifier) mutable {
    129131        if (!weakThis)
    130132            return;
     
    143145#elif OS(DARWIN)
    144146        MESSAGE_CHECK(MACH_PORT_VALID(connectionIdentifier->port()));
    145         request.reply(GPUProcessConnectionInfo { IPC::Attachment { connectionIdentifier->port(), MACH_MSG_TYPE_MOVE_SEND } });
     147        request.reply(GPUProcessConnectionInfo { IPC::Attachment { connectionIdentifier->port(), MACH_MSG_TYPE_MOVE_SEND }, this->connection()->getAuditToken() });
    146148#else
    147149        notImplemented();
  • trunk/Source/WebKit/UIProcess/GPU/GPUProcessProxy.h

    r254259 r254392  
    11/*
    2  * Copyright (C) 2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333#include "ProcessThrottler.h"
    3434#include "ProcessThrottlerClient.h"
    35 #include "TransactionID.h"
    3635#include "WebPageProxyIdentifier.h"
    3736#include "WebProcessProxyMessagesReplies.h"
    3837#include <memory>
    39 #include <wtf/Deque.h>
    4038
    4139namespace WebKit {
     
    9795    ProcessThrottler m_throttler;
    9896    ProcessThrottler::ActivityVariant m_activityFromWebProcesses;
    99 
    10097#if ENABLE(MEDIA_STREAM)
    10198    bool m_useMockCaptureDevices { false };
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp

    r253705 r254392  
    11/*
    2  * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.h

    r253984 r254392  
    11/*
    2  * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r253484 r254392  
    3232#include "AuthenticatorManager.h"
    3333#include "DeviceIdHashSaltStorage.h"
     34#include "GPUProcessProxy.h"
    3435#include "MockAuthenticatorManager.h"
    3536#include "NetworkProcessMessages.h"
  • trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnection.h

    r253964 r254392  
    4848    IPC::Connection& connection() { return m_connection.get(); }
    4949
     50#if HAVE(AUDIT_TOKEN)
     51    void setAuditToken(Optional<audit_token_t> auditToken) { m_auditToken = auditToken; }
     52    Optional<audit_token_t> auditToken() const { return m_auditToken; }
     53#endif
     54
    5055private:
    5156    GPUProcessConnection(IPC::Connection::Identifier);
     
    5863    // The connection from the web process to the GPU process.
    5964    Ref<IPC::Connection> m_connection;
     65
     66#if HAVE(AUDIT_TOKEN)
     67    Optional<audit_token_t> m_auditToken;
     68#endif
    6069};
    6170
  • trunk/Source/WebKit/WebProcess/GPU/GPUProcessConnectionInfo.h

    r253941 r254392  
    3232struct GPUProcessConnectionInfo {
    3333    IPC::Attachment connection;
     34#if HAVE(AUDIT_TOKEN)
     35    Optional<audit_token_t> auditToken;
     36#endif
    3437
    3538    IPC::Connection::Identifier identifier()
     
    6164    {
    6265        encoder << connection;
     66#if HAVE(AUDIT_TOKEN)
     67        encoder << auditToken;
     68#endif
    6369    }
    6470   
     
    6773        if (!decoder.decode(info.connection))
    6874            return false;
     75#if HAVE(AUDIT_TOKEN)
     76        if (!decoder.decode(info.auditToken))
     77            return false;
     78#endif
    6979        return true;
    7080    }
  • trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp

    r254214 r254392  
    11/*
    2  * Copyright (C) 2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131#include "Logging.h"
    3232#include "RemoteMediaPlayerManagerProxyMessages.h"
     33#include "SandboxExtension.h"
    3334#include "WebCoreArgumentCoders.h"
     35#include "WebProcess.h"
    3436#include <WebCore/MediaPlayer.h>
    3537#include <WebCore/NotImplemented.h>
     
    8587void MediaPlayerPrivateRemote::prepareForPlayback(bool privateMode, MediaPlayer::Preload preload, bool preservesPitch, bool prepare)
    8688{
    87     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::PrepareForPlayback(m_id, privateMode, preload, preservesPitch, prepare), 0);
     89    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::PrepareForPlayback(m_id, privateMode, preload, preservesPitch, prepare), 0);
    8890}
    8991
    9092void MediaPlayerPrivateRemote::MediaPlayerPrivateRemote::load(const URL& url, const ContentType& contentType, const String& keySystem)
    9193{
    92     m_manager.gpuProcessConnection().sendWithAsyncReply(Messages::RemoteMediaPlayerManagerProxy::Load(m_id, url, contentType, keySystem), [weakThis = makeWeakPtr(*this)](auto&& configuration) {
     94    auto& connection = m_manager.gpuProcessConnection().connection();
     95    Optional<SandboxExtension::Handle> sandboxExtensionHandle;
     96    if (url.isLocalFile()) {
     97        SandboxExtension::Handle handle;
     98        auto fileSystemPath = url.fileSystemPath();
     99        bool createdExtension = false;
     100
     101#if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_AUDIT_TOKEN)
     102        auto auditToken = m_manager.gpuProcessConnection().auditToken();
     103        ASSERT(auditToken);
     104        if (auditToken)
     105            createdExtension = SandboxExtension::createHandleForReadByAuditToken(fileSystemPath, auditToken.value(), handle);
     106        else
     107#endif
     108        createdExtension = SandboxExtension::createHandle(fileSystemPath, SandboxExtension::Type::ReadOnly, handle);
     109
     110        if (!createdExtension) {
     111            WTFLogAlways("Unable to create sandbox extension handle for GPUProcess url.\n");
     112            m_cachedState.networkState = MediaPlayer::NetworkState::FormatError;
     113            m_player->networkStateChanged();
     114            return;
     115        }
     116
     117        sandboxExtensionHandle = WTFMove(handle);
     118    }
     119
     120    connection.sendWithAsyncReply(Messages::RemoteMediaPlayerManagerProxy::Load(m_id, url, sandboxExtensionHandle, contentType, keySystem), [weakThis = makeWeakPtr(*this)](auto&& configuration) {
    93121        if (weakThis)
    94122            weakThis->m_configuration = configuration;
     
    98126void MediaPlayerPrivateRemote::cancelLoad()
    99127{
    100     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::CancelLoad(m_id), 0);
     128    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::CancelLoad(m_id), 0);
    101129}
    102130
    103131void MediaPlayerPrivateRemote::prepareToPlay()
    104132{
    105     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::PrepareToPlay(m_id), 0);
     133    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::PrepareToPlay(m_id), 0);
    106134}
    107135
     
    109137{
    110138    m_cachedState.paused = false;
    111     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::Play(m_id), 0);
     139    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::Play(m_id), 0);
    112140}
    113141
     
    115143{
    116144    m_cachedState.paused = true;
    117     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::Pause(m_id), 0);
     145    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::Pause(m_id), 0);
    118146}
    119147
    120148void MediaPlayerPrivateRemote::setPreservesPitch(bool preservesPitch)
    121149{
    122     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetPreservesPitch(m_id, preservesPitch), 0);
     150    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetPreservesPitch(m_id, preservesPitch), 0);
    123151}
    124152
    125153void MediaPlayerPrivateRemote::setVolumeDouble(double volume)
    126154{
    127     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetVolume(m_id, volume), 0);
     155    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetVolume(m_id, volume), 0);
    128156}
    129157
    130158void MediaPlayerPrivateRemote::setMuted(bool muted)
    131159{
    132     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetMuted(m_id, muted), 0);
     160    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetMuted(m_id, muted), 0);
    133161}
    134162
    135163void MediaPlayerPrivateRemote::setPreload(MediaPlayer::Preload preload)
    136164{
    137     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetPreload(m_id, preload), 0);
     165    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetPreload(m_id, preload), 0);
    138166}
    139167
    140168void MediaPlayerPrivateRemote::setPrivateBrowsingMode(bool privateMode)
    141169{
    142     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetPrivateBrowsingMode(m_id, privateMode), 0);
     170    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetPrivateBrowsingMode(m_id, privateMode), 0);
    143171}
    144172
     
    151179{
    152180    m_seeking = true;
    153     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::Seek(m_id, time), 0);
     181    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::Seek(m_id, time), 0);
    154182}
    155183
     
    157185{
    158186    m_seeking = true;
    159     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SeekWithTolerance(m_id, time, negativeTolerance, positiveTolerance), 0);
     187    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SeekWithTolerance(m_id, time, negativeTolerance, positiveTolerance), 0);
    160188}
    161189
     
    314342void MediaPlayerPrivateRemote::prepareForRendering()
    315343{
    316     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::PrepareForRendering(m_id), 0);
     344    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::PrepareForRendering(m_id), 0);
    317345}
    318346
    319347void MediaPlayerPrivateRemote::setSize(const WebCore::IntSize& size)
    320348{
    321     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetSize(m_id, size), 0);
     349    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetSize(m_id, size), 0);
    322350}
    323351
    324352void MediaPlayerPrivateRemote::setVisible(bool visible)
    325353{
    326     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetVisible(m_id, visible), 0);
     354    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetVisible(m_id, visible), 0);
    327355}
    328356
    329357void MediaPlayerPrivateRemote::setShouldMaintainAspectRatio(bool maintainRatio)
    330358{
    331     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetShouldMaintainAspectRatio(m_id, maintainRatio), 0);
     359    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetShouldMaintainAspectRatio(m_id, maintainRatio), 0);
    332360}
    333361
    334362void MediaPlayerPrivateRemote::setVideoFullscreenFrame(WebCore::FloatRect rect)
    335363{
    336     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetVideoFullscreenFrame(m_id, rect), 0);
     364    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetVideoFullscreenFrame(m_id, rect), 0);
    337365}
    338366
    339367void MediaPlayerPrivateRemote::setVideoFullscreenGravity(WebCore::MediaPlayerEnums::VideoGravity gravity)
    340368{
    341     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetVideoFullscreenGravity(m_id, gravity), 0);
     369    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetVideoFullscreenGravity(m_id, gravity), 0);
    342370}
    343371
    344372void MediaPlayerPrivateRemote::acceleratedRenderingStateChanged()
    345373{
    346     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::AcceleratedRenderingStateChanged(m_id, m_player->supportsAcceleratedRendering()), 0);
     374    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::AcceleratedRenderingStateChanged(m_id, m_player->supportsAcceleratedRendering()), 0);
    347375}
    348376
    349377void MediaPlayerPrivateRemote::setShouldDisableSleep(bool disable)
    350378{
    351     m_manager.gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::SetShouldDisableSleep(m_id, disable), 0);
     379    m_manager.gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::SetShouldDisableSleep(m_id, disable), 0);
    352380}
    353381
     
    814842    auto resource = m_mediaResourceLoader->requestResource(WTFMove(request), options);
    815843    // PlatformMediaResource owns the PlatformMediaResourceClient
    816     resource->setClient(makeUnique<RemoteMediaResourceProxy>(m_manager.gpuProcessConnection(), *resource, remoteMediaResourceIdentifier));
     844    resource->setClient(makeUnique<RemoteMediaResourceProxy>(m_manager.gpuProcessConnection().connection(), *resource, remoteMediaResourceIdentifier));
    817845    m_mediaResources.add(remoteMediaResourceIdentifier, WTFMove(resource));
    818846}
  • trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h

    r254214 r254392  
    11/*
    2  * Copyright (C) 2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
  • trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerMIMETypeCache.cpp

    r254048 r254392  
    8888{
    8989    bool result;
    90     if (!m_manager.gpuProcessConnection().sendSync(Messages::RemoteMediaPlayerManagerProxy::CanDecodeExtendedType(m_engineIdentifier, type.raw()), Messages::RemoteMediaPlayerManagerProxy::CanDecodeExtendedType::Reply(result), 0))
     90    if (!m_manager.gpuProcessConnection().connection().sendSync(Messages::RemoteMediaPlayerManagerProxy::CanDecodeExtendedType(m_engineIdentifier, type.raw()), Messages::RemoteMediaPlayerManagerProxy::CanDecodeExtendedType::Reply(result), 0))
    9191        return false;
    9292
     
    109109
    110110    MediaPlayer::SupportsType result;
    111     if (!m_manager.gpuProcessConnection().sendSync(Messages::RemoteMediaPlayerManagerProxy::SupportsTypeAndCodecs(m_engineIdentifier, parameters), Messages::RemoteMediaPlayerManagerProxy::SupportsTypeAndCodecs::Reply(result), 0))
     111    if (!m_manager.gpuProcessConnection().connection().sendSync(Messages::RemoteMediaPlayerManagerProxy::SupportsTypeAndCodecs(m_engineIdentifier, parameters), Messages::RemoteMediaPlayerManagerProxy::SupportsTypeAndCodecs::Reply(result), 0))
    112112        return MediaPlayer::SupportsType::IsNotSupported;
    113113
     
    126126
    127127    Vector<String> types;
    128     if (!m_manager.gpuProcessConnection().sendSync(Messages::RemoteMediaPlayerManagerProxy::GetSupportedTypes(m_engineIdentifier), Messages::RemoteMediaPlayerManagerProxy::GetSupportedTypes::Reply(types), 0))
     128    if (!m_manager.gpuProcessConnection().connection().sendSync(Messages::RemoteMediaPlayerManagerProxy::GetSupportedTypes(m_engineIdentifier), Messages::RemoteMediaPlayerManagerProxy::GetSupportedTypes::Reply(types), 0))
    129129        return;
    130130
  • trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp

    r254098 r254392  
    2929#if ENABLE(GPU_PROCESS)
    3030
    31 #include "GPUProcessConnection.h"
    3231#include "MediaPlayerPrivateRemote.h"
    3332#include "RemoteMediaPlayerConfiguration.h"
     
    165164
    166165    RemoteMediaPlayerConfiguration playerConfiguration;
    167     bool sendSucceeded = gpuProcessConnection().sendSync(Messages::RemoteMediaPlayerManagerProxy::CreateMediaPlayer(id, remoteEngineIdentifier, proxyConfiguration), Messages::RemoteMediaPlayerManagerProxy::CreateMediaPlayer::Reply(playerConfiguration), 0);
     166    bool sendSucceeded = gpuProcessConnection().connection().sendSync(Messages::RemoteMediaPlayerManagerProxy::CreateMediaPlayer(id, remoteEngineIdentifier, proxyConfiguration), Messages::RemoteMediaPlayerManagerProxy::CreateMediaPlayer::Reply(playerConfiguration), 0);
    168167    if (!sendSucceeded) {
    169168        WTFLogAlways("Failed to create remote media player.");
     
    179178{
    180179    m_players.take(id);
    181     gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::DeleteMediaPlayer(id), 0);
     180    gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::DeleteMediaPlayer(id), 0);
    182181}
    183182
     
    193192
    194193    Vector<String> types;
    195     if (!gpuProcessConnection().sendSync(Messages::RemoteMediaPlayerManagerProxy::GetSupportedTypes(remoteEngineIdentifier), Messages::RemoteMediaPlayerManagerProxy::GetSupportedTypes::Reply(types), 0))
     194    if (!gpuProcessConnection().connection().sendSync(Messages::RemoteMediaPlayerManagerProxy::GetSupportedTypes(remoteEngineIdentifier), Messages::RemoteMediaPlayerManagerProxy::GetSupportedTypes::Reply(types), 0))
    196195        return;
    197196
     
    215214{
    216215    Vector<SecurityOriginData> originData;
    217     if (!gpuProcessConnection().sendSync(Messages::RemoteMediaPlayerManagerProxy::OriginsInMediaCache(remoteEngineIdentifier, path), Messages::RemoteMediaPlayerManagerProxy::OriginsInMediaCache::Reply(originData), 0))
     216    if (!gpuProcessConnection().connection().sendSync(Messages::RemoteMediaPlayerManagerProxy::OriginsInMediaCache(remoteEngineIdentifier, path), Messages::RemoteMediaPlayerManagerProxy::OriginsInMediaCache::Reply(originData), 0))
    218217        return { };
    219218
     
    227226void RemoteMediaPlayerManager::clearMediaCache(MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier, const String& path, WallTime modifiedSince)
    228227{
    229     gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::ClearMediaCache(remoteEngineIdentifier, path, modifiedSince), 0);
     228    gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::ClearMediaCache(remoteEngineIdentifier, path, modifiedSince), 0);
    230229}
    231230
     
    236235    });
    237236
    238     gpuProcessConnection().send(Messages::RemoteMediaPlayerManagerProxy::ClearMediaCacheForOrigins(remoteEngineIdentifier, path, originData), 0);
     237    gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::ClearMediaCacheForOrigins(remoteEngineIdentifier, path, originData), 0);
    239238}
    240239
     
    334333}
    335334
    336 IPC::Connection& RemoteMediaPlayerManager::gpuProcessConnection() const
    337 {
    338     return WebProcess::singleton().ensureGPUProcessConnection().connection();
     335GPUProcessConnection& RemoteMediaPlayerManager::gpuProcessConnection() const
     336{
     337    if (!m_gpuProcessConnection)
     338        m_gpuProcessConnection = &WebProcess::singleton().ensureGPUProcessConnection();
     339
     340    return *m_gpuProcessConnection;
    339341}
    340342
  • trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.h

    r254098 r254392  
    11/*
    2  * Copyright (C) 2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2019-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828#if ENABLE(GPU_PROCESS)
    2929
     30#include "GPUProcessConnection.h"
    3031#include "MediaPlayerPrivateRemoteIdentifier.h"
    3132#include "MessageReceiver.h"
     
    5556
    5657    static const char* supplementName();
     58    WebProcess& parentProcess() const { return m_process; }
    5759
    5860    void updatePreferences(const WebCore::Settings&);
    5961
    60     IPC::Connection& gpuProcessConnection() const;
     62    GPUProcessConnection& gpuProcessConnection() const;
    6163
    6264    void didReceiveMessageFromGPUProcess(IPC::Connection& connection, IPC::Decoder& decoder) { didReceiveMessage(connection, decoder); }
     
    102104    HashMap<MediaPlayerPrivateRemoteIdentifier, WeakPtr<MediaPlayerPrivateRemote>> m_players;
    103105    WebProcess& m_process;
     106    mutable GPUProcessConnection* m_gpuProcessConnection { nullptr };
    104107};
    105108
  • trunk/Source/WebKit/WebProcess/WebProcess.cpp

    r254347 r254392  
    11/*
    2  * Copyright (C) 2009-2019 Apple Inc. All rights reserved.
     2 * Copyright (C) 2009-2020 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    13001300
    13011301        m_gpuProcessConnection = GPUProcessConnection::create(connectionInfo.releaseIdentifier());
     1302#if HAVE(AUDIT_TOKEN)
     1303        ASSERT(connectionInfo.auditToken);
     1304        m_gpuProcessConnection->setAuditToken(WTFMove(connectionInfo.auditToken));
     1305#endif
    13021306    }
    13031307   
Note: See TracChangeset for help on using the changeset viewer.