Source/WebKit/ChangeLog

 12019-12-19 Peng Liu <peng.liu6@apple.com>
 2
 3 Add remote media resource loader for the GPU process
 4 https://bugs.webkit.org/show_bug.cgi?id=205379
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Add RemoteMediaResourceLoader, RemoteMediaResource, and RemoteMediaResourceManager in the GPU process for media,
 9 and RemoteMediaResourceProxy in the Web process.
 10 Disable unified build of all the cpp files for media in GPU because of a strange issue related to duplicated "Fixed" keyword definition.
 11 This patch uses XPC messages to transfer media data, which is not efficient.
 12
 13 Covered by existing tests.
 14
 15 * DerivedSources-input.xcfilelist:
 16 * DerivedSources-output.xcfilelist:
 17 * DerivedSources.make:
 18 * GPUProcess/GPUConnectionToWebProcess.cpp:
 19 (WebKit::GPUConnectionToWebProcess::remoteMediaResourceManager):
 20 (WebKit::GPUConnectionToWebProcess::remoteMediaPlayerManagerProxy):
 21 (WebKit::GPUConnectionToWebProcess::didReceiveMessage):
 22 * GPUProcess/GPUConnectionToWebProcess.h:
 23 * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
 24 (WebKit::RemoteMediaPlayerManagerProxy::RemoteMediaPlayerManagerProxy):
 25 (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer):
 26 (WebKit::RemoteMediaPlayerManagerProxy::logChannel const):
 27 * GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
 28 * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
 29 (WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy):
 30 (WebKit::RemoteMediaPlayerProxy::mediaPlayerCreateResourceLoader):
 31 * GPUProcess/media/RemoteMediaPlayerProxy.h:
 32 (WebKit::RemoteMediaPlayerProxy::WebProcessConnection):
 33 * GPUProcess/media/RemoteMediaResource.cpp: Added.
 34 (WebKit::RemoteMediaResource::create):
 35 (WebKit::RemoteMediaResource::RemoteMediaResource):
 36 (WebKit::RemoteMediaResource::~RemoteMediaResource):
 37 (WebKit::RemoteMediaResource::stop):
 38 (WebKit::RemoteMediaResource::didPassAccessControlCheck const):
 39 (WebKit::RemoteMediaResource::responseReceived):
 40 (WebKit::RemoteMediaResource::redirectReceived):
 41 (WebKit::RemoteMediaResource::shouldCacheResponse):
 42 (WebKit::RemoteMediaResource::dataSent):
 43 (WebKit::RemoteMediaResource::dataReceived):
 44 (WebKit::RemoteMediaResource::accessControlCheckFailed):
 45 (WebKit::RemoteMediaResource::loadFailed):
 46 (WebKit::RemoteMediaResource::loadFinished):
 47 * GPUProcess/media/RemoteMediaResource.h: Added.
 48 (WebKit::RemoteMediaResource::ready):
 49 (WebKit::RemoteMediaResource::setReady):
 50 * GPUProcess/media/RemoteMediaResourceIdentifier.h: Added.
 51 * GPUProcess/media/RemoteMediaResourceLoader.cpp: Added.
 52 (WebKit::RemoteMediaResourceLoader::RemoteMediaResourceLoader):
 53 (WebKit::RemoteMediaResourceLoader::~RemoteMediaResourceLoader):
 54 (WebKit::RemoteMediaResourceLoader::requestResource):
 55 * GPUProcess/media/RemoteMediaResourceLoader.h: Added.
 56 * GPUProcess/media/RemoteMediaResourceManager.cpp: Added.
 57 (WebKit::RemoteMediaResourceManager::RemoteMediaResourceManager):
 58 (WebKit::RemoteMediaResourceManager::~RemoteMediaResourceManager):
 59 (WebKit::RemoteMediaResourceManager::addMediaResource):
 60 (WebKit::RemoteMediaResourceManager::removeMediaResource):
 61 (WebKit::RemoteMediaResourceManager::responseReceived):
 62 (WebKit::RemoteMediaResourceManager::redirectReceived):
 63 (WebKit::RemoteMediaResourceManager::dataSent):
 64 (WebKit::RemoteMediaResourceManager::dataReceived):
 65 (WebKit::RemoteMediaResourceManager::accessControlCheckFailed):
 66 (WebKit::RemoteMediaResourceManager::loadFailed):
 67 (WebKit::RemoteMediaResourceManager::loadFinished):
 68 * GPUProcess/media/RemoteMediaResourceManager.h: Added.
 69 * GPUProcess/media/RemoteMediaResourceManager.messages.in: Added.
 70 * Platform/Logging.h:
 71 * Scripts/webkit/messages.py:
 72 * Sources.txt:
 73 * SourcesCocoa.txt:
 74 * WebKit.xcodeproj/project.pbxproj:
 75 * WebProcess/GPU/GPUProcessConnection.cpp:
 76 (WebKit::GPUProcessConnection::didReceiveMessage):
 77 * WebProcess/GPU/GPUProcessConnection.h:
 78 * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
 79 (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote):
 80 (WebKit::MediaPlayerPrivateRemote::requestResource):
 81 * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
 82 * WebProcess/GPU/media/MediaPlayerPrivateRemoteIdentifier.h:
 83 * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
 84 (WebKit::RemoteMediaPlayerManager::volumeChanged):
 85 (WebKit::RemoteMediaPlayerManager::muteChanged):
 86 (WebKit::RemoteMediaPlayerManager::timeChanged):
 87 (WebKit::RemoteMediaPlayerManager::durationChanged):
 88 (WebKit::RemoteMediaPlayerManager::rateChanged):
 89 (WebKit::RemoteMediaPlayerManager::playbackStateChanged):
 90 (WebKit::RemoteMediaPlayerManager::requestResource):
 91 * WebProcess/GPU/media/RemoteMediaPlayerManager.h:
 92 (WebKit::RemoteMediaPlayerManager::didReceiveMessageFromGPUProcess):
 93 (WebKit::RemoteMediaPlayerManager::didReceiveMessageFromWebProcess): Deleted.
 94 * WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in:
 95 * WebProcess/GPU/media/RemoteMediaResourceProxy.cpp: Added.
 96 (WebKit::RemoteMediaResourceProxy::RemoteMediaResourceProxy):
 97 (WebKit::RemoteMediaResourceProxy::~RemoteMediaResourceProxy):
 98 (WebKit::RemoteMediaResourceProxy::responseReceived):
 99 (WebKit::RemoteMediaResourceProxy::redirectReceived):
 100 (WebKit::RemoteMediaResourceProxy::shouldCacheResponse):
 101 (WebKit::RemoteMediaResourceProxy::dataSent):
 102 (WebKit::RemoteMediaResourceProxy::dataReceived):
 103 (WebKit::RemoteMediaResourceProxy::accessControlCheckFailed):
 104 (WebKit::RemoteMediaResourceProxy::loadFailed):
 105 (WebKit::RemoteMediaResourceProxy::loadFinished):
 106 * WebProcess/GPU/media/RemoteMediaResourceProxy.h: Added.
 107
11082019-12-19 Brent Fulgham <bfulgham@apple.com>
2109
3110 Log telemetry for IOUserClient lookups

Source/WebKit/DerivedSources-input.xcfilelist

@@$(PROJECT_DIR)/GPUProcess/GPUConnectionToWebProcess.messages.in
1717$(PROJECT_DIR)/GPUProcess/GPUProcess.messages.in
1818$(PROJECT_DIR)/GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in
1919$(PROJECT_DIR)/GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in
 20$(PROJECT_DIR)/GPUProcess/media/RemoteMediaResourceManager.messages.in
2021$(PROJECT_DIR)/NetworkProcess/Cookies/WebCookieManager.messages.in
2122$(PROJECT_DIR)/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in
2223$(PROJECT_DIR)/NetworkProcess/IndexedDB/WebIDBServer.messages.in

Source/WebKit/DerivedSources-output.xcfilelist

@@$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteMediaPlayerManagerMessagesRep
120120$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteMediaPlayerManagerProxyMessageReceiver.cpp
121121$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteMediaPlayerManagerProxyMessages.h
122122$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteMediaPlayerManagerProxyMessagesReplies.h
 123$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteMediaResourceManagerMessageReceiver.cpp
 124$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteMediaResourceManagerMessages.h
 125$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteMediaResourceManagerMessagesReplies.h
123126$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteObjectRegistryMessageReceiver.cpp
124127$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteObjectRegistryMessages.h
125128$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteObjectRegistryMessagesReplies.h

Source/WebKit/DerivedSources.make

@@MESSAGE_RECEIVERS = \
139139 RemoteLayerTreeDrawingAreaProxy \
140140 RemoteMediaPlayerManager \
141141 RemoteMediaPlayerManagerProxy \
 142 RemoteMediaResourceManager \
142143 RemoteObjectRegistry \
143144 RemoteScrollingCoordinator \
144145 RemoteWebInspectorProxy \

Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp

3737#include "RemoteLayerTreeDrawingAreaProxyMessages.h"
3838#include "RemoteMediaPlayerManagerProxy.h"
3939#include "RemoteMediaPlayerManagerProxyMessages.h"
 40#include "RemoteMediaResourceManagerMessages.h"
4041#include "RemoteScrollingCoordinatorTransaction.h"
4142#include "UserMediaCaptureManagerProxy.h"
4243#include "UserMediaCaptureManagerProxyMessages.h"

@@void GPUConnectionToWebProcess::didReceiveInvalidMessage(IPC::Connection& connec
9899 CRASH();
99100}
100101
 102RemoteMediaResourceManager& GPUConnectionToWebProcess::remoteMediaResourceManager()
 103{
 104 if (!m_remoteMediaResourceManager)
 105 m_remoteMediaResourceManager = makeUnique<RemoteMediaResourceManager>();
 106
 107 return *m_remoteMediaResourceManager;
 108}
 109
101110RemoteMediaPlayerManagerProxy& GPUConnectionToWebProcess::remoteMediaPlayerManagerProxy()
102111{
103112 if (!m_remoteMediaPlayerManagerProxy)
104  m_remoteMediaPlayerManagerProxy = makeUnique<RemoteMediaPlayerManagerProxy>(*this);
 113 m_remoteMediaPlayerManagerProxy = makeUnique<RemoteMediaPlayerManagerProxy>(*this, remoteMediaResourceManager());
105114
106115 return *m_remoteMediaPlayerManagerProxy;
107116}

@@void GPUConnectionToWebProcess::didReceiveMessage(IPC::Connection& connection, I
121130 if (decoder.messageReceiverName() == Messages::RemoteMediaPlayerManagerProxy::messageReceiverName()) {
122131 remoteMediaPlayerManagerProxy().didReceiveMessageFromWebProcess(connection, decoder);
123132 return;
 133 } else if (decoder.messageReceiverName() == Messages::RemoteMediaResourceManager::messageReceiverName()) {
 134 remoteMediaResourceManager().didReceiveMessage(connection, decoder);
 135 return;
124136 }
125137#if ENABLE(MEDIA_STREAM)
126138 if (decoder.messageReceiverName() == Messages::UserMediaCaptureManagerProxy::messageReceiverName()) {

Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h

@@namespace WebKit {
3939class GPUProcess;
4040class RemoteMediaPlayerManagerProxy;
4141class UserMediaCaptureManagerProxy;
 42class RemoteMediaResourceManager;
4243
4344class GPUConnectionToWebProcess
4445 : public RefCounted<GPUConnectionToWebProcess>

@@public:
5859private:
5960 GPUConnectionToWebProcess(GPUProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier);
6061
 62 RemoteMediaResourceManager& remoteMediaResourceManager();
6163 RemoteMediaPlayerManagerProxy& remoteMediaPlayerManagerProxy();
6264#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
6365 UserMediaCaptureManagerProxy& userMediaCaptureManagerProxy();

@@private:
7274 Ref<IPC::Connection> m_connection;
7375 Ref<GPUProcess> m_gpuProcess;
7476 const WebCore::ProcessIdentifier m_webProcessIdentifier;
 77 std::unique_ptr<RemoteMediaResourceManager> m_remoteMediaResourceManager;
7578 std::unique_ptr<RemoteMediaPlayerManagerProxy> m_remoteMediaPlayerManagerProxy;
7679#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
7780 std::unique_ptr<UserMediaCaptureManagerProxy> m_userMediaCaptureManagerProxy;

Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp

2929#if ENABLE(GPU_PROCESS)
3030
3131#include "GPUConnectionToWebProcess.h"
 32#include "Logging.h"
3233#include "RemoteMediaPlayerManagerMessages.h"
3334#include "RemoteMediaPlayerManagerProxyMessages.h"
3435#include "RemoteMediaPlayerProxy.h"
 36#include "RemoteMediaResourceManager.h"
3537#include "WebCoreArgumentCoders.h"
3638#include <WebCore/MediaPlayer.h>
3739#include <WebCore/MediaPlayerPrivate.h>

4042#define MESSAGE_CHECK_CONTEXTID(identifier) MESSAGE_CHECK_BASE(m_proxies.isValidKey(identifier), &m_gpuConnectionToWebProcess.connection())
4143
4244namespace WebKit {
 45
4346using namespace WebCore;
4447
4548#if !RELEASE_LOG_DISABLED

@@static RefPtr<Logger>& nullLogger()
5053}
5154#endif
5255
53 RemoteMediaPlayerManagerProxy::RemoteMediaPlayerManagerProxy(GPUConnectionToWebProcess& connection)
 56RemoteMediaPlayerManagerProxy::RemoteMediaPlayerManagerProxy(GPUConnectionToWebProcess& connection, RemoteMediaResourceManager& remoteMediaResourceManager)
5457 : m_gpuConnectionToWebProcess(connection)
 58 , m_remoteMediaResourceManager(remoteMediaResourceManager)
5559#if !RELEASE_LOG_DISABLED
5660 , m_logIdentifier(WTF::LoggerHelper::uniqueLogIdentifier())
5761#endif

@@void RemoteMediaPlayerManagerProxy::createMediaPlayer(MediaPlayerPrivateRemoteId
6771 MESSAGE_CHECK_CONTEXTID(id);
6872
6973 ASSERT(!m_proxies.contains(id));
70  m_proxies.add(id, makeUnique<RemoteMediaPlayerProxy>(*this, id, m_gpuConnectionToWebProcess.connection(), engineIdentifier));
 74 m_proxies.add(id, makeUnique<RemoteMediaPlayerProxy>(*this, m_remoteMediaResourceManager, id, m_gpuConnectionToWebProcess.connection(), engineIdentifier));
7175
7276 completionHandler(true);
7377}

@@const Logger& RemoteMediaPlayerManagerProxy::logger() const
246250
247251WTFLogChannel& RemoteMediaPlayerManagerProxy::logChannel() const
248252{
249  return WebKit2LogWebRTC;
 253 return WebKit2LogMedia;
250254}
251255#endif
252256
253 }
 257} // namespace WebKit
254258
255259#undef MESSAGE_CHECK_CONTEXTID
256260

Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h

3030#include "Connection.h"
3131#include "MediaPlayerPrivateRemoteIdentifier.h"
3232#include "MessageReceiver.h"
 33#include "RemoteMediaResourceManager.h"
3334#include <WebCore/MediaPlayer.h>
3435#include <wtf/LoggerHelper.h>
3536
3637namespace WebKit {
3738
3839class GPUConnectionToWebProcess;
 40class RemoteMediaResourceManager;
3941class RemoteMediaPlayerProxy;
4042
4143class RemoteMediaPlayerManagerProxy

@@class RemoteMediaPlayerManagerProxy
4648{
4749 WTF_MAKE_FAST_ALLOCATED;
4850public:
49  explicit RemoteMediaPlayerManagerProxy(GPUConnectionToWebProcess&);
 51 explicit RemoteMediaPlayerManagerProxy(GPUConnectionToWebProcess&, RemoteMediaResourceManager&);
5052 ~RemoteMediaPlayerManagerProxy();
5153
5254 GPUConnectionToWebProcess& gpuConnectionToWebProcess() const { return m_gpuConnectionToWebProcess; }

@@private:
9597
9698 HashMap<MediaPlayerPrivateRemoteIdentifier, std::unique_ptr<RemoteMediaPlayerProxy>> m_proxies;
9799 GPUConnectionToWebProcess& m_gpuConnectionToWebProcess;
 100 RemoteMediaResourceManager& m_remoteMediaResourceManager;
98101
99102#if !RELEASE_LOG_DISABLED
100103 const void* m_logIdentifier;
101104#endif
102105};
103106
104 }
 107} // namespace WebKit
105108
106109#endif

Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp

2828
2929#if ENABLE(GPU_PROCESS)
3030
 31#include "RemoteMediaPlayerManagerMessages.h"
3132#include "RemoteMediaPlayerManagerProxy.h"
 33#include "RemoteMediaResourceLoader.h"
3234#include <WebCore/MediaPlayer.h>
3335#include <WebCore/MediaPlayerPrivate.h>
3436#include <WebCore/NotImplemented.h>

@@namespace WebKit {
3739
3840using namespace WebCore;
3941
40 RemoteMediaPlayerProxy::RemoteMediaPlayerProxy(RemoteMediaPlayerManagerProxy& manager, MediaPlayerPrivateRemoteIdentifier id, Ref<IPC::Connection>&& connection, MediaPlayerEnums::MediaEngineIdentifier engineIdentifier)
 42RemoteMediaPlayerProxy::RemoteMediaPlayerProxy(RemoteMediaPlayerManagerProxy& manager, RemoteMediaResourceManager& mediaResourceManager, MediaPlayerPrivateRemoteIdentifier id, Ref<IPC::Connection>&& connection, MediaPlayerEnums::MediaEngineIdentifier engineIdentifier)
4143 : m_id(id)
4244 , m_webProcessConnection(WTFMove(connection))
4345 , m_manager(manager)
 46 , m_mediaResourceManager(mediaResourceManager)
4447 , m_engineIdentifier(engineIdentifier)
4548#if !RELEASE_LOG_DISABLED
4649 , m_logger(m_manager.logger())

@@CachedResourceLoader* RemoteMediaPlayerProxy::mediaPlayerCachedResourceLoader()
313316
314317RefPtr<PlatformMediaResourceLoader> RemoteMediaPlayerProxy::mediaPlayerCreateResourceLoader()
315318{
316  notImplemented();
317  return nullptr;
 319 return adoptRef(*new RemoteMediaResourceLoader(m_id, *this, m_mediaResourceManager));
318320}
319321
320322bool RemoteMediaPlayerProxy::doesHaveAttribute(const AtomString&, AtomString*) const

Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h

2727
2828#if ENABLE(GPU_PROCESS)
2929
 30#include "Connection.h"
3031#include "MediaPlayerPrivateRemoteIdentifier.h"
 32#include "RemoteMediaResourceManager.h"
 33#include "WebCore/Cookie.h"
3134#include <wtf/LoggerHelper.h>
3235#include <wtf/RefPtr.h>
3336#include <wtf/Vector.h>
3437
35 namespace IPC {
36 class Connection;
37 }
38 
39 namespace WebCore {
40 class MediaPlayer;
41 }
42 
4338namespace WebKit {
4439
4540class RemoteMediaPlayerManagerProxy;
4641
4742class RemoteMediaPlayerProxy
48  : public MediaPlayerClient {
 43 : public WebCore::MediaPlayerClient {
4944 WTF_MAKE_FAST_ALLOCATED;
5045public:
51  RemoteMediaPlayerProxy(RemoteMediaPlayerManagerProxy&, MediaPlayerPrivateRemoteIdentifier, Ref<IPC::Connection>&&, MediaPlayerEnums::MediaEngineIdentifier);
 46 RemoteMediaPlayerProxy(RemoteMediaPlayerManagerProxy&, RemoteMediaResourceManager&, MediaPlayerPrivateRemoteIdentifier, Ref<IPC::Connection>&&, WebCore::MediaPlayerEnums::MediaEngineIdentifier);
5247 virtual ~RemoteMediaPlayerProxy()
5348 {
5449 }
5550
 51 IPC::Connection& WebProcessConnection() { return m_webProcessConnection; }
 52
5653 void invalidate();
5754
5855 void prepareForPlayback(bool privateMode, WebCore::MediaPlayerEnums::Preload, bool preservesPitch, bool prepareForRendering);
5956
60  void load(const URL&, const ContentType&, const String&);
 57 void load(const URL&, const WebCore::ContentType&, const String&);
6158 void cancelLoad();
6259
6360 void prepareToPlay();

@@private:
113110 bool mediaPlayerIsFullscreen() const final;
114111 bool mediaPlayerIsFullscreenPermitted() const final;
115112 bool mediaPlayerIsVideo() const final;
116  LayoutRect mediaPlayerContentBoxRect() const final;
 113 WebCore::LayoutRect mediaPlayerContentBoxRect() const final;
117114 float mediaPlayerContentsScale() const final;
118115 void mediaPlayerPause() final;
119116 void mediaPlayerPlay() final;
120117 bool mediaPlayerPlatformVolumeConfigurationRequired() const final;
121  CachedResourceLoader* mediaPlayerCachedResourceLoader() final;
122  RefPtr<PlatformMediaResourceLoader> mediaPlayerCreateResourceLoader() final;
 118 WebCore::CachedResourceLoader* mediaPlayerCachedResourceLoader() final;
 119 RefPtr<WebCore::PlatformMediaResourceLoader> mediaPlayerCreateResourceLoader() final;
123120 bool doesHaveAttribute(const AtomString&, AtomString* = nullptr) const final;
124121 bool mediaPlayerShouldUsePersistentCache() const final;
125122 const String& mediaPlayerMediaCacheDirectory() const final;
126123
127  void mediaPlayerDidAddAudioTrack(AudioTrackPrivate&) final;
128  void mediaPlayerDidAddTextTrack(InbandTextTrackPrivate&) final;
129  void mediaPlayerDidAddVideoTrack(VideoTrackPrivate&) final;
130  void mediaPlayerDidRemoveAudioTrack(AudioTrackPrivate&) final;
131  void mediaPlayerDidRemoveTextTrack(InbandTextTrackPrivate&) final;
132  void mediaPlayerDidRemoveVideoTrack(VideoTrackPrivate&) final;
 124 void mediaPlayerDidAddAudioTrack(WebCore::AudioTrackPrivate&) final;
 125 void mediaPlayerDidAddTextTrack(WebCore::InbandTextTrackPrivate&) final;
 126 void mediaPlayerDidAddVideoTrack(WebCore::VideoTrackPrivate&) final;
 127 void mediaPlayerDidRemoveAudioTrack(WebCore::AudioTrackPrivate&) final;
 128 void mediaPlayerDidRemoveTextTrack(WebCore::InbandTextTrackPrivate&) final;
 129 void mediaPlayerDidRemoveVideoTrack(WebCore::VideoTrackPrivate&) final;
133130
134  void textTrackRepresentationBoundsChanged(const IntRect&) final;
 131 void textTrackRepresentationBoundsChanged(const WebCore::IntRect&) final;
135132
136133#if ENABLE(VIDEO_TRACK) && ENABLE(AVF_CAPTIONS)
137  Vector<RefPtr<PlatformTextTrack>> outOfBandTrackSources() final;
 134 Vector<RefPtr<WebCore::PlatformTextTrack>> outOfBandTrackSources() final;
138135#endif
139136
140137#if PLATFORM(IOS_FAMILY)
141138 String mediaPlayerNetworkInterfaceName() const final;
142  bool mediaPlayerGetRawCookies(const URL&, Vector<Cookie>&) const final;
 139 bool mediaPlayerGetRawCookies(const URL&, Vector<WebCore::Cookie>&) const final;
143140#endif
144141
145142 String mediaPlayerSourceApplicationIdentifier() const final;

@@private:
147144 void mediaPlayerEngineFailedToLoad() const final;
148145
149146 double mediaPlayerRequestedPlaybackRate() const final;
150  MediaPlayerEnums::VideoFullscreenMode mediaPlayerFullscreenMode() const final;
 147 WebCore::MediaPlayerEnums::VideoFullscreenMode mediaPlayerFullscreenMode() const final;
151148 bool mediaPlayerIsVideoFullscreenStandby() const final;
152149 Vector<String> mediaPlayerPreferredAudioCharacteristics() const final;
153150

@@private:
161158
162159 MediaPlayerPrivateRemoteIdentifier m_id;
163160 Ref<IPC::Connection> m_webProcessConnection;
164  RefPtr<MediaPlayer> m_player;
 161 RefPtr<WebCore::MediaPlayer> m_player;
165162 RemoteMediaPlayerManagerProxy& m_manager;
166  MediaPlayerEnums::MediaEngineIdentifier m_engineIdentifier;
 163 RemoteMediaResourceManager& m_mediaResourceManager;
 164 WebCore::MediaPlayerEnums::MediaEngineIdentifier m_engineIdentifier;
167165 Vector<WebCore::ContentType> m_typesRequiringHardwareSupport;
168166
169167#if !RELEASE_LOG_DISABLED

@@private:
171169#endif
172170};
173171
174 }
 172} // namespace WebKit
175173
176174#endif

Source/WebKit/GPUProcess/media/RemoteMediaResource.cpp

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "RemoteMediaResource.h"
 28
 29#if ENABLE(GPU_PROCESS)
 30
 31#include "RemoteMediaResourceManager.h"
 32#include <WebCore/ResourceResponse.h>
 33
 34namespace WebKit {
 35
 36using namespace WebCore;
 37
 38Ref<RemoteMediaResource> RemoteMediaResource::create(RemoteMediaResourceManager& remoteMediaResourceManager, RemoteMediaResourceIdentifier id)
 39{
 40 return adoptRef(*new RemoteMediaResource(remoteMediaResourceManager, id));
 41}
 42
 43RemoteMediaResource::RemoteMediaResource(RemoteMediaResourceManager& remoteMediaResourceManager, RemoteMediaResourceIdentifier id)
 44 : m_remoteMediaResourceManager(remoteMediaResourceManager)
 45 , m_id(id)
 46 , m_ready(false)
 47{
 48}
 49
 50RemoteMediaResource::~RemoteMediaResource()
 51{
 52 // TODO: do we need to send message to the web process here?
 53 m_remoteMediaResourceManager.removeMediaResource(m_id);
 54}
 55
 56void RemoteMediaResource::stop()
 57{
 58 // TODO: notify the web process that the job is done?
 59}
 60
 61bool RemoteMediaResource::didPassAccessControlCheck() const
 62{
 63 return false;
 64}
 65
 66void RemoteMediaResource::responseReceived(const ResourceResponse& response)
 67{
 68 if (m_client) {
 69 m_client->responseReceived(*this, response, [weakThis = makeWeakPtr(*this)](ShouldContinue shouldContinue) mutable {
 70 if (shouldContinue == ShouldContinue::No && weakThis)
 71 weakThis->stop();
 72 });
 73 }
 74}
 75
 76void RemoteMediaResource::redirectReceived(ResourceRequest&& request, const ResourceResponse& response)
 77{
 78 if (m_client)
 79 m_client->redirectReceived(*this, WTFMove(request), response, [](ResourceRequest&&) mutable { });
 80}
 81
 82bool RemoteMediaResource::shouldCacheResponse(const ResourceResponse&)
 83{
 84 return true;
 85}
 86
 87void RemoteMediaResource::dataSent(uint64_t bytesSent, uint64_t totalBytesToBeSent)
 88{
 89 if (m_client)
 90 m_client->dataSent(*this, bytesSent, totalBytesToBeSent);
 91}
 92
 93void RemoteMediaResource::dataReceived(const char* data, int64_t length)
 94{
 95 if (m_client)
 96 m_client->dataReceived(*this, data, length);
 97}
 98
 99void RemoteMediaResource::accessControlCheckFailed(const ResourceError& error)
 100{
 101 if (m_client)
 102 m_client->accessControlCheckFailed(*this, error);
 103}
 104
 105void RemoteMediaResource::loadFailed(const ResourceError& error)
 106{
 107 if (m_client)
 108 m_client->loadFailed(*this, error);
 109}
 110
 111void RemoteMediaResource::loadFinished()
 112{
 113 if (m_client)
 114 m_client->loadFinished(*this);
 115}
 116
 117} // namespace WebKit
 118
 119#endif

Source/WebKit/GPUProcess/media/RemoteMediaResource.h

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(GPU_PROCESS)
 29
 30#include "RemoteMediaResourceIdentifier.h"
 31#include "WebCore/PlatformMediaResourceLoader.h"
 32#include <wtf/WeakPtr.h>
 33
 34namespace WebKit {
 35
 36class RemoteMediaResourceManager;
 37
 38class RemoteMediaResource : public CanMakeWeakPtr<RemoteMediaResource>, public WebCore::PlatformMediaResource {
 39public:
 40 static Ref<RemoteMediaResource> create(RemoteMediaResourceManager&, RemoteMediaResourceIdentifier);
 41 explicit RemoteMediaResource(RemoteMediaResourceManager&, RemoteMediaResourceIdentifier);
 42 ~RemoteMediaResource();
 43
 44 bool ready() { return m_ready; }
 45 void setReady(bool ready) { m_ready = ready; }
 46
 47 // PlatformMediaResource
 48 void stop() override;
 49 bool didPassAccessControlCheck() const override;
 50
 51 void responseReceived(const WebCore::ResourceResponse&);
 52 void redirectReceived(WebCore::ResourceRequest&&, const WebCore::ResourceResponse&);
 53 bool shouldCacheResponse(const WebCore::ResourceResponse&);
 54 void dataSent(uint64_t, uint64_t);
 55 void dataReceived(const char*, int64_t);
 56 void accessControlCheckFailed(const WebCore::ResourceError&);
 57 void loadFailed(const WebCore::ResourceError&);
 58 void loadFinished();
 59
 60private:
 61 RemoteMediaResourceManager& m_remoteMediaResourceManager;
 62 RemoteMediaResourceIdentifier m_id;
 63 bool m_ready;
 64};
 65
 66} // namespace WebKit
 67
 68
 69#endif

Source/WebKit/GPUProcess/media/RemoteMediaResourceIdentifier.h

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(GPU_PROCESS)
 29
 30#include <wtf/ObjectIdentifier.h>
 31
 32namespace WebKit {
 33
 34enum RemoteMediaResourceIdentifierType { };
 35using RemoteMediaResourceIdentifier = ObjectIdentifier<RemoteMediaResourceIdentifierType>;
 36
 37} // namespace WebKit
 38
 39#endif

Source/WebKit/GPUProcess/media/RemoteMediaResourceLoader.cpp

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "RemoteMediaResourceLoader.h"
 28
 29#if ENABLE(GPU_PROCESS)
 30
 31#include "RemoteMediaPlayerManagerMessages.h"
 32#include "WebCoreArgumentCoders.h"
 33
 34namespace WebKit {
 35
 36using namespace WebCore;
 37
 38RemoteMediaResourceLoader::RemoteMediaResourceLoader(MediaPlayerPrivateRemoteIdentifier mediaPlayerPrivateRemoteIdentifier, RemoteMediaPlayerProxy& remoteMediaPlayerProxy, RemoteMediaResourceManager& remoteMediaResourceManager)
 39 : m_mediaPlayerPrivateRemoteIdentifier(mediaPlayerPrivateRemoteIdentifier)
 40 , m_remoteMediaPlayerProxy(remoteMediaPlayerProxy)
 41 , m_remoteMediaResourceManager(remoteMediaResourceManager)
 42{
 43}
 44
 45RemoteMediaResourceLoader::~RemoteMediaResourceLoader()
 46{
 47}
 48
 49RefPtr<PlatformMediaResource> RemoteMediaResourceLoader::requestResource(ResourceRequest&& request, LoadOptions options)
 50{
 51 auto remoteMediaResourceIdentifier = RemoteMediaResourceIdentifier::generate();
 52 RefPtr<RemoteMediaResource> remoteMediaResource = adoptRef(*new RemoteMediaResource(m_remoteMediaResourceManager, remoteMediaResourceIdentifier));
 53 m_remoteMediaResourceManager.addMediaResource(remoteMediaResourceIdentifier, remoteMediaResource);
 54
 55 m_remoteMediaPlayerProxy.WebProcessConnection().sendWithAsyncReply(Messages::RemoteMediaPlayerManager::RequestResource(m_mediaPlayerPrivateRemoteIdentifier, remoteMediaResourceIdentifier, request, options), [remoteMediaResource]() {
 56 if (remoteMediaResource)
 57 remoteMediaResource->setReady(true);
 58 });
 59
 60 return remoteMediaResource;
 61}
 62
 63} // namespace WebKit
 64
 65#endif

Source/WebKit/GPUProcess/media/RemoteMediaResourceLoader.h

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(GPU_PROCESS)
 29
 30#include "RemoteMediaPlayerProxy.h"
 31#include "RemoteMediaResourceManager.h"
 32#include <WebCore/PlatformMediaResourceLoader.h>
 33#include <WebCore/ResourceRequest.h>
 34
 35namespace WebKit {
 36
 37class RemoteMediaResource;
 38
 39class RemoteMediaResourceLoader
 40 : public WebCore::PlatformMediaResourceLoader {
 41public:
 42 explicit RemoteMediaResourceLoader(MediaPlayerPrivateRemoteIdentifier, RemoteMediaPlayerProxy&, RemoteMediaResourceManager&);
 43 virtual ~RemoteMediaResourceLoader();
 44
 45 RefPtr<WebCore::PlatformMediaResource> requestResource(WebCore::ResourceRequest&&, LoadOptions) final;
 46
 47private:
 48 MediaPlayerPrivateRemoteIdentifier m_mediaPlayerPrivateRemoteIdentifier;
 49 RemoteMediaPlayerProxy& m_remoteMediaPlayerProxy;
 50 RemoteMediaResourceManager& m_remoteMediaResourceManager;
 51};
 52
 53} // namespace WebKit
 54
 55#endif

Source/WebKit/GPUProcess/media/RemoteMediaResourceManager.cpp

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "RemoteMediaResourceManager.h"
 28
 29#if ENABLE(GPU_PROCESS)
 30
 31#include "RemoteMediaPlayerManagerMessages.h"
 32#include "RemoteMediaResource.h"
 33#include "RemoteMediaResourceIdentifier.h"
 34#include "WebCoreArgumentCoders.h"
 35#include <WebCore/ResourceRequest.h>
 36
 37namespace WebKit {
 38
 39using namespace WebCore;
 40
 41RemoteMediaResourceManager::RemoteMediaResourceManager()
 42{
 43}
 44
 45RemoteMediaResourceManager::~RemoteMediaResourceManager()
 46{
 47}
 48
 49void RemoteMediaResourceManager::addMediaResource(RemoteMediaResourceIdentifier remoteMediaResourceIdentifier, RefPtr<RemoteMediaResource> remoteMediaResource)
 50{
 51 m_remoteMediaResources.add(remoteMediaResourceIdentifier, remoteMediaResource);
 52}
 53
 54void RemoteMediaResourceManager::removeMediaResource(RemoteMediaResourceIdentifier remoteMediaResourceIdentifier)
 55{
 56 m_remoteMediaResources.remove(remoteMediaResourceIdentifier);
 57}
 58
 59void RemoteMediaResourceManager::responseReceived(RemoteMediaResourceIdentifier id, const ResourceResponse& response, CompletionHandler<void()>&& completionHandler)
 60{
 61 ASSERT(m_remoteMediaResources.contains(id) && m_remoteMediaResources.get(id)->ready());
 62 m_remoteMediaResources.get(id)->responseReceived(response);
 63 completionHandler();
 64}
 65
 66void RemoteMediaResourceManager::redirectReceived(RemoteMediaResourceIdentifier id, ResourceRequest&& request, const ResourceResponse& response, CompletionHandler<void()>&& completionHandler)
 67{
 68 ASSERT(m_remoteMediaResources.contains(id) && m_remoteMediaResources.get(id)->ready());
 69 m_remoteMediaResources.get(id)->redirectReceived(WTFMove(request), response);
 70 completionHandler();
 71}
 72
 73void RemoteMediaResourceManager::dataSent(RemoteMediaResourceIdentifier id, uint64_t bytesSent, uint64_t totalBytesToBeSent)
 74{
 75 ASSERT(m_remoteMediaResources.contains(id) && m_remoteMediaResources.get(id)->ready());
 76 m_remoteMediaResources.get(id)->dataSent(bytesSent, totalBytesToBeSent);
 77}
 78
 79void RemoteMediaResourceManager::dataReceived(RemoteMediaResourceIdentifier id, const String&& data, int32_t length)
 80{
 81 ASSERT(m_remoteMediaResources.contains(id) && m_remoteMediaResources.get(id)->ready());
 82 m_remoteMediaResources.get(id)->dataReceived((const char*)data.characters8(), length);
 83}
 84
 85void RemoteMediaResourceManager::accessControlCheckFailed(RemoteMediaResourceIdentifier id, const ResourceError& error)
 86{
 87 ASSERT(m_remoteMediaResources.contains(id) && m_remoteMediaResources.get(id)->ready());
 88 m_remoteMediaResources.get(id)->accessControlCheckFailed(error);
 89}
 90
 91void RemoteMediaResourceManager::loadFailed(RemoteMediaResourceIdentifier id, const ResourceError& error)
 92{
 93 ASSERT(m_remoteMediaResources.contains(id) && m_remoteMediaResources.get(id)->ready());
 94 m_remoteMediaResources.get(id)->loadFailed(error);
 95}
 96
 97void RemoteMediaResourceManager::loadFinished(RemoteMediaResourceIdentifier id)
 98{
 99 ASSERT(m_remoteMediaResources.contains(id) && m_remoteMediaResources.get(id)->ready());
 100 m_remoteMediaResources.get(id)->loadFinished();
 101}
 102
 103} // namespace WebKit
 104
 105#endif

Source/WebKit/GPUProcess/media/RemoteMediaResourceManager.h

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(GPU_PROCESS)
 29
 30#include "Connection.h"
 31#include "MediaPlayerPrivateRemoteIdentifier.h"
 32#include "MessageReceiver.h"
 33#include "MessageSender.h"
 34#include "RemoteMediaResource.h"
 35#include "RemoteMediaResourceIdentifier.h"
 36#include <WebCore/MediaPlayer.h>
 37#include <WebCore/PlatformMediaResourceLoader.h>
 38#include <WebCore/ResourceRequest.h>
 39#include <wtf/WeakPtr.h>
 40
 41namespace WebKit {
 42
 43class RemoteMediaResource;
 44
 45class RemoteMediaResourceManager
 46 : public IPC::MessageReceiver {
 47 WTF_MAKE_FAST_ALLOCATED;
 48public:
 49 explicit RemoteMediaResourceManager();
 50 virtual ~RemoteMediaResourceManager();
 51
 52 void addMediaResource(RemoteMediaResourceIdentifier, RefPtr<RemoteMediaResource>);
 53 void removeMediaResource(RemoteMediaResourceIdentifier);
 54
 55 // IPC::MessageReceiver
 56 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
 57
 58private:
 59 void responseReceived(RemoteMediaResourceIdentifier, const WebCore::ResourceResponse&, CompletionHandler<void()>&&);
 60 void redirectReceived(RemoteMediaResourceIdentifier, WebCore::ResourceRequest&&, const WebCore::ResourceResponse&, CompletionHandler<void()>&&);
 61 void dataSent(RemoteMediaResourceIdentifier, uint64_t, uint64_t);
 62 void dataReceived(RemoteMediaResourceIdentifier, const String&&, int32_t);
 63 void accessControlCheckFailed(RemoteMediaResourceIdentifier, const WebCore::ResourceError&);
 64 void loadFailed(RemoteMediaResourceIdentifier, const WebCore::ResourceError&);
 65 void loadFinished(RemoteMediaResourceIdentifier);
 66
 67 HashMap<RemoteMediaResourceIdentifier, RefPtr<RemoteMediaResource>> m_remoteMediaResources;
 68};
 69
 70} // namespace WebKit
 71
 72#endif

Source/WebKit/GPUProcess/media/RemoteMediaResourceManager.messages.in

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#if ENABLE(GPU_PROCESS)
 27
 28messages -> RemoteMediaResourceManager NotRefCounted {
 29 ResponseReceived(WebKit::RemoteMediaResourceIdentifier id, WebCore::ResourceResponse response) -> () Async
 30 RedirectReceived(WebKit::RemoteMediaResourceIdentifier id, WebCore::ResourceRequest request, WebCore::ResourceResponse response) -> () Async
 31 DataSent(WebKit::RemoteMediaResourceIdentifier id, uint64_t bytesSent, uint64_t totalBytesToBeSent)
 32 DataReceived(WebKit::RemoteMediaResourceIdentifier id, String data, int32_t length)
 33 AccessControlCheckFailed(WebKit::RemoteMediaResourceIdentifier id, WebCore::ResourceError error)
 34 LoadFailed(WebKit::RemoteMediaResourceIdentifier id, WebCore::ResourceError error)
 35 LoadFinished(WebKit::RemoteMediaResourceIdentifier id)
 36}
 37
 38#endif

Source/WebKit/Platform/Logging.h

@@extern "C" {
6262 M(Layout) \
6363 M(Loading) \
6464 M(LocalStorageDatabaseTracker) \
 65 M(Media) \
6566 M(MouseHandling) \
6667 M(Network) \
6768 M(NetworkCache) \

Source/WebKit/Scripts/webkit/messages.py

@@def types_that_cannot_be_forward_declared():
220220 'WebKit::ActivityStateChangeID',
221221 'WebKit::LayerHostingContextID',
222222 'WebKit::MediaPlayerPrivateRemoteIdentifier',
 223 'WebKit::RemoteMediaResourceIdentifier',
223224 'WebKit::StorageAreaIdentifier',
224225 'WebKit::StorageAreaImplIdentifier',
225226 'WebKit::StorageNamespaceIdentifier',

Source/WebKit/Sources.txt

2424GPUProcess/GPUProcess.cpp
2525GPUProcess/GPUConnectionToWebProcess.cpp
2626GPUProcess/GPUProcessCreationParameters.cpp
 27//GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp
 28//GPUProcess/media/RemoteMediaPlayerProxy.cpp
 29//GPUProcess/media/RemoteMediaResource.cpp
 30//GPUProcess/media/RemoteMediaResourceLoader.cpp
 31//GPUProcess/media/RemoteMediaResourceManager.cpp
2732
2833NetworkProcess/AdClickAttributionManager.cpp
2934NetworkProcess/NetworkActivityTracker.cpp

@@WebProcess/MediaStream/MediaDeviceSandboxExtensions.cpp
500505WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp
501506
502507WebProcess/GPU/GPUProcessConnection.cpp
503 WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp
504 WebProcess/GPU/media/RemoteMediaPlayerManager.cpp
 508//WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp
 509//WebProcess/GPU/media/RemoteMediaPlayerManager.cpp
 510//WebProcess/GPU/media/RemoteMediaResourceProxy.cpp
505511
506512WebProcess/Network/NetworkProcessConnection.cpp
507513WebProcess/Network/WebLoaderStrategy.cpp

Source/WebKit/SourcesCocoa.txt

@@NetworkProcess/webrtc/NetworkRTCSocket.cpp
5959
6060GPUProcess/ios/GPUProcessIOS.mm
6161GPUProcess/mac/GPUProcessMac.mm
62 GPUProcess/media/RemoteMediaPlayerProxy.cpp
63 GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp
6462GPUProcess/EntryPoint/Cocoa/XPCService/GPUServiceEntryPoint.mm
6563
6664Platform/cf/ModuleCF.cpp

Source/WebKit/WebKit.xcodeproj/project.pbxproj

405405 1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */; };
406406 1CBBE4A019B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CBBE49E19B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp */; };
407407 1CBBE4A119B66C53006B7D81 /* WebInspectorUIMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CBBE49F19B66C53006B7D81 /* WebInspectorUIMessages.h */; };
 408 1D32F89C23A84BA600B1EA6A /* RemoteMediaResourceProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D32F89B23A84BA600B1EA6A /* RemoteMediaResourceProxy.h */; };
 409 1D32F89E23A84C5B00B1EA6A /* RemoteMediaResourceProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D32F89D23A84C5B00B1EA6A /* RemoteMediaResourceProxy.cpp */; };
 410 1D3AB05023AC01A0005C1FF0 /* RemoteMediaPlayerManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0725EFAD239B024500A538A9 /* RemoteMediaPlayerManagerProxy.cpp */; };
 411 1D3AB05123AC01AA005C1FF0 /* RemoteMediaPlayerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07BAF35723A2CC190044257E /* RemoteMediaPlayerProxy.cpp */; };
 412 1D3AB05223AC01AE005C1FF0 /* RemoteMediaResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D32F89923A8468000B1EA6A /* RemoteMediaResource.cpp */; };
 413 1D3AB05323AC01B3005C1FF0 /* RemoteMediaResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D3AB04E23AB009B005C1FF0 /* RemoteMediaResourceLoader.cpp */; };
 414 1D3AB05423AC01B7005C1FF0 /* RemoteMediaResourceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DA4089E23A827780058C950 /* RemoteMediaResourceManager.cpp */; };
 415 1D3AB05523AC01F3005C1FF0 /* MediaPlayerPrivateRemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07923131239B3B0C009598E2 /* MediaPlayerPrivateRemote.cpp */; };
 416 1D3AB05623AC01F6005C1FF0 /* RemoteMediaPlayerManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07923130239B3B0C009598E2 /* RemoteMediaPlayerManager.cpp */; };
 417 1D4D737023A9E54700717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D4D736B23A9DF5500717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp */; };
 418 1D4D737123A9E56200717A25 /* RemoteMediaResourceManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D4D736C23A9DF6000717A25 /* RemoteMediaResourceManagerMessages.h */; };
 419 1D4D737623A9ED1800717A25 /* RemoteMediaResourceManagerMessagesReplies.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D4D737523A9EB6800717A25 /* RemoteMediaResourceManagerMessagesReplies.h */; };
408420 1D67B339212E1F6100FAA786 /* ShareSheetCallbackID.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D67B338212E1F6100FAA786 /* ShareSheetCallbackID.h */; };
 421 1DA4089523A80A3E0058C950 /* RemoteMediaResourceManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DA4089423A80A3E0058C950 /* RemoteMediaResourceManager.h */; };
409422 1DB01943211CF002009FB3E8 /* WKShareSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1DE0D095211CC21300439B5F /* WKShareSheet.h */; };
410423 1DB01944211CF005009FB3E8 /* WKShareSheet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1DBBB061211CC3CB00502ECC /* WKShareSheet.mm */; };
411424 1F335BC0185B84F0001A201A /* WKWebProcessPlugInLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F335BBF185B84D8001A201A /* WKWebProcessPlugInLoadDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };

26122625 1CA8B944127C882A00576C2B /* WebInspectorProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorProxyMessages.h; path = DerivedSources/WebKit2/WebInspectorProxyMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
26132626 1CBBE49E19B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebInspectorUIMessageReceiver.cpp; path = DerivedSources/WebKit2/WebInspectorUIMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
26142627 1CBBE49F19B66C53006B7D81 /* WebInspectorUIMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorUIMessages.h; path = DerivedSources/WebKit2/WebInspectorUIMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
 2628 1D32F89823A8465A00B1EA6A /* RemoteMediaResource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteMediaResource.h; sourceTree = "<group>"; };
 2629 1D32F89923A8468000B1EA6A /* RemoteMediaResource.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteMediaResource.cpp; sourceTree = "<group>"; };
 2630 1D32F89B23A84BA600B1EA6A /* RemoteMediaResourceProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteMediaResourceProxy.h; sourceTree = "<group>"; };
 2631 1D32F89D23A84C5B00B1EA6A /* RemoteMediaResourceProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteMediaResourceProxy.cpp; sourceTree = "<group>"; };
 2632 1D32F8A623A8601900B1EA6A /* RemoteMediaResourceManager.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = RemoteMediaResourceManager.messages.in; sourceTree = "<group>"; };
 2633 1D3AB04D23AB0072005C1FF0 /* RemoteMediaResourceLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteMediaResourceLoader.h; sourceTree = "<group>"; };
 2634 1D3AB04E23AB009B005C1FF0 /* RemoteMediaResourceLoader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteMediaResourceLoader.cpp; sourceTree = "<group>"; };
 2635 1D4D736B23A9DF5500717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = RemoteMediaResourceManagerMessageReceiver.cpp; path = DerivedSources/WebKit2/RemoteMediaResourceManagerMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
 2636 1D4D736C23A9DF6000717A25 /* RemoteMediaResourceManagerMessages.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; name = RemoteMediaResourceManagerMessages.h; path = DerivedSources/WebKit2/RemoteMediaResourceManagerMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
 2637 1D4D737523A9EB6800717A25 /* RemoteMediaResourceManagerMessagesReplies.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; name = RemoteMediaResourceManagerMessagesReplies.h; path = DerivedSources/WebKit2/RemoteMediaResourceManagerMessagesReplies.h; sourceTree = BUILT_PRODUCTS_DIR; };
26152638 1D67B338212E1F6100FAA786 /* ShareSheetCallbackID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareSheetCallbackID.h; sourceTree = "<group>"; };
 2639 1DA4089423A80A3E0058C950 /* RemoteMediaResourceManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteMediaResourceManager.h; sourceTree = "<group>"; };
 2640 1DA4089E23A827780058C950 /* RemoteMediaResourceManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteMediaResourceManager.cpp; sourceTree = "<group>"; };
26162641 1DBBB061211CC3CB00502ECC /* WKShareSheet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKShareSheet.mm; sourceTree = "<group>"; };
26172642 1DE0D095211CC21300439B5F /* WKShareSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKShareSheet.h; sourceTree = "<group>"; };
 2643 1DE2DFAC23A959F8003E013A /* RemoteMediaResourceIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteMediaResourceIdentifier.h; sourceTree = "<group>"; };
26182644 1F0181691858DC1500F92884 /* WKWebProcessPlugInFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInFrame.h; sourceTree = "<group>"; };
26192645 1F01816A1858DC1500F92884 /* WKWebProcessPlugInFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessPlugInFrame.mm; sourceTree = "<group>"; };
26202646 1F01816B1858DC1500F92884 /* WKWebProcessPlugInFrameInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInFrameInternal.h; sourceTree = "<group>"; };

48494875 DF58C6311371AC5800F9A37C /* NativeWebWheelEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeWebWheelEvent.h; sourceTree = "<group>"; };
48504876 DF58C6351371ACA000F9A37C /* NativeWebWheelEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NativeWebWheelEventMac.mm; sourceTree = "<group>"; };
48514877 E105FE5318D7B9DE008F57A8 /* EditingRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingRange.h; sourceTree = "<group>"; };
4852  E115C715190F8A2500ECC516 /* com.apple.WebKit.Storage.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file; name = com.apple.WebKit.Storage.sb; path = DerivedSources/WebKit2/com.apple.WebKit.Storage.sb; sourceTree = BUILT_PRODUCTS_DIR; };
 4878 E115C715190F8A2500ECC516 /* com.apple.WebKit.Storage.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebKit.Storage.sb; path = DerivedSources/WebKit2/com.apple.WebKit.Storage.sb; sourceTree = BUILT_PRODUCTS_DIR; };
48534879 E133FD891423DD7F00FC7BFB /* WebKit.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = WebKit.icns; path = Resources/WebKit.icns; sourceTree = "<group>"; };
48544880 E14A954716E016A40068DE82 /* NetworkProcessPlatformStrategies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkProcessPlatformStrategies.cpp; sourceTree = "<group>"; };
48554881 E14A954816E016A40068DE82 /* NetworkProcessPlatformStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProcessPlatformStrategies.h; sourceTree = "<group>"; };

50985124 07923130239B3B0C009598E2 /* RemoteMediaPlayerManager.cpp */,
50995125 07923134239B3B0C009598E2 /* RemoteMediaPlayerManager.h */,
51005126 07923133239B3B0C009598E2 /* RemoteMediaPlayerManager.messages.in */,
 5127 1D32F89D23A84C5B00B1EA6A /* RemoteMediaResourceProxy.cpp */,
 5128 1D32F89B23A84BA600B1EA6A /* RemoteMediaResourceProxy.h */,
51015129 );
51025130 path = media;
51035131 sourceTree = "<group>";

51105138 0725EFAB239AE38400A538A9 /* RemoteMediaPlayerManagerProxy.messages.in */,
51115139 07BAF35723A2CC190044257E /* RemoteMediaPlayerProxy.cpp */,
51125140 07BAF35623A2CC170044257E /* RemoteMediaPlayerProxy.h */,
 5141 1D32F89923A8468000B1EA6A /* RemoteMediaResource.cpp */,
 5142 1D32F89823A8465A00B1EA6A /* RemoteMediaResource.h */,
 5143 1DE2DFAC23A959F8003E013A /* RemoteMediaResourceIdentifier.h */,
 5144 1D3AB04E23AB009B005C1FF0 /* RemoteMediaResourceLoader.cpp */,
 5145 1D3AB04D23AB0072005C1FF0 /* RemoteMediaResourceLoader.h */,
 5146 1DA4089E23A827780058C950 /* RemoteMediaResourceManager.cpp */,
 5147 1DA4089423A80A3E0058C950 /* RemoteMediaResourceManager.h */,
 5148 1D32F8A623A8601900B1EA6A /* RemoteMediaResourceManager.messages.in */,
51135149 );
51145150 path = media;
51155151 sourceTree = "<group>";

92609296 07923145239CBCB7009598E2 /* RemoteMediaPlayerManagerProxyMessageReceiver.cpp */,
92619297 07923146239CBCB7009598E2 /* RemoteMediaPlayerManagerProxyMessages.h */,
92629298 07923142239CBCB5009598E2 /* RemoteMediaPlayerManagerProxyMessagesReplies.h */,
 9299 1D4D736B23A9DF5500717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp */,
 9300 1D4D736C23A9DF6000717A25 /* RemoteMediaResourceManagerMessages.h */,
 9301 1D4D737523A9EB6800717A25 /* RemoteMediaResourceManagerMessagesReplies.h */,
92639302 1AC1338318590C4600F3EC05 /* RemoteObjectRegistryMessageReceiver.cpp */,
92649303 1AC1338418590C4600F3EC05 /* RemoteObjectRegistryMessages.h */,
92659304 0F5947A5187B517600437857 /* RemoteScrollingCoordinatorMessageReceiver.cpp */,

1015010189 0792314A239CBCB8009598E2 /* RemoteMediaPlayerManagerMessagesReplies.h in Headers */,
1015110190 0792314C239CBCB8009598E2 /* RemoteMediaPlayerManagerProxyMessages.h in Headers */,
1015210191 07923148239CBCB8009598E2 /* RemoteMediaPlayerManagerProxyMessagesReplies.h in Headers */,
 10192 1DA4089523A80A3E0058C950 /* RemoteMediaResourceManager.h in Headers */,
 10193 1D4D737123A9E56200717A25 /* RemoteMediaResourceManagerMessages.h in Headers */,
 10194 1D4D737623A9ED1800717A25 /* RemoteMediaResourceManagerMessagesReplies.h in Headers */,
 10195 1D32F89C23A84BA600B1EA6A /* RemoteMediaResourceProxy.h in Headers */,
1015310196 E1B78471163F24690007B692 /* RemoteNetworkingContext.h in Headers */,
1015410197 1A5704FC1BE1751100874AF1 /* RemoteObjectInvocation.h in Headers */,
1015510198 1AC1338018590AE400F3EC05 /* RemoteObjectRegistry.h in Headers */,

1176011803 2984F57C164B915F004BC0C6 /* LegacyCustomProtocolManagerProxyMessageReceiver.cpp in Sources */,
1176111804 449D90DA21FDC30B00F677C0 /* LocalAuthenticationSoftLink.mm in Sources */,
1176211805 2D92A779212B6A6100F493FD /* Logging.cpp in Sources */,
 11806 1D3AB05523AC01F3005C1FF0 /* MediaPlayerPrivateRemote.cpp in Sources */,
1176311807 2D92A781212B6A7100F493FD /* MessageReceiverMap.cpp in Sources */,
1176411808 2D92A782212B6A7100F493FD /* MessageSender.cpp in Sources */,
1176511809 2D92A77A212B6A6100F493FD /* Module.cpp in Sources */,

1181611860 2D72A1FA212BF46E00517A20 /* RemoteLayerTreeDrawingArea.mm in Sources */,
1181711861 0FF24A2D1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessageReceiver.cpp in Sources */,
1181811862 2DC18FB4218A6E9E0025A88D /* RemoteLayerTreeViews.mm in Sources */,
 11863 1D3AB05623AC01F6005C1FF0 /* RemoteMediaPlayerManager.cpp in Sources */,
1181911864 07923149239CBCB8009598E2 /* RemoteMediaPlayerManagerMessageReceiver.cpp in Sources */,
 11865 1D3AB05023AC01A0005C1FF0 /* RemoteMediaPlayerManagerProxy.cpp in Sources */,
1182011866 0792314B239CBCB8009598E2 /* RemoteMediaPlayerManagerProxyMessageReceiver.cpp in Sources */,
 11867 1D3AB05123AC01AA005C1FF0 /* RemoteMediaPlayerProxy.cpp in Sources */,
 11868 1D3AB05223AC01AE005C1FF0 /* RemoteMediaResource.cpp in Sources */,
 11869 1D3AB05323AC01B3005C1FF0 /* RemoteMediaResourceLoader.cpp in Sources */,
 11870 1D3AB05423AC01B7005C1FF0 /* RemoteMediaResourceManager.cpp in Sources */,
 11871 1D4D737023A9E54700717A25 /* RemoteMediaResourceManagerMessageReceiver.cpp in Sources */,
 11872 1D32F89E23A84C5B00B1EA6A /* RemoteMediaResourceProxy.cpp in Sources */,
1182111873 1AC1338518590C4600F3EC05 /* RemoteObjectRegistryMessageReceiver.cpp in Sources */,
1182211874 0F5947A7187B517600437857 /* RemoteScrollingCoordinatorMessageReceiver.cpp in Sources */,
1182311875 A55BA8261BA25CFD007CD33D /* RemoteWebInspectorProxyMessageReceiver.cpp in Sources */,

Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp

@@void GPUProcessConnection::didReceiveInvalidMessage(IPC::Connection&, IPC::Strin
6565void GPUProcessConnection::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
6666{
6767 if (decoder.messageReceiverName() == Messages::RemoteMediaPlayerManager::messageReceiverName()) {
68  WebProcess::singleton().supplement<RemoteMediaPlayerManager>()->didReceiveMessageFromWebProcess(connection, decoder);
 68 WebProcess::singleton().supplement<RemoteMediaPlayerManager>()->didReceiveMessageFromGPUProcess(connection, decoder);
6969 return;
7070 }
7171#if ENABLE(MEDIA_STREAM)

Source/WebKit/WebProcess/GPU/GPUProcessConnection.h

@@private:
5555 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
5656 void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) override;
5757
58  // The connection from a web process to this GPU process.
 58 // The connection from the web process to the GPU process.
5959 Ref<IPC::Connection> m_connection;
6060};
6161

Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp

4141#include <wtf/text/CString.h>
4242
4343namespace WebKit {
44 using namespace PAL;
 44
4545using namespace WebCore;
4646
4747MediaPlayerPrivateRemote::MediaPlayerPrivateRemote(MediaPlayer* player, MediaPlayerEnums::MediaEngineIdentifier engineIdentifier, MediaPlayerPrivateRemoteIdentifier playerIdentifier, RemoteMediaPlayerManager& manager)
4848 : m_player(player)
 49 , m_mediaResourceLoader(player->createResourceLoader())
4950 , m_manager(manager)
5051 , m_remoteEngineIdentifier(engineIdentifier)
5152 , m_id(playerIdentifier)

@@void MediaPlayerPrivateRemote::engineFailedToLoad(long platformErrorCode)
768769 m_player->remoteEngineFailedToLoad();
769770}
770771
 772void MediaPlayerPrivateRemote::requestResource(RemoteMediaResourceIdentifier remoteMediaResourceIdentifier, WebCore::ResourceRequest&& request, WebCore::PlatformMediaResourceLoader::LoadOptions options)
 773{
 774 auto resource = m_mediaResourceLoader->requestResource(WTFMove(request), options);
 775 resource->setClient(makeUnique<RemoteMediaResourceProxy>(m_manager.gpuProcessConnection(), remoteMediaResourceIdentifier));
 776 m_mediaResources.add(remoteMediaResourceIdentifier, WTFMove(resource));
 777}
 778
771779#if !RELEASE_LOG_DISABLED
772780WTFLogChannel& MediaPlayerPrivateRemote::logChannel() const
773781{

Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h

2828#if ENABLE(GPU_PROCESS)
2929
3030#include "RemoteMediaPlayerManager.h"
 31#include "RemoteMediaResourceIdentifier.h"
 32#include "RemoteMediaResourceProxy.h"
3133#include <WebCore/MediaPlayerPrivate.h>
3234#include <wtf/LoggerHelper.h>
3335#include <wtf/MediaTime.h>

@@namespace WebKit {
3739
3840class MediaPlayerPrivateRemote final
3941 : public CanMakeWeakPtr<MediaPlayerPrivateRemote>
40  , public MediaPlayerPrivateInterface
 42 , public WebCore::MediaPlayerPrivateInterface
4143#if !RELEASE_LOG_DISABLED
4244 , private LoggerHelper
4345#endif
4446{
4547public:
46  static std::unique_ptr<MediaPlayerPrivateRemote> create(MediaPlayer* player, MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier, MediaPlayerPrivateRemoteIdentifier identifier, RemoteMediaPlayerManager& manager)
 48 static std::unique_ptr<MediaPlayerPrivateRemote> create(WebCore::MediaPlayer* player, WebCore::MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier, MediaPlayerPrivateRemoteIdentifier identifier, RemoteMediaPlayerManager& manager)
4749 {
4850 return makeUnique<MediaPlayerPrivateRemote>(player, remoteEngineIdentifier, identifier, manager);
4951 }
5052
51  explicit MediaPlayerPrivateRemote(MediaPlayer*, MediaPlayerEnums::MediaEngineIdentifier, MediaPlayerPrivateRemoteIdentifier, RemoteMediaPlayerManager&);
 53 explicit MediaPlayerPrivateRemote(WebCore::MediaPlayer*, WebCore::MediaPlayerEnums::MediaEngineIdentifier, MediaPlayerPrivateRemoteIdentifier, RemoteMediaPlayerManager&);
5254 virtual ~MediaPlayerPrivateRemote();
5355
5456 void invalidate() { m_invalid = true; }
55  MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier() const { return m_remoteEngineIdentifier; }
 57 WebCore::MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier() const { return m_remoteEngineIdentifier; }
5658 MediaPlayerPrivateRemoteIdentifier playerItentifier() const { return m_id; }
5759
5860 void networkStateChanged(WebCore::MediaPlayerEnums::NetworkState);

@@public:
6567 void playbackStateChanged(bool);
6668 void engineFailedToLoad(long);
6769
 70 void requestResource(RemoteMediaResourceIdentifier, WebCore::ResourceRequest&&, WebCore::PlatformMediaResourceLoader::LoadOptions);
 71
6872#if !RELEASE_LOG_DISABLED
6973 const Logger& logger() const final { return *m_logger; }
7074 const char* logClassName() const override { return "MediaPlayerPrivateRemote"; }

@@public:
7377#endif
7478
7579private:
76  void load(const URL&, const ContentType&, const String&) final;
77  void prepareForPlayback(bool privateMode, MediaPlayer::Preload, bool preservesPitch, bool prepare) final;
 80 void load(const URL&, const WebCore::ContentType&, const String&) final;
 81 void prepareForPlayback(bool privateMode, WebCore::MediaPlayer::Preload, bool preservesPitch, bool prepare) final;
7882
7983#if ENABLE(MEDIA_SOURCE)
80  void load(const String&, MediaSourcePrivateClient*) final;
 84 void load(const String&, WebCore::MediaSourcePrivateClient*) final;
8185#endif
8286#if ENABLE(MEDIA_STREAM)
83  void load(MediaStreamPrivate&) final;
 87 void load(WebCore::MediaStreamPrivate&) final;
8488#endif
8589 void cancelLoad() final;
8690

@@private:
102106#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
103107 void setVideoFullscreenLayer(PlatformLayer*, WTF::Function<void()>&& completionHandler) final;
104108 void updateVideoFullscreenInlineImage() final;
105  void setVideoFullscreenFrame(FloatRect) final;
106  void setVideoFullscreenGravity(MediaPlayer::VideoGravity) final;
107  void setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode) final;
 109 void setVideoFullscreenFrame(WebCore::FloatRect) final;
 110 void setVideoFullscreenGravity(WebCore::MediaPlayer::VideoGravity) final;
 111 void setVideoFullscreenMode(WebCore::MediaPlayer::VideoFullscreenMode) final;
108112 void videoFullscreenStandbyChanged() final;
109113#endif
110114

@@private:
114118 String errorLog() const final;
115119#endif
116120
117  void setBufferingPolicy(MediaPlayer::BufferingPolicy) final;
 121 void setBufferingPolicy(WebCore::MediaPlayer::BufferingPolicy) final;
118122
119123 bool supportsPictureInPicture() const final;
120124 bool supportsFullscreen() const final;

@@private:
122126
123127 bool canSaveMediaData() const final;
124128
125  FloatSize naturalSize() const final;
 129 WebCore::FloatSize naturalSize() const final;
126130
127131 bool hasVideo() const final;
128132 bool hasAudio() const final;

@@private:
155159 double maxFastForwardRate() const final;
156160 double minFastReverseRate() const final;
157161
158  MediaPlayer::NetworkState networkState() const final { return m_networkState; }
159  MediaPlayer::ReadyState readyState() const final { return m_readyState; }
 162 WebCore::MediaPlayer::NetworkState networkState() const final { return m_networkState; }
 163 WebCore::MediaPlayer::ReadyState readyState() const final { return m_readyState; }
160164
161  std::unique_ptr<PlatformTimeRanges> seekable() const final;
 165 std::unique_ptr<WebCore::PlatformTimeRanges> seekable() const final;
162166
163167 MediaTime maxMediaTimeSeekable() const final;
164168 MediaTime minMediaTimeSeekable() const final;
165  std::unique_ptr<PlatformTimeRanges> buffered() const final;
 169 std::unique_ptr<WebCore::PlatformTimeRanges> buffered() const final;
166170 double seekableTimeRangesLastModifiedTime() const final;
167171 double liveUpdateInterval() const final;
168172
169173 unsigned long long totalBytes() const final;
170174 bool didLoadingProgress() const final;
171175
172  void setSize(const IntSize&) final;
 176 void setSize(const WebCore::IntSize&) final;
173177
174  void paint(GraphicsContext&, const FloatRect&) final;
 178 void paint(WebCore::GraphicsContext&, const WebCore::FloatRect&) final;
175179
176  void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&) final;
177  bool copyVideoTextureToPlatformTexture(GraphicsContext3D*, Platform3DObject, GC3Denum, GC3Dint, GC3Denum, GC3Denum, GC3Denum, bool, bool) final;
178  NativeImagePtr nativeImageForCurrentTime() final;
 180 void paintCurrentFrameInContext(WebCore::GraphicsContext&, const WebCore::FloatRect&) final;
 181 bool copyVideoTextureToPlatformTexture(WebCore::GraphicsContext3D*, Platform3DObject, GC3Denum, GC3Dint, GC3Denum, GC3Denum, GC3Denum, bool, bool) final;
 182 WebCore::NativeImagePtr nativeImageForCurrentTime() final;
179183
180  void setPreload(MediaPlayer::Preload) final;
 184 void setPreload(WebCore::MediaPlayer::Preload) final;
181185
182186 bool hasAvailableVideoFrame() const final;
183187

@@private:
188192
189193#if ENABLE(WIRELESS_PLAYBACK_TARGET)
190194 String wirelessPlaybackTargetName() const final;
191  MediaPlayer::WirelessPlaybackTargetType wirelessPlaybackTargetType() const final;
 195 WebCore::MediaPlayer::WirelessPlaybackTargetType wirelessPlaybackTargetType() const final;
192196
193197 bool wirelessVideoPlaybackDisabled() const final;
194198 void setWirelessVideoPlaybackDisabled(bool) final;
195199
196200 bool canPlayToWirelessPlaybackTarget() const final;
197201 bool isCurrentPlaybackTargetWireless() const final;
198  void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) final;
 202 void setWirelessPlaybackTarget(Ref<WebCore::MediaPlaybackTarget>&&) final;
199203
200204 void setShouldPlayToPlaybackTarget(bool) final;
201205#endif

@@private:
212216
213217 bool hasSingleSecurityOrigin() const final;
214218 bool didPassCORSAccessCheck() const final;
215  Optional<bool> wouldTaintOrigin(const SecurityOrigin&) const final;
 219 Optional<bool> wouldTaintOrigin(const WebCore::SecurityOrigin&) const final;
216220
217  MediaPlayer::MovieLoadType movieLoadType() const final;
 221 WebCore::MediaPlayer::MovieLoadType movieLoadType() const final;
218222
219223 void prepareForRendering() final;
220224

@@private:
230234 String engineDescription() const final;
231235
232236#if ENABLE(WEB_AUDIO)
233  AudioSourceProvider* audioSourceProvider() final;
 237 WebCore::AudioSourceProvider* audioSourceProvider() final;
234238#endif
235239
236240#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
237  std::unique_ptr<LegacyCDMSession> createSession(const String&, LegacyCDMSessionClient*) final;
238  void setCDMSession(LegacyCDMSession*) final;
 241 std::unique_ptr<WebCore::LegacyCDMSession> createSession(const String&, WebCore::LegacyCDMSessionClient*) final;
 242 void setCDMSession(WebCore::LegacyCDMSession*) final;
239243 void keyAdded() final;
240244#endif
241245
242246#if ENABLE(ENCRYPTED_MEDIA)
243  void cdmInstanceAttached(CDMInstance&) final;
244  void cdmInstanceDetached(CDMInstance&) final;
245  void attemptToDecryptWithInstance(CDMInstance&) final;
 247 void cdmInstanceAttached(WebCore::CDMInstance&) final;
 248 void cdmInstanceDetached(WebCore::CDMInstance&) final;
 249 void attemptToDecryptWithInstance(WebCore::CDMInstance&) final;
246250 bool waitingForKey() const final;
247251#endif
248252
249253#if ENABLE(VIDEO_TRACK)
250254 bool requiresTextTrackRepresentation() const final;
251  void setTextTrackRepresentation(TextTrackRepresentation*) final;
 255 void setTextTrackRepresentation(WebCore::TextTrackRepresentation*) final;
252256 void syncTextTrackBounds() final;
253257 void tracksChanged() final;
254258#endif

@@private:
268272
269273 bool ended() const final;
270274
271  Optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() final;
 275 Optional<WebCore::VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() final;
272276
273277#if ENABLE(AVF_CAPTIONS)
274278 void notifyTrackModeChanged() final;

@@private:
289293
290294 bool shouldIgnoreIntrinsicSize() final;
291295
292  MediaPlayer* m_player { nullptr };
293  RemoteMediaPlayerManager m_manager;
294  MediaPlayerEnums::MediaEngineIdentifier m_remoteEngineIdentifier;
 296 WebCore::MediaPlayer* m_player { nullptr };
 297 RefPtr<WebCore::PlatformMediaResourceLoader> m_mediaResourceLoader;
 298 RemoteMediaPlayerManager& m_manager;
 299 WebCore::MediaPlayerEnums::MediaEngineIdentifier m_remoteEngineIdentifier;
295300 MediaPlayerPrivateRemoteIdentifier m_id;
296301
297  MediaPlayer::NetworkState m_networkState { MediaPlayer::NetworkState::Empty };
298  MediaPlayer::ReadyState m_readyState { MediaPlayer::ReadyState::HaveNothing };
 302 HashMap<RemoteMediaResourceIdentifier, RefPtr<WebCore::PlatformMediaResource>> m_mediaResources;
 303
 304 WebCore::MediaPlayer::NetworkState m_networkState { WebCore::MediaPlayer::NetworkState::Empty };
 305 WebCore::MediaPlayer::ReadyState m_readyState { WebCore::MediaPlayer::ReadyState::HaveNothing };
299306 double m_volume { 1 };
300307 bool m_muted { false };
301308 MediaTime m_duration;

Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemoteIdentifier.h

2525
2626#pragma once
2727
 28#if ENABLE(GPU_PROCESS)
 29
2830#include <wtf/ObjectIdentifier.h>
2931
3032namespace WebKit {

@@namespace WebKit {
3234enum MediaPlayerPrivateRemoteIdentifierType { };
3335using MediaPlayerPrivateRemoteIdentifier = ObjectIdentifier<MediaPlayerPrivateRemoteIdentifierType>;
3436
35 } // namespace WebCore
 37} // namespace WebKit
 38
 39#endif

Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp

2828
2929#if ENABLE(GPU_PROCESS)
3030
 31#include "GPUProcessConnection.h"
 32#include "MediaPlayerPrivateRemote.h"
3133#include "RemoteMediaPlayerManagerMessages.h"
3234#include "RemoteMediaPlayerManagerProxyMessages.h"
3335#include "WebCoreArgumentCoders.h"

3941#include <wtf/Assertions.h>
4042
4143namespace WebKit {
 44
4245using namespace PAL;
4346using namespace WebCore;
4447

@@void RemoteMediaPlayerManager::readyStateChanged(MediaPlayerPrivateRemoteIdentif
201204 player->readyStateChanged(state);
202205}
203206
204 void RemoteMediaPlayerManager::volumeChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, double volume)
 207void RemoteMediaPlayerManager::volumeChanged(MediaPlayerPrivateRemoteIdentifier id, double volume)
205208{
206209 if (auto player = m_players.get(id))
207210 player->volumeChanged(volume);
208211}
209212
210 void RemoteMediaPlayerManager::muteChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, bool mute)
 213void RemoteMediaPlayerManager::muteChanged(MediaPlayerPrivateRemoteIdentifier id, bool mute)
211214{
212215 if (auto player = m_players.get(id))
213216 player->muteChanged(mute);
214217}
215218
216 void RemoteMediaPlayerManager::timeChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, MediaTime&& time)
 219void RemoteMediaPlayerManager::timeChanged(MediaPlayerPrivateRemoteIdentifier id, MediaTime&& time)
217220{
218221 if (auto player = m_players.get(id))
219222 player->timeChanged(WTFMove(time));
220223}
221224
222 void RemoteMediaPlayerManager::durationChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, MediaTime&& time)
 225void RemoteMediaPlayerManager::durationChanged(MediaPlayerPrivateRemoteIdentifier id, MediaTime&& time)
223226{
224227 if (auto player = m_players.get(id))
225228 player->durationChanged(WTFMove(time));
226229}
227230
228 void RemoteMediaPlayerManager::rateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, double rate)
 231void RemoteMediaPlayerManager::rateChanged(MediaPlayerPrivateRemoteIdentifier id, double rate)
229232{
230233 if (auto player = m_players.get(id))
231234 player->rateChanged(rate);
232235}
233236
234 void RemoteMediaPlayerManager::playbackStateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, bool paused)
 237void RemoteMediaPlayerManager::playbackStateChanged(MediaPlayerPrivateRemoteIdentifier id, bool paused)
235238{
236239 if (auto player = m_players.get(id))
237240 player->playbackStateChanged(paused);

@@void RemoteMediaPlayerManager::engineFailedToLoad(WebKit::MediaPlayerPrivateRemo
243246 player->engineFailedToLoad(platformErrorCode);
244247}
245248
 249void RemoteMediaPlayerManager::requestResource(MediaPlayerPrivateRemoteIdentifier id, RemoteMediaResourceIdentifier remoteMediaResourceIdentifier, WebCore::ResourceRequest&& request, WebCore::PlatformMediaResourceLoader::LoadOptions options, CompletionHandler<void()>&& completionHandler)
 250{
 251 if (auto player = m_players.get(id))
 252 player->requestResource(remoteMediaResourceIdentifier, WTFMove(request), options);
 253
 254 completionHandler();
 255}
 256
246257void RemoteMediaPlayerManager::updatePreferences(const Settings& settings)
247258{
248259 auto registerEngine = [this](MediaEngineRegistrar registrar, MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier) {

Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.h

2929
3030#include "MediaPlayerPrivateRemoteIdentifier.h"
3131#include "MessageReceiver.h"
 32#include "RemoteMediaResourceIdentifier.h"
3233#include "SharedMemory.h"
3334#include "WebProcessSupplement.h"
3435#include <WebCore/MediaPlayer.h>

@@public:
5657
5758 IPC::Connection& gpuProcessConnection() const;
5859
59  void didReceiveMessageFromWebProcess(IPC::Connection& connection, IPC::Decoder& decoder) { didReceiveMessage(connection, decoder); }
 60 void didReceiveMessageFromGPUProcess(IPC::Connection& connection, IPC::Decoder& decoder) { didReceiveMessage(connection, decoder); }
6061
6162 void deleteRemoteMediaPlayer(MediaPlayerPrivateRemoteIdentifier);
6263

@@private:
7980 void rateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier, double);
8081 void playbackStateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier, bool);
8182 void engineFailedToLoad(WebKit::MediaPlayerPrivateRemoteIdentifier, long);
 83 void requestResource(MediaPlayerPrivateRemoteIdentifier, RemoteMediaResourceIdentifier, WebCore::ResourceRequest&&, WebCore::PlatformMediaResourceLoader::LoadOptions, CompletionHandler<void()>&&);
8284
8385 friend class MediaPlayerRemoteFactory;
8486 void getSupportedTypes(WebCore::MediaPlayerEnums::MediaEngineIdentifier, HashSet<String, ASCIICaseInsensitiveHash>&);

Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.messages.in

2121# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2222# THE POSSIBILITY OF SUCH DAMAGE.
2323
24 #if ENABLE(VIDEO)
 24#if ENABLE(GPU_PROCESS)
2525
2626messages -> RemoteMediaPlayerManager NotRefCounted {
27 
2827 NetworkStateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, enum:uint8_t WebCore::MediaPlayerEnums::NetworkState state)
2928 ReadyStateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, enum:uint8_t WebCore::MediaPlayerEnums::ReadyState state)
3029 VolumeChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, double volume)

@@messages -> RemoteMediaPlayerManager NotRefCounted {
3433 RateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, double rate)
3534 PlaybackStateChanged(WebKit::MediaPlayerPrivateRemoteIdentifier id, bool paused)
3635 EngineFailedToLoad(WebKit::MediaPlayerPrivateRemoteIdentifier id, int platformErrorCode)
 36
 37 RequestResource(WebKit::MediaPlayerPrivateRemoteIdentifier mediaPlayerPrivateRemoteIdentifier, WebKit::RemoteMediaResourceIdentifier remoteMediaResourceIdentifier, WebCore::ResourceRequest request, enum:uint8_t WebCore::PlatformMediaResourceLoader::LoadOptions options) -> () Async
3738}
3839
3940#endif

Source/WebKit/WebProcess/GPU/media/RemoteMediaResourceProxy.cpp

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "RemoteMediaResourceProxy.h"
 28
 29#if ENABLE(GPU_PROCESS)
 30
 31#include "RemoteMediaResourceManagerMessages.h"
 32#include "WebCoreArgumentCoders.h"
 33#include <WebCore/PolicyChecker.h>
 34#include <wtf/CompletionHandler.h>
 35
 36namespace WebKit {
 37
 38RemoteMediaResourceProxy::RemoteMediaResourceProxy(Ref<IPC::Connection>&& connection, RemoteMediaResourceIdentifier id)
 39 : m_gpuProcessConnection(WTFMove(connection))
 40 , m_id(id)
 41{
 42}
 43
 44RemoteMediaResourceProxy::~RemoteMediaResourceProxy()
 45{
 46}
 47
 48void RemoteMediaResourceProxy::responseReceived(WebCore::PlatformMediaResource&, const WebCore::ResourceResponse& response, CompletionHandler<void(WebCore::ShouldContinue)>&& completionHandler)
 49{
 50 m_gpuProcessConnection->sendWithAsyncReply(Messages::RemoteMediaResourceManager::ResponseReceived(m_id, response), [completionHandler = WTFMove(completionHandler)]() mutable {
 51 completionHandler(WebCore::ShouldContinue::Yes);
 52 });
 53}
 54
 55void RemoteMediaResourceProxy::redirectReceived(WebCore::PlatformMediaResource&, WebCore::ResourceRequest&& request, const WebCore::ResourceResponse& response, CompletionHandler<void(WebCore::ResourceRequest&&)>&& completionHandler)
 56{
 57 m_gpuProcessConnection->sendWithAsyncReply(Messages::RemoteMediaResourceManager::RedirectReceived(m_id, request, response), [completionHandler = WTFMove(completionHandler), request = WTFMove(request)]() mutable {
 58 completionHandler(WTFMove(request));
 59 });
 60}
 61
 62bool RemoteMediaResourceProxy::shouldCacheResponse(WebCore::PlatformMediaResource&, const WebCore::ResourceResponse&)
 63{
 64 return true;
 65}
 66
 67void RemoteMediaResourceProxy::dataSent(WebCore::PlatformMediaResource&, unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
 68{
 69 m_gpuProcessConnection->send(Messages::RemoteMediaResourceManager::DataSent(m_id, bytesSent, totalBytesToBeSent), 0);
 70}
 71
 72void RemoteMediaResourceProxy::dataReceived(WebCore::PlatformMediaResource&, const char* data, int length)
 73{
 74 m_gpuProcessConnection->send(Messages::RemoteMediaResourceManager::DataReceived(m_id, data, length), 0);
 75}
 76
 77void RemoteMediaResourceProxy::accessControlCheckFailed(WebCore::PlatformMediaResource&, const WebCore::ResourceError& error)
 78{
 79 m_gpuProcessConnection->send(Messages::RemoteMediaResourceManager::AccessControlCheckFailed(m_id, error), 0);
 80}
 81
 82void RemoteMediaResourceProxy::loadFailed(WebCore::PlatformMediaResource&, const WebCore::ResourceError& error)
 83{
 84 m_gpuProcessConnection->send(Messages::RemoteMediaResourceManager::LoadFailed(m_id, error), 0);
 85}
 86
 87void RemoteMediaResourceProxy::loadFinished(WebCore::PlatformMediaResource&)
 88{
 89 m_gpuProcessConnection->send(Messages::RemoteMediaResourceManager::LoadFinished(m_id), 0);
 90}
 91
 92}
 93
 94#endif

Source/WebKit/WebProcess/GPU/media/RemoteMediaResourceProxy.h

 1/*
 2 * Copyright (C) 2019 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 23 * THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#pragma once
 27
 28#if ENABLE(GPU_PROCESS)
 29
 30#include "Connection.h"
 31#include "RemoteMediaResourceIdentifier.h"
 32#include <WebCore/PlatformMediaResourceLoader.h>
 33#include <WebCore/ResourceResponse.h>
 34
 35namespace WebKit {
 36
 37class RemoteMediaResourceProxy : public WebCore::PlatformMediaResourceClient {
 38 WTF_MAKE_FAST_ALLOCATED;
 39public:
 40 RemoteMediaResourceProxy(Ref<IPC::Connection>&&, RemoteMediaResourceIdentifier);
 41 ~RemoteMediaResourceProxy();
 42
 43 // PlatformMediaResourceClient
 44 void responseReceived(WebCore::PlatformMediaResource&, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ShouldContinue)>&&);
 45 void redirectReceived(WebCore::PlatformMediaResource&, WebCore::ResourceRequest&&, const WebCore::ResourceResponse&, CompletionHandler<void(WebCore::ResourceRequest&&)>&&);
 46 bool shouldCacheResponse(WebCore::PlatformMediaResource&, const WebCore::ResourceResponse&);
 47 void dataSent(WebCore::PlatformMediaResource&, unsigned long long, unsigned long long);
 48 void dataReceived(WebCore::PlatformMediaResource&, const char*, int);
 49 void accessControlCheckFailed(WebCore::PlatformMediaResource&, const WebCore::ResourceError&);
 50 void loadFailed(WebCore::PlatformMediaResource&, const WebCore::ResourceError&);
 51 void loadFinished(WebCore::PlatformMediaResource&);
 52
 53private:
 54 Ref<IPC::Connection> m_gpuProcessConnection;
 55 RemoteMediaResourceIdentifier m_id;
 56};
 57
 58} // namespace WebKit
 59
 60#endif