~mmach/netext73/webkit2gtk

« back to all changes in this revision

Viewing changes to Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h

  • Committer: mmach
  • Date: 2023-06-16 17:21:37 UTC
  • Revision ID: netbit73@gmail.com-20230616172137-2rqx6yr96ga9g3kp
1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 "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>
 
38
 
 
39
namespace WebKit {
 
40
 
 
41
class GPUProcess;
 
42
class LibWebRTCCodecsProxy;
 
43
class RemoteAudioMediaStreamTrackRendererManager;
 
44
class RemoteMediaPlayerManagerProxy;
 
45
class RemoteMediaRecorderManager;
 
46
class RemoteMediaResourceManager;
 
47
class RemoteSampleBufferDisplayLayerManager;
 
48
class UserMediaCaptureManagerProxy;
 
49
 
 
50
class GPUConnectionToWebProcess
 
51
    : public RefCounted<GPUConnectionToWebProcess>
 
52
    , IPC::Connection::Client {
 
53
public:
 
54
    static Ref<GPUConnectionToWebProcess> create(GPUProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier, PAL::SessionID);
 
55
    virtual ~GPUConnectionToWebProcess();
 
56
 
 
57
    IPC::Connection& connection() { return m_connection.get(); }
 
58
    GPUProcess& gpuProcess() { return m_gpuProcess.get(); }
 
59
 
 
60
    void cleanupForSuspension(Function<void()>&&);
 
61
    void endSuspension();
 
62
 
 
63
    WebCore::ProcessIdentifier webProcessIdentifier() const { return m_webProcessIdentifier; }
 
64
    RemoteMediaResourceManager& remoteMediaResourceManager();
 
65
 
 
66
    Logger& logger();
 
67
 
 
68
    const String& mediaCacheDirectory() const;
 
69
#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
 
70
    const String& mediaKeysStorageDirectory() const;
 
71
#endif
 
72
 
 
73
private:
 
74
    GPUConnectionToWebProcess(GPUProcess&, WebCore::ProcessIdentifier, IPC::Connection::Identifier, PAL::SessionID);
 
75
 
 
76
    RemoteMediaPlayerManagerProxy& remoteMediaPlayerManagerProxy();
 
77
#if PLATFORM(COCOA) && USE(LIBWEBRTC)
 
78
    LibWebRTCCodecsProxy& libWebRTCCodecsProxy();
 
79
#endif
 
80
#if PLATFORM(COCOA) && ENABLE(MEDIA_STREAM)
 
81
    UserMediaCaptureManagerProxy& userMediaCaptureManagerProxy();
 
82
    RemoteMediaRecorderManager& mediaRecorderManager();
 
83
#if ENABLE(VIDEO_TRACK)
 
84
    RemoteAudioMediaStreamTrackRendererManager& audioTrackRendererManager();
 
85
    RemoteSampleBufferDisplayLayerManager& sampleBufferDisplayLayerManager();
 
86
#endif
 
87
#endif
 
88
 
 
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;
 
94
 
 
95
    RefPtr<Logger> m_logger;
 
96
 
 
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;
 
109
#endif
 
110
#endif
 
111
#if PLATFORM(COCOA) && USE(LIBWEBRTC)
 
112
    std::unique_ptr<LibWebRTCCodecsProxy> m_libWebRTCCodecsProxy;
 
113
#endif
 
114
};
 
115
 
 
116
} // namespace WebKit
 
117
 
 
118
#endif // ENABLE(GPU_PROCESS)