2
* Copyright (C) 2019 Apple Inc. All rights reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
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.
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.
28
#if ENABLE(GPU_PROCESS)
30
#include "Connection.h"
31
#include "GPUConnectionToWebProcessMessagesReplies.h"
32
#include <WebCore/DisplayListItems.h>
33
#include <WebCore/ProcessIdentifier.h>
34
#include <pal/SessionID.h>
35
#include <wtf/Logger.h>
36
#include <wtf/RefCounted.h>
37
#include <wtf/UniqueRef.h>
42
class LibWebRTCCodecsProxy;
43
class RemoteAudioMediaStreamTrackRendererManager;
44
class RemoteMediaPlayerManagerProxy;
45
class RemoteMediaRecorderManager;
46
class RemoteMediaResourceManager;
47
class RemoteSampleBufferDisplayLayerManager;
48
class UserMediaCaptureManagerProxy;
50
class GPUConnectionToWebProcess
51
: public RefCounted<GPUConnectionToWebProcess>
52
, IPC::Connection::Client {
54
static Ref<GPUConnectionToWebProcess> create(GPUProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier, PAL::SessionID);
55
virtual ~GPUConnectionToWebProcess();
57
IPC::Connection& connection() { return m_connection.get(); }
58
GPUProcess& gpuProcess() { return m_gpuProcess.get(); }
60
void cleanupForSuspension(Function<void()>&&);
63
WebCore::ProcessIdentifier webProcessIdentifier() const { return m_webProcessIdentifier; }
64
RemoteMediaResourceManager& remoteMediaResourceManager();
68
const String& mediaCacheDirectory() const;
69
#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
70
const String& mediaKeysStorageDirectory() const;
74
GPUConnectionToWebProcess(GPUProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier, PAL::SessionID);
76
RemoteMediaPlayerManagerProxy& remoteMediaPlayerManagerProxy();
77
#if PLATFORM(COCOA) && USE(LIBWEBRTC)
78
LibWebRTCCodecsProxy& libWebRTCCodecsProxy();
80
#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
81
UserMediaCaptureManagerProxy& userMediaCaptureManagerProxy();
82
RemoteMediaRecorderManager& mediaRecorderManager();
83
#if ENABLE(VIDEO_TRACK)
84
RemoteAudioMediaStreamTrackRendererManager& audioTrackRendererManager();
85
RemoteSampleBufferDisplayLayerManager& sampleBufferDisplayLayerManager();
89
// IPC::Connection::Client
90
void didClose(IPC::Connection&) final;
91
void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) final;
92
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
93
void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) final;
95
RefPtr<Logger> m_logger;
97
Ref<IPC::Connection> m_connection;
98
Ref<GPUProcess> m_gpuProcess;
99
const WebCore::ProcessIdentifier m_webProcessIdentifier;
100
std::unique_ptr<RemoteMediaResourceManager> m_remoteMediaResourceManager;
101
std::unique_ptr<RemoteMediaPlayerManagerProxy> m_remoteMediaPlayerManagerProxy;
102
PAL::SessionID m_sessionID;
103
#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
104
std::unique_ptr<UserMediaCaptureManagerProxy> m_userMediaCaptureManagerProxy;
105
std::unique_ptr<RemoteMediaRecorderManager> m_remoteMediaRecorderManager;
106
#if ENABLE(VIDEO_TRACK)
107
std::unique_ptr<RemoteAudioMediaStreamTrackRendererManager> m_audioTrackRendererManager;
108
std::unique_ptr<RemoteSampleBufferDisplayLayerManager> m_sampleBufferDisplayLayerManager;
111
#if PLATFORM(COCOA) && USE(LIBWEBRTC)
112
std::unique_ptr<LibWebRTCCodecsProxy> m_libWebRTCCodecsProxy;
116
} // namespace WebKit
118
#endif // ENABLE(GPU_PROCESS)