Changeset 274758 in webkit
- Timestamp:
- Mar 22, 2021 11:29:36 AM (16 months ago)
- Location:
- trunk
- Files:
-
- 9 added
- 45 edited
- 7 copied
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Headers.cmake (modified) (4 diffs)
-
Source/WebCore/Modules/mediastream/DetachedRTCDataChannel.h (added)
-
Source/WebCore/Modules/mediastream/RTCDataChannel.cpp (modified) (6 diffs)
-
Source/WebCore/Modules/mediastream/RTCDataChannel.h (modified) (3 diffs)
-
Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.cpp (added)
-
Source/WebCore/Modules/mediastream/RTCDataChannelRemoteHandler.h (added)
-
Source/WebCore/Modules/mediastream/RTCDataChannelRemoteSource.cpp (copied) (copied from trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h) (2 diffs)
-
Source/WebCore/Modules/mediastream/RTCDataChannelRemoteSource.h (added)
-
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp (modified) (1 diff)
-
Source/WebCore/Modules/webaudio/AudioWorkletMessagingProxy.cpp (modified) (2 diffs)
-
Source/WebCore/Modules/webaudio/AudioWorkletMessagingProxy.h (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (13 diffs)
-
Source/WebCore/bindings/js/SerializedScriptValue.cpp (modified) (1 diff)
-
Source/WebCore/bindings/js/SerializedScriptValue.h (modified) (5 diffs)
-
Source/WebCore/dom/Document.cpp (modified) (1 diff)
-
Source/WebCore/dom/Document.h (modified) (1 diff)
-
Source/WebCore/dom/ScriptExecutionContext.h (modified) (3 diffs)
-
Source/WebCore/platform/ScriptExecutionContextIdentifier.h (copied) (copied from trunk/Source/WebCore/platform/mediastream/RTCDataChannelState.h) (2 diffs)
-
Source/WebCore/platform/mediastream/RTCDataChannelHandler.h (modified) (3 diffs)
-
Source/WebCore/platform/mediastream/RTCDataChannelIdentifier.h (copied) (copied from trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h) (2 diffs)
-
Source/WebCore/platform/mediastream/RTCDataChannelRemoteHandlerConnection.h (copied) (copied from trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h) (2 diffs)
-
Source/WebCore/platform/mediastream/RTCDataChannelRemoteSourceConnection.h (copied) (copied from trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h) (2 diffs)
-
Source/WebCore/platform/mediastream/RTCDataChannelState.h (modified) (2 diffs)
-
Source/WebCore/platform/mediastream/RTCPriorityType.h (modified) (2 diffs)
-
Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h (modified) (2 diffs)
-
Source/WebCore/workers/WorkerGlobalScope.cpp (modified) (1 diff)
-
Source/WebCore/workers/WorkerGlobalScope.h (modified) (1 diff)
-
Source/WebCore/workers/WorkerLoaderProxy.h (modified) (1 diff)
-
Source/WebCore/workers/WorkerMessagingProxy.cpp (modified) (2 diffs)
-
Source/WebCore/workers/WorkerMessagingProxy.h (modified) (1 diff)
-
Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp (modified) (2 diffs)
-
Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h (modified) (1 diff)
-
Source/WebKit/CMakeLists.txt (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/DerivedSources-input.xcfilelist (modified) (2 diffs)
-
Source/WebKit/DerivedSources-output.xcfilelist (modified) (1 diff)
-
Source/WebKit/DerivedSources.make (modified) (2 diffs)
-
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (modified) (3 diffs)
-
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (modified) (4 diffs)
-
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkProcess.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkProcess.h (modified) (3 diffs)
-
Source/WebKit/NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.cpp (added)
-
Source/WebKit/NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.h (added)
-
Source/WebKit/NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.messages.in (copied) (copied from trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in) (2 diffs)
-
Source/WebKit/Sources.txt (modified) (3 diffs)
-
Source/WebKit/WebKit.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/Network/NetworkProcessConnection.h (modified) (2 diffs)
-
Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in (modified) (1 diff)
-
Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.h (modified) (1 diff)
-
Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp (added)
-
Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.h (added)
-
Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.messages.in (copied) (copied from trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in) (2 diffs)
-
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (modified) (3 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Tools/TestWebKitAPI/Tests/WebKit/WebRTC.mm (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r274756 r274758 1 2021-03-22 Youenn Fablet <youenn@apple.com> 2 3 Implement RTCDataChannel transfer out of process 4 https://bugs.webkit.org/show_bug.cgi?id=223443 5 6 Reviewed by Eric Carlson. 7 8 Add support for serialization/deserialization of RTCDataChannel information so that it can be MessagePort transfered or transfered to out-of-process contexts like Window or Service Worker. 9 Add infrastructure for remote sources (that allows to send data or close data channels) and remote handlers which receive messages from out-of-process data channels. 10 11 Covered by API tests. 12 13 * Modules/mediastream/DetachedRTCDataChannel.h: Added. 14 (WebCore::DetachedRTCDataChannel::DetachedRTCDataChannel): 15 (WebCore::DetachedRTCDataChannel::memoryCost const): 16 (WebCore::DetachedRTCDataChannel::encode const): 17 (WebCore::DetachedRTCDataChannel::decode): 18 * Modules/mediastream/RTCDataChannel.cpp: 19 (WebCore::RTCDataChannel::RTCDataChannel): 20 (WebCore::rtcDataChannelLocalMap): 21 (WebCore::RTCDataChannel::handlerFromIdentifier): 22 (WebCore::RTCDataChannel::create): 23 * Modules/mediastream/RTCDataChannel.h: 24 * Modules/mediastream/RTCDataChannelRemoteHandler.cpp: Added. 25 (WebCore::RTCDataChannelRemoteHandler::create): 26 (WebCore::RTCDataChannelRemoteHandler::RTCDataChannelRemoteHandler): 27 (WebCore::RTCDataChannelRemoteHandler::~RTCDataChannelRemoteHandler): 28 (WebCore::RTCDataChannelRemoteHandler::didChangeReadyState): 29 (WebCore::RTCDataChannelRemoteHandler::didReceiveStringData): 30 (WebCore::RTCDataChannelRemoteHandler::didReceiveRawData): 31 (WebCore::RTCDataChannelRemoteHandler::didDetectError): 32 (WebCore::RTCDataChannelRemoteHandler::bufferedAmountIsDecreasing): 33 (WebCore::RTCDataChannelRemoteHandler::readyToSend): 34 (WebCore::RTCDataChannelRemoteHandler::setClient): 35 (WebCore::RTCDataChannelRemoteHandler::sendStringData): 36 (WebCore::RTCDataChannelRemoteHandler::sendRawData): 37 (WebCore::RTCDataChannelRemoteHandler::close): 38 * Modules/mediastream/RTCDataChannelRemoteHandler.h: Added. 39 * Modules/mediastream/RTCDataChannelRemoteSource.cpp: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h. 40 (WebCore::RTCDataChannelRemoteSource::RTCDataChannelRemoteSource): 41 (WebCore::RTCDataChannelRemoteSource::~RTCDataChannelRemoteSource): 42 * Modules/mediastream/RTCDataChannelRemoteSource.h: Added. 43 (WebCore::RTCDataChannelRemoteSource::create): 44 (WebCore::RTCDataChannelRemoteSource::sendStringData): 45 (WebCore::RTCDataChannelRemoteSource::sendRawData): 46 (WebCore::RTCDataChannelRemoteSource::close): 47 * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: 48 (WebCore::LibWebRTCDataChannelHandler::postTask): 49 * Modules/webaudio/AudioWorkletMessagingProxy.cpp: 50 (WebCore::AudioWorkletMessagingProxy::createRTCDataChannelRemoteHandlerConnection): 51 * Modules/webaudio/AudioWorkletMessagingProxy.h: 52 * Sources.txt: 53 * WebCore.xcodeproj/project.pbxproj: 54 * bindings/js/SerializedScriptValue.cpp: 55 (WebCore::SerializedScriptValue::SerializedScriptValue): 56 * bindings/js/SerializedScriptValue.h: 57 (WebCore::SerializedScriptValue::encode const): 58 (WebCore::SerializedScriptValue::decode): 59 * dom/Document.cpp: 60 (WebCore::Document::createRTCDataChannelRemoteHandlerConnection): 61 * dom/Document.h: 62 * dom/ScriptExecutionContext.h: 63 (WebCore::ScriptExecutionContext::createRTCDataChannelRemoteHandlerConnection): 64 * platform/ScriptExecutionContextIdentifier.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelState.h. 65 * platform/mediastream/RTCDataChannelHandler.h: 66 (WebCore::RTCDataChannelInit::encode const): 67 (WebCore::RTCDataChannelInit::decode): 68 * platform/mediastream/RTCDataChannelIdentifier.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h. 69 (WebCore::RTCDataChannelIdentifier::encode const): 70 (WebCore::RTCDataChannelIdentifier::decode): 71 * platform/mediastream/RTCDataChannelRemoteHandlerConnection.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h. 72 * platform/mediastream/RTCDataChannelRemoteSourceConnection.h: Copied from Source/WebCore/platform/mediastream/RTCDataChannelHandler.h. 73 * platform/mediastream/RTCDataChannelState.h: 74 * platform/mediastream/RTCPriorityType.h: 75 * platform/mediastream/libwebrtc/LibWebRTCProvider.h: 76 * workers/WorkerGlobalScope.cpp: 77 (WebCore::WorkerGlobalScope::createRTCDataChannelRemoteHandlerConnection): 78 * workers/WorkerGlobalScope.h: 79 * workers/WorkerLoaderProxy.h: 80 * workers/WorkerMessagingProxy.cpp: 81 (WebCore::WorkerMessagingProxy::createRTCDataChannelRemoteHandlerConnection): 82 * workers/WorkerMessagingProxy.h: 83 * workers/service/context/ServiceWorkerThreadProxy.cpp: 84 (WebCore::ServiceWorkerThreadProxy::createRTCDataChannelRemoteHandlerConnection): 85 * workers/service/context/ServiceWorkerThreadProxy.h: 86 1 87 2021-03-22 Simon Fraser <simon.fraser@apple.com> 2 88 -
trunk/Source/WebCore/Headers.cmake
r273776 r274758 104 104 Modules/mediasource/SampleMap.h 105 105 106 Modules/mediastream/DetachedRTCDataChannel.h 106 107 Modules/mediastream/DoubleRange.h 107 108 Modules/mediastream/LongRange.h … … 109 110 Modules/mediastream/MediaTrackConstraints.h 110 111 Modules/mediastream/RTCController.h 112 Modules/mediastream/RTCDataChannel.h 113 Modules/mediastream/RTCDataChannelRemoteHandler.h 114 Modules/mediastream/RTCDataChannelRemoteSource.h 111 115 Modules/mediastream/STUNMessageParsing.h 112 116 Modules/mediastream/UserMediaClient.h … … 1081 1085 platform/SSLKeyGenerator.h 1082 1086 platform/ScreenProperties.h 1087 platform/ScriptExecutionContextIdentifier.h 1083 1088 platform/ScrollAnimator.h 1084 1089 platform/ScrollTypes.h … … 1366 1371 platform/mediastream/MediaStreamRequest.h 1367 1372 platform/mediastream/MediaStreamTrackPrivate.h 1373 platform/mediastream/RTCDataChannelHandler.h 1374 platform/mediastream/RTCDataChannelHandlerClient.h 1375 platform/mediastream/RTCDataChannelIdentifier.h 1376 platform/mediastream/RTCDataChannelRemoteHandlerConnection.h 1377 platform/mediastream/RTCDataChannelRemoteSourceConnection.h 1378 platform/mediastream/RTCDataChannelState.h 1379 platform/mediastream/RTCPriorityType.h 1368 1380 platform/mediastream/RealtimeMediaSource.h 1369 1381 platform/mediastream/RealtimeMediaSourceCapabilities.h -
trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp
r274351 r274758 34 34 #include "Logging.h" 35 35 #include "MessageEvent.h" 36 #include "RTCDataChannelRemoteHandler.h" 36 37 #include "ScriptExecutionContext.h" 37 38 #include "SharedBuffer.h" … … 94 95 : ActiveDOMObject(&context) 95 96 , m_handler(WTFMove(handler)) 96 , m_identifier(RTCDataChannelIdentifier { Process::identifier(), ObjectIdentifier<RTCDataChannel IdentifierType>::generateThreadSafe() })97 , m_identifier(RTCDataChannelIdentifier { Process::identifier(), ObjectIdentifier<RTCDataChannelLocalIdentifierType>::generateThreadSafe() }) 97 98 , m_contextIdentifier(context.isDocument() ? ScriptExecutionContextIdentifier { } : context.contextIdentifier()) 98 99 , m_label(WTFMove(label)) … … 253 254 254 255 static Lock s_rtcDataChannelLocalMapLock; 255 static HashMap< ObjectIdentifier<RTCDataChannelIdentifierType>, std::unique_ptr<RTCDataChannelHandler>>& rtcDataChannelLocalMap()256 static HashMap<RTCDataChannelLocalIdentifier, std::unique_ptr<RTCDataChannelHandler>>& rtcDataChannelLocalMap() 256 257 { 257 258 ASSERT(s_rtcDataChannelLocalMapLock.isHeld()); 258 static LazyNeverDestroyed<HashMap< ObjectIdentifier<RTCDataChannelIdentifierType>, std::unique_ptr<RTCDataChannelHandler>>> map;259 static LazyNeverDestroyed<HashMap<RTCDataChannelLocalIdentifier, std::unique_ptr<RTCDataChannelHandler>>> map; 259 260 static std::once_flag onceKey; 260 261 std::call_once(onceKey, [&] { … … 294 295 } 295 296 297 std::unique_ptr<RTCDataChannelHandler> RTCDataChannel::handlerFromIdentifier(RTCDataChannelLocalIdentifier channelIdentifier) 298 { 299 auto locker = holdLock(s_rtcDataChannelLocalMapLock); 300 return rtcDataChannelLocalMap().take(channelIdentifier); 301 } 302 296 303 static Ref<RTCDataChannel> createClosedChannel(ScriptExecutionContext& context, String&& label, RTCDataChannelInit&& options) 297 304 { … … 303 310 Ref<RTCDataChannel> RTCDataChannel::create(ScriptExecutionContext& context, RTCDataChannelIdentifier identifier, String&& label, RTCDataChannelInit&& options, RTCDataChannelState state) 304 311 { 305 if (identifier.processIdentifier != Process::identifier()) { 306 RELEASE_LOG_ERROR(WebRTC, "Out-of-process data channels are not yet supported"); 307 return createClosedChannel(context, WTFMove(label), WTFMove(options)); 308 } 309 310 auto locker = holdLock(s_rtcDataChannelLocalMapLock); 311 auto handler = rtcDataChannelLocalMap().take(identifier.channelIdentifier); 312 RTCDataChannelRemoteHandler* remoteHandlerPtr = nullptr; 313 std::unique_ptr<RTCDataChannelHandler> handler; 314 if (identifier.processIdentifier == Process::identifier()) 315 handler = RTCDataChannel::handlerFromIdentifier(identifier.channelIdentifier); 316 else { 317 auto remoteHandler = RTCDataChannelRemoteHandler::create(identifier, context.createRTCDataChannelRemoteHandlerConnection()); 318 remoteHandlerPtr = remoteHandler.get(); 319 handler = WTFMove(remoteHandler); 320 } 321 312 322 if (!handler) 313 323 return createClosedChannel(context, WTFMove(label), WTFMove(options)); … … 315 325 auto channel = RTCDataChannel::create(context, WTFMove(handler), WTFMove(label), WTFMove(options)); 316 326 channel->m_readyState = state; 327 328 if (remoteHandlerPtr) 329 remoteHandlerPtr->setLocalIdentifier(channel->identifier()); 330 317 331 return channel; 318 332 } -
trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.h
r274351 r274758 29 29 30 30 #include "ActiveDOMObject.h" 31 #include "DetachedRTCDataChannel.h" 31 32 #include "Event.h" 32 33 #include "EventTarget.h" 33 34 #include "ExceptionOr.h" 34 35 #include "NetworkSendQueue.h" 35 #include "ProcessIdentifier.h"36 36 #include "RTCDataChannelHandler.h" 37 37 #include "RTCDataChannelHandlerClient.h" 38 #include "RTCDataChannelIdentifier.h" 38 39 #include "ScriptExecutionContext.h" 39 40 #include "ScriptWrappable.h" … … 49 50 class Blob; 50 51 class RTCPeerConnectionHandler; 51 52 enum RTCDataChannelIdentifierType { };53 struct RTCDataChannelIdentifier {54 ProcessIdentifier processIdentifier;55 ObjectIdentifier<RTCDataChannelIdentifierType> channelIdentifier;56 57 template<class Encoder> void encode(Encoder&) const;58 template<class Decoder> static Optional<RTCDataChannelIdentifier> decode(Decoder&);59 60 #if !LOG_DISABLED61 String logString() const;62 #endif63 };64 65 struct DetachedRTCDataChannel {66 WTF_MAKE_NONCOPYABLE(DetachedRTCDataChannel);67 WTF_MAKE_FAST_ALLOCATED;68 public:69 DetachedRTCDataChannel(RTCDataChannelIdentifier identifier, const String& label, const RTCDataChannelInit& options, RTCDataChannelState state)70 : identifier(identifier)71 , label(label.isolatedCopy())72 , options(options.isolatedCopy())73 , state(state)74 {75 }76 77 size_t memoryCost() const { return label.sizeInBytes(); }78 79 RTCDataChannelIdentifier identifier;80 String label;81 RTCDataChannelInit options;82 RTCDataChannelState state { RTCDataChannelState::Closed };83 };84 52 85 53 class RTCDataChannel final : public ActiveDOMObject, public RTCDataChannelHandlerClient, public EventTargetWithInlineData { … … 120 88 using RTCDataChannelHandlerClient::ref; 121 89 using RTCDataChannelHandlerClient::deref; 90 91 WEBCORE_EXPORT static std::unique_ptr<RTCDataChannelHandler> handlerFromIdentifier(RTCDataChannelLocalIdentifier); 122 92 123 93 private: -
trunk/Source/WebCore/Modules/mediastream/RTCDataChannelRemoteSource.cpp
r274756 r274758 1 1 /* 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2017 Apple Inc. All rights reserved. 2 * Copyright (C) 2021 Apple Inc. All rights reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 24 23 */ 25 24 26 #pragma once 25 #include "config.h" 26 #include "RTCDataChannelRemoteSource.h" 27 27 28 28 #if ENABLE(WEB_RTC) 29 29 30 #include "RTCPriorityType.h" 31 #include "ScriptExecutionContext.h" 32 #include <wtf/Optional.h> 33 #include <wtf/text/WTFString.h> 30 #include "RTCDataChannelHandler.h" 34 31 35 32 namespace WebCore { 36 33 37 struct RTCDataChannelInit { 38 Optional<bool> ordered; 39 Optional<unsigned short> maxPacketLifeTime; 40 Optional<unsigned short> maxRetransmits; 41 String protocol; 42 Optional<bool> negotiated; 43 Optional<unsigned short> id; 44 RTCPriorityType priority { RTCPriorityType::Low }; 45 46 RTCDataChannelInit isolatedCopy() const; 47 }; 48 49 inline RTCDataChannelInit RTCDataChannelInit::isolatedCopy() const 34 RTCDataChannelRemoteSource::RTCDataChannelRemoteSource(RTCDataChannelIdentifier identifier, UniqueRef<RTCDataChannelHandler>&& handler, Ref<RTCDataChannelRemoteSourceConnection>&& connection) 35 : m_identifier(identifier) 36 , m_handler(WTFMove(handler)) 37 , m_connection(WTFMove(connection)) 50 38 { 51 auto copy = *this; 52 copy.protocol = protocol.isolatedCopy(); 53 return copy; 39 // FIXME: We should ask m_handler to call us on its own background thread. 40 m_handler->setClient(*this, { }); 54 41 } 55 42 56 class RTCDataChannelHandlerClient; 57 58 class RTCDataChannelHandler { 59 public: 60 virtual ~RTCDataChannelHandler() = default; 61 62 virtual void setClient(RTCDataChannelHandlerClient&, ScriptExecutionContextIdentifier) = 0; 63 64 virtual bool sendStringData(const CString&) = 0; 65 virtual bool sendRawData(const char*, size_t) = 0; 66 virtual void close() = 0; 67 }; 43 RTCDataChannelRemoteSource::~RTCDataChannelRemoteSource() 44 { 45 } 68 46 69 47 } // namespace WebCore -
trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp
r274351 r274758 193 193 ASSERT(m_clientLock.isHeld()); 194 194 195 if (!m_contextIdentifier) 195 if (!m_contextIdentifier) { 196 196 callOnMainThread(WTFMove(function)); 197 return; 198 } 197 199 ScriptExecutionContext::postTaskTo(m_contextIdentifier, WTFMove(function)); 198 200 } -
trunk/Source/WebCore/Modules/webaudio/AudioWorkletMessagingProxy.cpp
r270806 r274758 38 38 #include "Document.h" 39 39 #include "Frame.h" 40 #include "LibWebRTCProvider.h" 41 #include "Page.h" 40 42 #include "Settings.h" 41 43 #include "WorkletParameters.h" … … 86 88 } 87 89 90 RefPtr<RTCDataChannelRemoteHandlerConnection> AudioWorkletMessagingProxy::createRTCDataChannelRemoteHandlerConnection() 91 { 92 ASSERT(isMainThread()); 93 if (!m_document->page()) 94 return nullptr; 95 return m_document->page()->libWebRTCProvider().createRTCDataChannelRemoteHandlerConnection(); 96 } 97 88 98 void AudioWorkletMessagingProxy::postTaskToLoader(ScriptExecutionContext::Task&& task) 89 99 { -
trunk/Source/WebCore/Modules/webaudio/AudioWorkletMessagingProxy.h
r268103 r274758 60 60 // WorkerLoaderProxy. 61 61 RefPtr<CacheStorageConnection> createCacheStorageConnection() final; 62 RefPtr<RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final; 62 63 void postTaskToLoader(ScriptExecutionContext::Task&&) final; 63 64 bool postTaskForModeToWorkerOrWorkletGlobalScope(ScriptExecutionContext::Task&&, const String& mode) final; -
trunk/Source/WebCore/Sources.txt
r274750 r274758 161 161 Modules/mediastream/RTCDataChannel.cpp 162 162 Modules/mediastream/RTCDataChannelEvent.cpp 163 Modules/mediastream/RTCDataChannelRemoteHandler.cpp 164 Modules/mediastream/RTCDataChannelRemoteSource.cpp 163 165 Modules/mediastream/RTCEncodedAudioFrame.cpp 164 166 Modules/mediastream/RTCEncodedFrame.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r274755 r274758 933 933 316DCB4E1E7910A6001B5F87 /* JSRTCIceGatheringState.h in Headers */ = {isa = PBXBuildFile; fileRef = 316DCB481E7910A6001B5F87 /* JSRTCIceGatheringState.h */; }; 934 934 316DCB501E7910A6001B5F87 /* JSRTCSignalingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 316DCB4A1E7910A6001B5F87 /* JSRTCSignalingState.h */; }; 935 316DE7021E83AE1D0084C261 /* RTCDataChannelState.h in Headers */ = {isa = PBXBuildFile; fileRef = 316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */; };935 316DE7021E83AE1D0084C261 /* RTCDataChannelState.h in Headers */ = {isa = PBXBuildFile; fileRef = 316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */; settings = {ATTRIBUTES = (Private, ); }; }; 936 936 316FE0720E6CCBEE00BF6088 /* JSCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 316FE06E0E6CCBEE00BF6088 /* JSCSSKeyframeRule.h */; }; 937 937 316FE0740E6CCBEE00BF6088 /* JSCSSKeyframesRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 316FE0700E6CCBEE00BF6088 /* JSCSSKeyframesRule.h */; }; … … 1037 1037 41103AAD1E39791000769F03 /* RealtimeIncomingAudioSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 41103AA91E39790A00769F03 /* RealtimeIncomingAudioSource.h */; }; 1038 1038 41103AAD1E39791000769F14 /* RealtimeIncomingAudioSourceCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 41103AA91E39790A00769F14 /* RealtimeIncomingAudioSourceCocoa.h */; }; 1039 411223BA260244FE00B0A0B6 /* ScriptExecutionContextIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 411223B8260244FE00B0A0B6 /* ScriptExecutionContextIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1040 411223BE26025BC100B0A0B6 /* RTCDataChannelRemoteSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 416EDBEF25FFB22400092675 /* RTCDataChannelRemoteSource.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1041 411223C52603567D00B0A0B6 /* DetachedRTCDataChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 411223C32603567C00B0A0B6 /* DetachedRTCDataChannel.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1039 1042 4112B5431F9F9CA000E67875 /* ServiceWorkerThreadProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4112B53F1F9F9C9B00E67875 /* ServiceWorkerThreadProxy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1040 1043 4114FE3225BEBD19009D9F20 /* RTCRtcpParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 4114FE2F25BEBD18009D9F20 /* RTCRtcpParameters.h */; }; … … 1062 1065 413C8B342552F27D00E65055 /* RTCRtpTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 413C8B2F2552F27B00E65055 /* RTCRtpTransform.h */; }; 1063 1066 413C8B352552F27D00E65055 /* RTCRtpReceiverWithTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 413C8B302552F27C00E65055 /* RTCRtpReceiverWithTransform.h */; }; 1064 413CC11D25E7D98E00D59C4B /* RTCPriorityType.h in Headers */ = {isa = PBXBuildFile; fileRef = 413CC11C25E7D98D00D59C4B /* RTCPriorityType.h */; };1067 413CC11D25E7D98E00D59C4B /* RTCPriorityType.h in Headers */ = {isa = PBXBuildFile; fileRef = 413CC11C25E7D98D00D59C4B /* RTCPriorityType.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1065 1068 413CCD4A20DE034F0065A21A /* MockMediaDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 413CCD4820DE013C0065A21A /* MockMediaDevice.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1066 1069 413E00791DB0E4F2002341D2 /* MemoryRelease.h in Headers */ = {isa = PBXBuildFile; fileRef = 413E00781DB0E4DE002341D2 /* MemoryRelease.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 1099 1102 416E6FE91BBD12E5000A6053 /* WritableStreamBuiltins.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B03D8061BB3110D00B764E8 /* WritableStreamBuiltins.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1100 1103 416ECAE525B58CC400B34DA5 /* MediaSessionGroupIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 416ECAE325B58CC400B34DA5 /* MediaSessionGroupIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1104 416EDBF62600D67900092675 /* RTCDataChannelRemoteHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 416EDBF42600D67800092675 /* RTCDataChannelRemoteHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1105 416EDC002600E78800092675 /* RTCDataChannelIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 416EDBFF2600E78700092675 /* RTCDataChannelIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1106 416EDC022600E7B000092675 /* RTCDataChannelRemoteHandlerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 416EDC012600E7B000092675 /* RTCDataChannelRemoteHandlerConnection.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1107 416EDC042600E81000092675 /* RTCDataChannelRemoteSourceConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 416EDC032600E80F00092675 /* RTCDataChannelRemoteSourceConnection.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1101 1108 416FD25F240FA4E5006661D8 /* NowPlayingInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 416FD25D240EE1AE006661D8 /* NowPlayingInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1102 1109 417253AB1354BBBC00360F2A /* MediaControlTextTrackContainerElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 417253A91354BBBC00360F2A /* MediaControlTextTrackContainerElement.h */; }; … … 7648 7655 41114A7A2317B39E00B56007 /* WorkerMessagePortChannelProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WorkerMessagePortChannelProvider.h; sourceTree = "<group>"; }; 7649 7656 41114A7C2317B39E00B56007 /* WorkerMessagePortChannelProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerMessagePortChannelProvider.cpp; sourceTree = "<group>"; }; 7657 411223B8260244FE00B0A0B6 /* ScriptExecutionContextIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptExecutionContextIdentifier.h; sourceTree = "<group>"; }; 7658 411223C32603567C00B0A0B6 /* DetachedRTCDataChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetachedRTCDataChannel.h; sourceTree = "<group>"; }; 7650 7659 4112B53F1F9F9C9B00E67875 /* ServiceWorkerThreadProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerThreadProxy.h; sourceTree = "<group>"; }; 7651 7660 4112B5411F9F9C9C00E67875 /* ServiceWorkerThreadProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerThreadProxy.cpp; sourceTree = "<group>"; }; … … 7794 7803 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerReportingProxy.h; sourceTree = "<group>"; }; 7795 7804 416ECAE325B58CC400B34DA5 /* MediaSessionGroupIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionGroupIdentifier.h; sourceTree = "<group>"; }; 7805 416EDBED25FFB22400092675 /* RTCDataChannelRemoteSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTCDataChannelRemoteSource.cpp; sourceTree = "<group>"; }; 7806 416EDBEF25FFB22400092675 /* RTCDataChannelRemoteSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelRemoteSource.h; sourceTree = "<group>"; }; 7807 416EDBF42600D67800092675 /* RTCDataChannelRemoteHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelRemoteHandler.h; sourceTree = "<group>"; }; 7808 416EDBF72600D76300092675 /* RTCDataChannelRemoteHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTCDataChannelRemoteHandler.cpp; sourceTree = "<group>"; }; 7809 416EDBFF2600E78700092675 /* RTCDataChannelIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelIdentifier.h; sourceTree = "<group>"; }; 7810 416EDC012600E7B000092675 /* RTCDataChannelRemoteHandlerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelRemoteHandlerConnection.h; sourceTree = "<group>"; }; 7811 416EDC032600E80F00092675 /* RTCDataChannelRemoteSourceConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelRemoteSourceConnection.h; sourceTree = "<group>"; }; 7796 7812 416F807924509F3200B68F02 /* WindowDisplayCapturerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowDisplayCapturerMac.h; sourceTree = "<group>"; }; 7797 7813 416F807A24509F3200B68F02 /* ScreenDisplayCapturerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScreenDisplayCapturerMac.mm; sourceTree = "<group>"; }; … … 17242 17258 41C7E1061E6A54360027B4DE /* CanvasCaptureMediaStreamTrack.h */, 17243 17259 41C7E1081E6AA37C0027B4DE /* CanvasCaptureMediaStreamTrack.idl */, 17260 411223C32603567C00B0A0B6 /* DetachedRTCDataChannel.h */, 17244 17261 93A806111E03B51C008A1F26 /* DoubleRange.h */, 17245 17262 93A806121E03B51C008A1F26 /* DoubleRange.idl */, … … 17291 17308 07221B6717CEC32700848E51 /* RTCDataChannelEvent.h */, 17292 17309 07221B6817CEC32700848E51 /* RTCDataChannelEvent.idl */, 17310 416EDBF72600D76300092675 /* RTCDataChannelRemoteHandler.cpp */, 17311 416EDBF42600D67800092675 /* RTCDataChannelRemoteHandler.h */, 17312 416EDBED25FFB22400092675 /* RTCDataChannelRemoteSource.cpp */, 17313 416EDBEF25FFB22400092675 /* RTCDataChannelRemoteSource.h */, 17293 17314 41FCB75D214866FE0038ADC6 /* RTCDegradationPreference.h */, 17294 17315 41FCB755214865CF0038ADC6 /* RTCDegradationPreference.idl */, … … 17486 17507 07221BA217CF0AD400848E51 /* RTCDataChannelHandler.h */, 17487 17508 07221BA317CF0AD400848E51 /* RTCDataChannelHandlerClient.h */, 17509 416EDBFF2600E78700092675 /* RTCDataChannelIdentifier.h */, 17510 416EDC012600E7B000092675 /* RTCDataChannelRemoteHandlerConnection.h */, 17511 416EDC032600E80F00092675 /* RTCDataChannelRemoteSourceConnection.h */, 17488 17512 316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */, 17489 17513 41F2354422F5503300B4FCDB /* RTCDTMFSenderBackend.h */, … … 27812 27836 293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */, 27813 27837 C1E1D235203DF15400584665 /* ScreenProperties.h */, 27838 411223B8260244FE00B0A0B6 /* ScriptExecutionContextIdentifier.h */, 27814 27839 BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */, 27815 27840 BC8AE34D12EA096A00EB3AE6 /* ScrollableArea.h */, … … 31992 32017 9479493D1E0463B600018D85 /* DeprecatedCSSOMValueList.h in Headers */, 31993 32018 7CBD129E1F98B90E00127D29 /* DeprecatedGlobalSettings.h in Headers */, 32019 411223C52603567D00B0A0B6 /* DetachedRTCDataChannel.h in Headers */, 31994 32020 A7C9ABF91357A3BF00F5503F /* DetailsMarkerControl.h in Headers */, 31995 32021 A1ED778D1BE3294000DC1791 /* Device.h in Headers */, … … 34620 34646 078E093D17D16E1C00420AA1 /* RTCDataChannelHandlerClient.h in Headers */, 34621 34647 073794FA19F5864E00E5A045 /* RTCDataChannelHandlerMock.h in Headers */, 34648 416EDC002600E78800092675 /* RTCDataChannelIdentifier.h in Headers */, 34649 416EDBF62600D67900092675 /* RTCDataChannelRemoteHandler.h in Headers */, 34650 416EDC022600E7B000092675 /* RTCDataChannelRemoteHandlerConnection.h in Headers */, 34651 411223BE26025BC100B0A0B6 /* RTCDataChannelRemoteSource.h in Headers */, 34652 416EDC042600E81000092675 /* RTCDataChannelRemoteSourceConnection.h in Headers */, 34622 34653 316DE7021E83AE1D0084C261 /* RTCDataChannelState.h in Headers */, 34623 34654 078E092017D14D1C00420AA1 /* RTCDTMFSender.h in Headers */, … … 34688 34719 E3E4E2A81E3B17100023BB8A /* ScriptElementCachedScriptFetcher.h in Headers */, 34689 34720 E11C9D9B0EB3681200E409DB /* ScriptExecutionContext.h in Headers */, 34721 411223BA260244FE00B0A0B6 /* ScriptExecutionContextIdentifier.h in Headers */, 34690 34722 372D3E55216578AE00C5E021 /* ScriptModuleLoader.h in Headers */, 34691 34723 FD31603612B0267600C1A359 /* ScriptProcessorNode.h in Headers */, -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r274351 r274758 3827 3827 } 3828 3828 3829 SerializedScriptValue::SerializedScriptValue(Vector<uint8_t>&& buffer, std::unique_ptr<ArrayBufferContentsArray> arrayBufferContentsArray) 3829 SerializedScriptValue::SerializedScriptValue(Vector<uint8_t>&& buffer, std::unique_ptr<ArrayBufferContentsArray>&& arrayBufferContentsArray 3830 #if ENABLE(WEB_RTC) 3831 , Vector<std::unique_ptr<DetachedRTCDataChannel>>&& detachedRTCDataChannels 3832 #endif 3833 ) 3830 3834 : m_data(WTFMove(buffer)) 3831 3835 , m_arrayBufferContentsArray(WTFMove(arrayBufferContentsArray)) 3836 #if ENABLE(WEB_RTC) 3837 , m_detachedRTCDataChannels(WTFMove(detachedRTCDataChannels)) 3838 #endif 3832 3839 { 3833 3840 m_memoryCost = computeMemoryCost(); -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.h
r274351 r274758 27 27 #pragma once 28 28 29 #include "DetachedRTCDataChannel.h" 29 30 #include "ExceptionOr.h" 30 31 #include <JavaScriptCore/ArrayBuffer.h> … … 51 52 class DetachedOffscreenCanvas; 52 53 #endif 53 #if ENABLE(WEB_RTC)54 struct DetachedRTCDataChannel;55 #endif56 54 class IDBValue; 57 55 class MessagePort; … … 121 119 private: 122 120 WEBCORE_EXPORT SerializedScriptValue(Vector<unsigned char>&&); 123 WEBCORE_EXPORT SerializedScriptValue(Vector<unsigned char>&&, std::unique_ptr<ArrayBufferContentsArray>); 121 WEBCORE_EXPORT SerializedScriptValue(Vector<unsigned char>&&, std::unique_ptr<ArrayBufferContentsArray>&& 122 #if ENABLE(WEB_RTC) 123 , Vector<std::unique_ptr<DetachedRTCDataChannel>>&& 124 #endif 125 ); 126 124 127 SerializedScriptValue(Vector<unsigned char>&&, const Vector<String>& blobURLs, std::unique_ptr<ArrayBufferContentsArray>, std::unique_ptr<ArrayBufferContentsArray> sharedBuffers, Vector<Optional<ImageBitmapBacking>>&& backingStores 125 128 #if ENABLE(OFFSCREEN_CANVAS) … … 163 166 encoder << hasArray; 164 167 165 if (!hasArray) 166 return; 167 168 encoder << static_cast<uint64_t>(m_arrayBufferContentsArray->size()); 169 for (const auto &arrayBufferContents : *m_arrayBufferContentsArray) { 170 encoder << arrayBufferContents.sizeInBytes(); 171 encoder.encodeFixedLengthData(static_cast<const uint8_t*>(arrayBufferContents.data()), arrayBufferContents.sizeInBytes(), 1); 172 } 168 if (hasArray) { 169 encoder << static_cast<uint64_t>(m_arrayBufferContentsArray->size()); 170 for (const auto &arrayBufferContents : *m_arrayBufferContentsArray) { 171 encoder << arrayBufferContents.sizeInBytes(); 172 encoder.encodeFixedLengthData(static_cast<const uint8_t*>(arrayBufferContents.data()), arrayBufferContents.sizeInBytes(), 1); 173 } 174 } 175 176 #if ENABLE(WEB_RTC) 177 encoder << static_cast<uint64_t>(m_detachedRTCDataChannels.size()); 178 for (const auto &channel : m_detachedRTCDataChannels) 179 encoder << *channel; 180 #endif 173 181 } 174 182 … … 184 192 return nullptr; 185 193 186 if (!hasArray) 187 return adoptRef(*new SerializedScriptValue(WTFMove(data))); 188 189 uint64_t arrayLength; 190 if (!decoder.decode(arrayLength)) 194 std::unique_ptr<ArrayBufferContentsArray> arrayBufferContentsArray; 195 if (hasArray) { 196 uint64_t arrayLength; 197 if (!decoder.decode(arrayLength)) 198 return nullptr; 199 ASSERT(arrayLength); 200 201 arrayBufferContentsArray = makeUnique<ArrayBufferContentsArray>(); 202 while (arrayLength--) { 203 unsigned bufferSize; 204 if (!decoder.decode(bufferSize)) 205 return nullptr; 206 if (!decoder.template bufferIsLargeEnoughToContain<uint8_t>(bufferSize)) 207 return nullptr; 208 209 auto buffer = Gigacage::tryMalloc(Gigacage::Primitive, bufferSize); 210 if (!buffer) 211 return nullptr; 212 if (!decoder.decodeFixedLengthData(static_cast<uint8_t*>(buffer), bufferSize, 1)) { 213 Gigacage::free(Gigacage::Primitive, buffer); 214 return nullptr; 215 } 216 arrayBufferContentsArray->append({ buffer, bufferSize, ArrayBuffer::primitiveGigacageDestructor() }); 217 } 218 } 219 220 #if ENABLE(WEB_RTC) 221 uint64_t detachedRTCDataChannelsSize; 222 if (!decoder.decode(detachedRTCDataChannelsSize)) 191 223 return nullptr; 192 ASSERT(arrayLength); 193 194 auto arrayBufferContentsArray = makeUnique<ArrayBufferContentsArray>(); 195 while (arrayLength--) { 196 unsigned bufferSize; 197 if (!decoder.decode(bufferSize)) 224 225 Vector<std::unique_ptr<DetachedRTCDataChannel>> detachedRTCDataChannels; 226 while (detachedRTCDataChannelsSize--) { 227 auto detachedRTCDataChannel = DetachedRTCDataChannel::decode(decoder); 228 if (!detachedRTCDataChannel) 198 229 return nullptr; 199 if (!decoder.template bufferIsLargeEnoughToContain<uint8_t>(bufferSize)) 200 return nullptr; 201 202 auto buffer = Gigacage::tryMalloc(Gigacage::Primitive, bufferSize); 203 if (!buffer) 204 return nullptr; 205 if (!decoder.decodeFixedLengthData(static_cast<uint8_t*>(buffer), bufferSize, 1)) { 206 Gigacage::free(Gigacage::Primitive, buffer); 207 return nullptr; 208 } 209 arrayBufferContentsArray->append({ buffer, bufferSize, ArrayBuffer::primitiveGigacageDestructor() }); 210 } 211 212 return adoptRef(*new SerializedScriptValue(WTFMove(data), WTFMove(arrayBufferContentsArray))); 230 detachedRTCDataChannels.append(WTFMove(detachedRTCDataChannel)); 231 } 232 #endif 233 234 return adoptRef(*new SerializedScriptValue(WTFMove(data), WTFMove(arrayBufferContentsArray) 235 #if ENABLE(WEB_RTC) 236 , WTFMove(detachedRTCDataChannels) 237 #endif 238 )); 213 239 } 214 240 -
trunk/Source/WebCore/dom/Document.cpp
r274436 r274758 3492 3492 return m_socketProvider.get(); 3493 3493 } 3494 3494 3495 RefPtr<RTCDataChannelRemoteHandlerConnection> Document::createRTCDataChannelRemoteHandlerConnection() 3496 { 3497 ASSERT(isMainThread()); 3498 auto* page = this->page(); 3499 if (!page) 3500 return nullptr; 3501 return page->libWebRTCProvider().createRTCDataChannelRemoteHandlerConnection(); 3502 } 3503 3495 3504 bool Document::canNavigate(Frame* targetFrame, const URL& destinationURL) 3496 3505 { -
trunk/Source/WebCore/dom/Document.h
r274436 r274758 706 706 #endif 707 707 SocketProvider* socketProvider() final; 708 RefPtr<RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final; 708 709 709 710 bool canNavigate(Frame* targetFrame, const URL& destinationURL = URL()); -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r274143 r274758 30 30 #include "ActiveDOMObject.h" 31 31 #include "DOMTimer.h" 32 #include "RTCDataChannelRemoteHandlerConnection.h" 33 #include "ScriptExecutionContextIdentifier.h" 32 34 #include "SecurityContext.h" 33 35 #include "ServiceWorkerTypes.h" … … 81 83 } 82 84 83 enum ScriptExecutionContextIdentifierType { };84 using ScriptExecutionContextIdentifier = ObjectIdentifier<ScriptExecutionContextIdentifierType>;85 86 85 class ScriptExecutionContext : public SecurityContext, public CanMakeWeakPtr<ScriptExecutionContext> { 87 86 public: … … 115 114 #endif 116 115 virtual SocketProvider* socketProvider() = 0; 116 117 virtual RefPtr<RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() { return nullptr; } 117 118 118 119 virtual String resourceRequestIdentifier() const { return String(); }; -
trunk/Source/WebCore/platform/ScriptExecutionContextIdentifier.h
r274756 r274758 1 1 /* 2 * Copyright (C) 20 17Apple Inc. All rights reserved.2 * Copyright (C) 2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #i f ENABLE(WEB_RTC)28 #include <wtf/ObjectIdentifier.h> 29 29 30 30 namespace WebCore { 31 31 32 enum class RTCDataChannelState { 33 Connecting, 34 Open, 35 Closing, 36 Closed 37 }; 32 enum ScriptExecutionContextIdentifierType { }; 33 using ScriptExecutionContextIdentifier = ObjectIdentifier<ScriptExecutionContextIdentifierType>; 38 34 39 }; // namespace WebCore 40 41 #endif 35 } -
trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h
r274351 r274758 29 29 30 30 #include "RTCPriorityType.h" 31 #include "ScriptExecutionContext .h"31 #include "ScriptExecutionContextIdentifier.h" 32 32 #include <wtf/Optional.h> 33 33 #include <wtf/text/WTFString.h> … … 45 45 46 46 RTCDataChannelInit isolatedCopy() const; 47 48 template<class Encoder> void encode(Encoder&) const; 49 template<class Decoder> static Optional<RTCDataChannelInit> decode(Decoder&); 47 50 }; 48 51 … … 52 55 copy.protocol = protocol.isolatedCopy(); 53 56 return copy; 57 } 58 59 template<class Encoder> void RTCDataChannelInit::encode(Encoder& encoder) const 60 { 61 encoder << ordered << maxPacketLifeTime << maxRetransmits << protocol << negotiated << id << priority; 62 } 63 64 template<class Decoder> Optional<RTCDataChannelInit> RTCDataChannelInit::decode(Decoder& decoder) 65 { 66 Optional<bool> ordered; 67 decoder >> ordered; 68 if (!ordered) 69 return { }; 70 71 Optional<unsigned short> maxPacketLifeTime; 72 decoder >> maxPacketLifeTime; 73 if (!maxPacketLifeTime) 74 return { }; 75 76 Optional<unsigned short> maxRetransmits; 77 decoder >> maxRetransmits; 78 if (!maxRetransmits) 79 return { }; 80 81 String protocol; 82 if (!decoder.decode(protocol)) 83 return { }; 84 85 Optional<bool> negotiated; 86 decoder >> negotiated; 87 if (!negotiated) 88 return { }; 89 90 Optional<unsigned short> id; 91 decoder >> id; 92 if (!id) 93 return { }; 94 95 Optional<RTCPriorityType> priority; 96 decoder >> priority; 97 if (!priority) 98 return { }; 99 100 return RTCDataChannelInit { *ordered, *maxPacketLifeTime, *maxRetransmits, WTFMove(protocol), *negotiated, *id, *priority }; 54 101 } 55 102 -
trunk/Source/WebCore/platform/mediastream/RTCDataChannelIdentifier.h
r274756 r274758 1 1 /* 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2017 Apple Inc. All rights reserved. 2 * Copyright (C) 2021 Apple Inc. All rights reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 26 25 #pragma once 27 26 28 #if ENABLE(WEB_RTC) 29 30 #include "RTCPriorityType.h" 31 #include "ScriptExecutionContext.h" 32 #include <wtf/Optional.h> 33 #include <wtf/text/WTFString.h> 27 #include "ProcessIdentifier.h" 28 #include <wtf/ObjectIdentifier.h> 34 29 35 30 namespace WebCore { 36 31 37 struct RTCDataChannelInit { 38 Optional<bool> ordered; 39 Optional<unsigned short> maxPacketLifeTime; 40 Optional<unsigned short> maxRetransmits; 41 String protocol; 42 Optional<bool> negotiated; 43 Optional<unsigned short> id; 44 RTCPriorityType priority { RTCPriorityType::Low }; 32 enum RTCDataChannelLocalIdentifierType { }; 33 using RTCDataChannelLocalIdentifier = ObjectIdentifier<RTCDataChannelLocalIdentifierType>; 34 struct RTCDataChannelIdentifier { 35 ProcessIdentifier processIdentifier; 36 RTCDataChannelLocalIdentifier channelIdentifier; 45 37 46 RTCDataChannelInit isolatedCopy() const; 38 template<class Encoder> void encode(Encoder&) const; 39 template<class Decoder> static Optional<RTCDataChannelIdentifier> decode(Decoder&); 47 40 }; 48 41 49 inline RTCDataChannelInit RTCDataChannelInit::isolatedCopy() const 42 template<class Encoder> 43 inline void RTCDataChannelIdentifier::encode(Encoder& encoder) const 50 44 { 51 auto copy = *this; 52 copy.protocol = protocol.isolatedCopy(); 53 return copy; 45 encoder << processIdentifier << channelIdentifier; 54 46 } 55 47 56 class RTCDataChannelHandlerClient; 48 template<class Decoder> 49 inline Optional<RTCDataChannelIdentifier> RTCDataChannelIdentifier::decode(Decoder& decoder) 50 { 51 Optional<ProcessIdentifier> processIdentifier; 52 decoder >> processIdentifier; 53 if (!processIdentifier) 54 return WTF::nullopt; 57 55 58 class RTCDataChannelHandler { 59 public: 60 virtual ~RTCDataChannelHandler() = default; 61 62 virtual void setClient(RTCDataChannelHandlerClient&, ScriptExecutionContextIdentifier) = 0; 63 64 virtual bool sendStringData(const CString&) = 0; 65 virtual bool sendRawData(const char*, size_t) = 0; 66 virtual void close() = 0; 67 }; 56 Optional<RTCDataChannelLocalIdentifier> channelIdentifier; 57 decoder >> channelIdentifier; 58 if (!channelIdentifier) 59 return WTF::nullopt; 60 return RTCDataChannelIdentifier { *processIdentifier, *channelIdentifier }; 61 } 68 62 69 63 } // namespace WebCore 70 71 #endif // ENABLE(WEB_RTC) -
trunk/Source/WebCore/platform/mediastream/RTCDataChannelRemoteHandlerConnection.h
r274756 r274758 1 1 /* 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2017 Apple Inc. All rights reserved. 2 * Copyright (C) 2021 Apple Inc. All rights reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 26 25 #pragma once 27 26 28 #if ENABLE(WEB_RTC) 29 30 #include "RTCPriorityType.h" 31 #include "ScriptExecutionContext.h" 32 #include <wtf/Optional.h> 27 #include "RTCDataChannelIdentifier.h" 28 #include "ScriptExecutionContextIdentifier.h" 29 #include <wtf/ThreadSafeRefCounted.h> 33 30 #include <wtf/text/WTFString.h> 34 31 35 32 namespace WebCore { 36 33 37 struct RTCDataChannelInit { 38 Optional<bool> ordered; 39 Optional<unsigned short> maxPacketLifeTime; 40 Optional<unsigned short> maxRetransmits; 41 String protocol; 42 Optional<bool> negotiated; 43 Optional<unsigned short> id; 44 RTCPriorityType priority { RTCPriorityType::Low }; 34 class RTCDataChannelRemoteHandler; 45 35 46 RTCDataChannelInit isolatedCopy() const; 47 }; 36 class RTCDataChannelRemoteHandlerConnection : public ThreadSafeRefCounted<RTCDataChannelRemoteHandlerConnection, WTF::DestructionThread::Main> { 37 public: 38 virtual ~RTCDataChannelRemoteHandlerConnection() = default; 48 39 49 inline RTCDataChannelInit RTCDataChannelInit::isolatedCopy() const 50 { 51 auto copy = *this; 52 copy.protocol = protocol.isolatedCopy(); 53 return copy; 54 } 55 56 class RTCDataChannelHandlerClient; 57 58 class RTCDataChannelHandler { 59 public: 60 virtual ~RTCDataChannelHandler() = default; 61 62 virtual void setClient(RTCDataChannelHandlerClient&, ScriptExecutionContextIdentifier) = 0; 63 64 virtual bool sendStringData(const CString&) = 0; 65 virtual bool sendRawData(const char*, size_t) = 0; 66 virtual void close() = 0; 40 virtual void connectToSource(RTCDataChannelRemoteHandler&, ScriptExecutionContextIdentifier, RTCDataChannelIdentifier, RTCDataChannelIdentifier) = 0; 41 virtual void sendData(RTCDataChannelIdentifier, bool isRaw, const unsigned char*, size_t) = 0; 42 virtual void close(RTCDataChannelIdentifier) = 0; 67 43 }; 68 44 69 45 } // namespace WebCore 70 71 #endif // ENABLE(WEB_RTC) -
trunk/Source/WebCore/platform/mediastream/RTCDataChannelRemoteSourceConnection.h
r274756 r274758 1 1 /* 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2017 Apple Inc. All rights reserved. 2 * Copyright (C) 2021 Apple Inc. All rights reserved. 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 28 27 #if ENABLE(WEB_RTC) 29 28 30 #include "RTC PriorityType.h"31 #include " ScriptExecutionContext.h"32 #include <wtf/ Optional.h>29 #include "RTCDataChannelIdentifier.h" 30 #include "RTCDataChannelState.h" 31 #include <wtf/ThreadSafeRefCounted.h> 33 32 #include <wtf/text/WTFString.h> 34 33 35 34 namespace WebCore { 36 35 37 struct RTCDataChannelInit { 38 Optional<bool> ordered; 39 Optional<unsigned short> maxPacketLifeTime; 40 Optional<unsigned short> maxRetransmits; 41 String protocol; 42 Optional<bool> negotiated; 43 Optional<unsigned short> id; 44 RTCPriorityType priority { RTCPriorityType::Low }; 36 class RTCDataChannelRemoteSourceConnection : public ThreadSafeRefCounted<RTCDataChannelRemoteSourceConnection, WTF::DestructionThread::Main> { 37 public: 38 virtual ~RTCDataChannelRemoteSourceConnection() = default; 45 39 46 RTCDataChannelInit isolatedCopy() const; 47 }; 48 49 inline RTCDataChannelInit RTCDataChannelInit::isolatedCopy() const 50 { 51 auto copy = *this; 52 copy.protocol = protocol.isolatedCopy(); 53 return copy; 54 } 55 56 class RTCDataChannelHandlerClient; 57 58 class RTCDataChannelHandler { 59 public: 60 virtual ~RTCDataChannelHandler() = default; 61 62 virtual void setClient(RTCDataChannelHandlerClient&, ScriptExecutionContextIdentifier) = 0; 63 64 virtual bool sendStringData(const CString&) = 0; 65 virtual bool sendRawData(const char*, size_t) = 0; 66 virtual void close() = 0; 40 virtual void didChangeReadyState(RTCDataChannelIdentifier, RTCDataChannelState) = 0; 41 virtual void didReceiveStringData(RTCDataChannelIdentifier, const String&) = 0; 42 virtual void didReceiveRawData(RTCDataChannelIdentifier, const char*, size_t) = 0; 43 virtual void didDetectError(RTCDataChannelIdentifier) = 0; 44 virtual void bufferedAmountIsDecreasing(RTCDataChannelIdentifier, size_t) = 0; 67 45 }; 68 46 -
trunk/Source/WebCore/platform/mediastream/RTCDataChannelState.h
r214627 r274758 28 28 #if ENABLE(WEB_RTC) 29 29 30 #include <wtf/EnumTraits.h> 31 30 32 namespace WebCore { 31 33 32 enum class RTCDataChannelState {34 enum class RTCDataChannelState : uint8_t { 33 35 Connecting, 34 36 Open, … … 39 41 }; // namespace WebCore 40 42 43 44 namespace WTF { 45 46 template<> struct EnumTraits<WebCore::RTCDataChannelState> { 47 using values = EnumValues< 48 WebCore::RTCDataChannelState, 49 WebCore::RTCDataChannelState::Connecting, 50 WebCore::RTCDataChannelState::Open, 51 WebCore::RTCDataChannelState::Closing, 52 WebCore::RTCDataChannelState::Closed 53 >; 54 }; 55 56 } 57 41 58 #endif -
trunk/Source/WebCore/platform/mediastream/RTCPriorityType.h
r273550 r274758 28 28 #if ENABLE(WEB_RTC) 29 29 30 #include <wtf/EnumTraits.h> 31 30 32 namespace WebCore { 31 33 … … 34 36 } // namespace WebCore 35 37 38 namespace WTF { 39 40 template<> struct EnumTraits<WebCore::RTCPriorityType> { 41 using values = EnumValues< 42 WebCore::RTCPriorityType, 43 WebCore::RTCPriorityType::VeryLow, 44 WebCore::RTCPriorityType::Low, 45 WebCore::RTCPriorityType::Medium, 46 WebCore::RTCPriorityType::High 47 >; 48 }; 49 50 } 51 36 52 #endif // ENABLE(WEB_RTC) -
trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.h
r270720 r274758 28 28 #include "DocumentIdentifier.h" 29 29 #include "LibWebRTCMacros.h" 30 #include "RTCDataChannelRemoteHandlerConnection.h" 30 31 #include <wtf/CompletionHandler.h> 31 32 #include <wtf/Expected.h> … … 91 92 callback(makeUnexpected(MDNSRegisterError::NotImplemented)); 92 93 } 94 95 virtual RefPtr<RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() { return nullptr; } 93 96 94 97 #if USE(LIBWEBRTC) -
trunk/Source/WebCore/workers/WorkerGlobalScope.cpp
r273203 r274758 162 162 } 163 163 164 RefPtr<RTCDataChannelRemoteHandlerConnection> WorkerGlobalScope::createRTCDataChannelRemoteHandlerConnection() 165 { 166 RefPtr<RTCDataChannelRemoteHandlerConnection> connection; 167 callOnMainThreadAndWait([workerThread = makeRef(thread()), &connection]() mutable { 168 connection = workerThread->workerLoaderProxy().createRTCDataChannelRemoteHandlerConnection(); 169 }); 170 ASSERT(connection); 171 172 return connection; 173 } 174 164 175 #if ENABLE(INDEXED_DATABASE) 165 176 -
trunk/Source/WebCore/workers/WorkerGlobalScope.h
r273203 r274758 147 147 String resourceRequestIdentifier() const final { return m_identifier; } 148 148 SocketProvider* socketProvider() final; 149 RefPtr<RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final; 149 150 150 151 bool shouldBypassMainWorldContentSecurityPolicy() const final { return m_shouldBypassMainWorldContentSecurityPolicy; } -
trunk/Source/WebCore/workers/WorkerLoaderProxy.h
r268057 r274758 51 51 virtual RefPtr<CacheStorageConnection> createCacheStorageConnection() = 0; 52 52 53 virtual RefPtr<RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() = 0; 54 53 55 // Posts a task to the thread which runs the loading code (normally, the main thread). 54 56 virtual void postTaskToLoader(ScriptExecutionContext::Task&&) = 0; -
trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp
r273299 r274758 38 38 #include "EventNames.h" 39 39 #include "FetchRequestCredentials.h" 40 #include "LibWebRTCProvider.h" 40 41 #include "MessageEvent.h" 41 42 #include "Page.h" … … 176 177 } 177 178 179 RefPtr<RTCDataChannelRemoteHandlerConnection> WorkerMessagingProxy::createRTCDataChannelRemoteHandlerConnection() 180 { 181 ASSERT(isMainThread()); 182 auto& document = downcast<Document>(*m_scriptExecutionContext); 183 if (!document.page()) 184 return nullptr; 185 return document.page()->libWebRTCProvider().createRTCDataChannelRemoteHandlerConnection(); 186 } 187 178 188 bool WorkerMessagingProxy::postTaskForModeToWorkerOrWorkletGlobalScope(ScriptExecutionContext::Task&& task, const String& mode) 179 189 { -
trunk/Source/WebCore/workers/WorkerMessagingProxy.h
r273203 r274758 82 82 void postTaskToLoader(ScriptExecutionContext::Task&&) final; 83 83 RefPtr<CacheStorageConnection> createCacheStorageConnection() final; 84 RefPtr<RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final; 84 85 85 86 void workerThreadCreated(DedicatedWorkerThread&); -
trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp
r270762 r274758 35 35 #include "Frame.h" 36 36 #include "FrameLoader.h" 37 #include "LibWebRTCProvider.h" 37 38 #include "LoaderStrategy.h" 38 39 #include "Logging.h" … … 164 165 } 165 166 167 RefPtr<RTCDataChannelRemoteHandlerConnection> ServiceWorkerThreadProxy::createRTCDataChannelRemoteHandlerConnection() 168 { 169 ASSERT(isMainThread()); 170 return m_page->libWebRTCProvider().createRTCDataChannelRemoteHandlerConnection(); 171 } 172 166 173 std::unique_ptr<FetchLoader> ServiceWorkerThreadProxy::createBlobLoader(FetchLoaderClient& client, const URL& blobURL) 167 174 { -
trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h
r269888 r274758 89 89 void postTaskToLoader(ScriptExecutionContext::Task&&) final; 90 90 RefPtr<CacheStorageConnection> createCacheStorageConnection() final; 91 RefPtr<RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final; 91 92 92 93 // WorkerDebuggerProxy -
trunk/Source/WebKit/CMakeLists.txt
r274476 r274758 172 172 NetworkProcess/webrtc/NetworkRTCMonitor 173 173 NetworkProcess/webrtc/NetworkRTCProvider 174 NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy 174 175 175 176 PluginProcess/PluginControllerProxy … … 246 247 247 248 WebProcess/Network/webrtc/LibWebRTCNetwork 249 WebProcess/Network/webrtc/RTCDataChannelRemoteManager 248 250 WebProcess/Network/webrtc/WebMDNSRegister 249 251 WebProcess/Network/webrtc/WebRTCMonitor -
trunk/Source/WebKit/ChangeLog
r274746 r274758 1 2021-03-22 Youenn Fablet <youenn@apple.com> 2 3 Implement RTCDataChannel transfer out of process 4 https://bugs.webkit.org/show_bug.cgi?id=223443 5 6 Reviewed by Eric Carlson. 7 8 Add support for connecting remote sources to remote data channels. 9 This is done by connection detached data channels to remote source that will send messages to network process. 10 Network process then sends to the process in which was reattached the data channel. 11 Pairing of data channels is done in main thread through connectToSource message. 12 The data then flows in background threads, network process being the proxy between web processes. 13 RTCDataChannelRemoteManagerProxy is the forwarding entity in NetworkProcess. 14 RTCDataChannelRemoteManager is the entity in WebProcess doing the messaging from and to data channels. 15 16 * CMakeLists.txt: 17 * DerivedSources-input.xcfilelist: 18 * DerivedSources-output.xcfilelist: 19 * DerivedSources.make: 20 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 21 (WebKit::NetworkConnectionToWebProcess::~NetworkConnectionToWebProcess): 22 (WebKit::NetworkConnectionToWebProcess::connectToRTCDataChannelRemoteSource): 23 (WebKit::NetworkConnectionToWebProcess::registerToRTCDataChannelProxy): 24 (WebKit::NetworkConnectionToWebProcess::unregisterToRTCDataChannelProxy): 25 * NetworkProcess/NetworkConnectionToWebProcess.h: 26 * NetworkProcess/NetworkConnectionToWebProcess.messages.in: 27 * NetworkProcess/NetworkProcess.cpp: 28 (WebKit::NetworkProcess::rtcDataChannelProxy): 29 * NetworkProcess/NetworkProcess.h: 30 * NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.cpp: Added. 31 (WebKit::RTCDataChannelRemoteManagerProxy::RTCDataChannelRemoteManagerProxy): 32 (WebKit::RTCDataChannelRemoteManagerProxy::registerConnectionToWebProcess): 33 (WebKit::RTCDataChannelRemoteManagerProxy::unregisterConnectionToWebProcess): 34 (WebKit::RTCDataChannelRemoteManagerProxy::sendData): 35 (WebKit::RTCDataChannelRemoteManagerProxy::close): 36 (WebKit::RTCDataChannelRemoteManagerProxy::changeReadyState): 37 (WebKit::RTCDataChannelRemoteManagerProxy::receiveData): 38 (WebKit::RTCDataChannelRemoteManagerProxy::detectError): 39 (WebKit::RTCDataChannelRemoteManagerProxy::bufferedAmountIsDecreasing): 40 * NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.h: Added. 41 * NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.messages.in: Added. 42 * Sources.txt: 43 * WebKit.xcodeproj/project.pbxproj: 44 * WebProcess/Network/NetworkProcessConnection.cpp: 45 (WebKit::NetworkProcessConnection::connectToRTCDataChannelRemoteSource): 46 * WebProcess/Network/NetworkProcessConnection.h: 47 * WebProcess/Network/NetworkProcessConnection.messages.in: 48 * WebProcess/Network/webrtc/LibWebRTCProvider.cpp: 49 (WebKit::LibWebRTCProvider::createRTCDataChannelRemoteHandlerConnection): 50 * WebProcess/Network/webrtc/LibWebRTCProvider.h: 51 * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp: Added. 52 (WebKit::RTCDataChannelRemoteManager::sharedManager): 53 (WebKit::RTCDataChannelRemoteManager::RTCDataChannelRemoteManager): 54 (WebKit::RTCDataChannelRemoteManager::setConnection): 55 (WebKit::RTCDataChannelRemoteManager::connectToRemoteSource): 56 (WebKit::RTCDataChannelRemoteManager::remoteHandlerConnection): 57 (WebKit::RTCDataChannelRemoteManager::remoteSourceConnection): 58 (WebKit::RTCDataChannelRemoteManager::postTaskToHandler): 59 (WebKit::RTCDataChannelRemoteManager::sourceFromIdentifier): 60 (WebKit::RTCDataChannelRemoteManager::sendData): 61 (WebKit::RTCDataChannelRemoteManager::close): 62 (WebKit::RTCDataChannelRemoteManager::changeReadyState): 63 (WebKit::RTCDataChannelRemoteManager::receiveData): 64 (WebKit::RTCDataChannelRemoteManager::detectError): 65 (WebKit::RTCDataChannelRemoteManager::bufferedAmountIsDecreasing): 66 (WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::create): 67 (WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::RemoteHandlerConnection): 68 (WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::connectToSource): 69 (WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::sendData): 70 (WebKit::RTCDataChannelRemoteManager::RemoteHandlerConnection::close): 71 (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::create): 72 (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::RemoteSourceConnection): 73 (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didChangeReadyState): 74 (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveStringData): 75 (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didReceiveRawData): 76 (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::didDetectError): 77 (WebKit::RTCDataChannelRemoteManager::RemoteSourceConnection::bufferedAmountIsDecreasing): 78 * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.h: Added. 79 * WebProcess/Network/webrtc/RTCDataChannelRemoteManager.messages.in: Copied from Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in. 80 * WebProcess/Storage/WebSWContextManagerConnection.cpp: 81 (WebKit::WebSWContextManagerConnection::installServiceWorker): 82 1 83 2021-03-19 Kate Cheney <katherine_cheney@apple.com> 2 84 -
trunk/Source/WebKit/DerivedSources-input.xcfilelist
r272748 r274758 71 71 $(PROJECT_DIR)/NetworkProcess/webrtc/NetworkRTCMonitor.messages.in 72 72 $(PROJECT_DIR)/NetworkProcess/webrtc/NetworkRTCProvider.messages.in 73 $(PROJECT_DIR)/NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.messages.in 73 74 $(PROJECT_DIR)/PluginProcess/PluginControllerProxy.messages.in 74 75 $(PROJECT_DIR)/PluginProcess/PluginProcess.messages.in … … 169 170 $(PROJECT_DIR)/WebProcess/Network/WebSocketStream.messages.in 170 171 $(PROJECT_DIR)/WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in 172 $(PROJECT_DIR)/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.messages.in 171 173 $(PROJECT_DIR)/WebProcess/Network/webrtc/WebMDNSRegister.messages.in 172 174 $(PROJECT_DIR)/WebProcess/Network/webrtc/WebRTCMonitor.messages.in -
trunk/Source/WebKit/DerivedSources-output.xcfilelist
r273949 r274758 134 134 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/PluginProxyMessages.h 135 135 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/PluginProxyMessagesReplies.h 136 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RTCDataChannelRemoteManagerMessageReceiver.cpp 137 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RTCDataChannelRemoteManagerMessages.h 138 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RTCDataChannelRemoteManagerMessagesReplies.h 139 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RTCDataChannelRemoteManagerProxyMessageReceiver.cpp 140 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RTCDataChannelRemoteManagerProxyMessages.h 141 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RTCDataChannelRemoteManagerProxyMessagesReplies.h 136 142 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteAudioDestinationManagerMessageReceiver.cpp 137 143 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteAudioDestinationManagerMessages.cpp -
trunk/Source/WebKit/DerivedSources.make
r273946 r274758 133 133 NetworkProcess/webrtc/NetworkRTCProvider \ 134 134 NetworkProcess/webrtc/NetworkRTCMonitor \ 135 NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy \ 135 136 NetworkProcess/Cookies/WebCookieManager \ 136 137 Shared/Plugins/NPObjectMessageReceiver \ … … 204 205 WebProcess/Network/WebSocketStream \ 205 206 WebProcess/Network/WebResourceLoader \ 207 WebProcess/Network/webrtc/LibWebRTCNetwork \ 208 WebProcess/Network/webrtc/RTCDataChannelRemoteManager \ 206 209 WebProcess/Network/webrtc/WebRTCMonitor \ 207 WebProcess/Network/webrtc/LibWebRTCNetwork \208 210 WebProcess/Network/webrtc/WebMDNSRegister \ 209 211 WebProcess/Network/webrtc/WebRTCResolver \ -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
r274189 r274758 53 53 #include "PingLoad.h" 54 54 #include "PreconnectTask.h" 55 #include "RTCDataChannelRemoteManagerProxy.h" 55 56 #include "ServiceWorkerFetchTaskMessages.h" 56 57 #include "WebCoreArgumentCoders.h" … … 148 149 m_rtcProvider->close(); 149 150 #endif 151 #if ENABLE(WEB_RTC) 152 unregisterToRTCDataChannelProxy(); 153 #endif 150 154 151 155 #if ENABLE(SERVICE_WORKER) … … 278 282 callback(); 279 283 } 284 285 #if ENABLE(WEB_RTC) 286 void NetworkConnectionToWebProcess::connectToRTCDataChannelRemoteSource(WebCore::RTCDataChannelIdentifier localIdentifier, WebCore::RTCDataChannelIdentifier remoteIdentifier, CompletionHandler<void(Optional<bool>)>&& callback) 287 { 288 auto* connectionToWebProcess = m_networkProcess->webProcessConnection(remoteIdentifier.processIdentifier); 289 if (!connectionToWebProcess) { 290 callback(false); 291 return; 292 } 293 registerToRTCDataChannelProxy(); 294 connectionToWebProcess->registerToRTCDataChannelProxy(); 295 connectionToWebProcess->connection().sendWithAsyncReply(Messages::NetworkProcessConnection::ConnectToRTCDataChannelRemoteSource { remoteIdentifier, localIdentifier }, WTFMove(callback), 0); 296 } 297 298 void NetworkConnectionToWebProcess::registerToRTCDataChannelProxy() 299 { 300 if (m_isRegisteredToRTCDataChannelProxy) 301 return; 302 m_isRegisteredToRTCDataChannelProxy = true; 303 m_networkProcess->rtcDataChannelProxy().registerConnectionToWebProcess(*this); 304 } 305 306 void NetworkConnectionToWebProcess::unregisterToRTCDataChannelProxy() 307 { 308 if (m_isRegisteredToRTCDataChannelProxy) 309 m_networkProcess->rtcDataChannelProxy().unregisterConnectionToWebProcess(*this); 310 } 311 #endif 280 312 281 313 CacheStorageEngineConnection& NetworkConnectionToWebProcess::cacheStorageConnection() -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
r274189 r274758 49 49 #include <WebCore/PageIdentifier.h> 50 50 #include <WebCore/ProcessIdentifier.h> 51 #include <WebCore/RTCDataChannelIdentifier.h> 51 52 #include <WebCore/RegistrableDomain.h> 52 53 #include <WebCore/WebSocketIdentifier.h> … … 251 252 252 253 void createRTCProvider(CompletionHandler<void()>&&); 254 #if ENABLE(WEB_RTC) 255 void connectToRTCDataChannelRemoteSource(WebCore::RTCDataChannelIdentifier source, WebCore::RTCDataChannelIdentifier handler, CompletionHandler<void(Optional<bool>)>&&); 256 #endif 253 257 254 258 void createNewMessagePortChannel(const WebCore::MessagePortIdentifier& port1, const WebCore::MessagePortIdentifier& port2); … … 272 276 #if ENABLE(WEB_RTC) 273 277 NetworkMDNSRegister& mdnsRegister() { return m_mdnsRegister; } 278 void registerToRTCDataChannelProxy(); 279 void unregisterToRTCDataChannelProxy(); 274 280 #endif 275 281 … … 386 392 #endif 387 393 394 #if ENABLE(WEB_RTC) 395 bool m_isRegisteredToRTCDataChannelProxy { false }; 396 #endif 397 388 398 #if ENABLE(APPLE_PAY_REMOTE_UI) 389 399 std::unique_ptr<WebPaymentCoordinatorProxy> m_paymentCoordinator; -
trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
r271946 r274758 88 88 89 89 CreateRTCProvider() -> () Async 90 #if ENABLE(WEB_RTC) 91 ConnectToRTCDataChannelRemoteSource(struct WebCore::RTCDataChannelIdentifier source, struct WebCore::RTCDataChannelIdentifier handler) -> (Optional<bool> result) Async 92 #endif 90 93 91 94 UpdateQuotaBasedOnSpaceUsageForTesting(struct WebCore::ClientOrigin origin) -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r274513 r274758 2823 2823 #endif 2824 2824 2825 #if ENABLE(WEB_RTC) 2826 RTCDataChannelRemoteManagerProxy& NetworkProcess::rtcDataChannelProxy() 2827 { 2828 ASSERT(isMainRunLoop()); 2829 if (!m_rtcDataChannelProxy) 2830 m_rtcDataChannelProxy = RTCDataChannelRemoteManagerProxy::create(); 2831 return *m_rtcDataChannelProxy; 2832 } 2833 #endif 2834 2825 2835 } // namespace WebKit -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r274513 r274758 33 33 #include "LocalStorageDatabaseTracker.h" 34 34 #include "NetworkContentRuleListManager.h" 35 #include "RTCDataChannelRemoteManagerProxy.h" 35 36 #include "SandboxExtension.h" 36 37 #include "WebIDBServer.h" … … 381 382 #endif 382 383 384 #if ENABLE(WEB_RTC) 385 RTCDataChannelRemoteManagerProxy& rtcDataChannelProxy(); 386 #endif 387 383 388 private: 384 389 void platformInitializeNetworkProcess(const NetworkProcessCreationParameters&); … … 585 590 #endif 586 591 592 #if ENABLE(WEB_RTC) 593 RefPtr<RTCDataChannelRemoteManagerProxy> m_rtcDataChannelProxy; 594 #endif 595 587 596 Lock m_sessionStorageQuotaManagersLock; 588 597 HashMap<PAL::SessionID, std::unique_ptr<SessionStorageQuotaManager>> m_sessionStorageQuotaManagers; -
trunk/Source/WebKit/NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.messages.in
r274756 r274758 1 # Copyright (C) 20 12Apple Inc. All rights reserved.1 # Copyright (C) 2021 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 21 21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 22 23 messages -> NetworkProcessConnection LegacyReceiver { 23 #if ENABLE(WEB_RTC) 24 24 25 #if ENABLE(SHAREABLE_RESOURCE) 26 DidCacheResource(WebCore::ResourceRequest request, WebKit::ShareableResource::Handle resource) 27 #endif 25 messages -> RTCDataChannelRemoteManagerProxy NotRefCounted { 26 // To source 27 SendData(struct WebCore::RTCDataChannelIdentifier source, bool isRaw, IPC::DataReference text); 28 Close(struct WebCore::RTCDataChannelIdentifier source); 28 29 29 DidFinishPingLoad(uint64_t pingLoadIdentifier, WebCore::ResourceError error, WebCore::ResourceResponse response) 30 DidFinishPreconnection(uint64_t preconnectionIdentifier, WebCore::ResourceError error) 31 SetOnLineState(bool isOnLine); 32 CookieAcceptPolicyChanged(enum:uint8_t WebCore::HTTPCookieAcceptPolicy policy); 30 // To handler 31 ChangeReadyState(struct WebCore::RTCDataChannelIdentifier handler, enum:uint8_t WebCore::RTCDataChannelState state); 32 ReceiveData(struct WebCore::RTCDataChannelIdentifier handler, bool isRaw, IPC::DataReference data); 33 DetectError(struct WebCore::RTCDataChannelIdentifier handler); 34 BufferedAmountIsDecreasing(struct WebCore::RTCDataChannelIdentifier handler, size_t amount); 35 } 33 36 34 #if HAVE(COOKIE_CHANGE_LISTENER_API) 35 CookiesAdded(String host, Vector<struct WebCore::Cookie> cookies); 36 CookiesDeleted(String host, Vector<struct WebCore::Cookie> cookies); 37 AllCookiesDeleted(); 38 #endif 39 40 CheckProcessLocalPortForActivity(struct WebCore::MessagePortIdentifier port) -> (WebCore::MessagePortChannelProvider::HasActivity hasActivity) Async 41 MessagesAvailableForPort(struct WebCore::MessagePortIdentifier port) 42 43 BroadcastConsoleMessage(enum:uint8_t JSC::MessageSource messageSource, enum:uint8_t JSC::MessageLevel messageLevel, String message) 44 } 37 #endif // ENABLE(WEB_RTC) -
trunk/Source/WebKit/Sources.txt
r273916 r274758 131 131 132 132 NetworkProcess/webrtc/NetworkMDNSRegister.cpp 133 NetworkProcess/webrtc/RTCDataChannelRemoteManagerProxy.cpp 133 134 134 135 // TODO: We should unify these files once GTK's PluginProcess2 is removed. … … 631 632 WebProcess/Network/webrtc/LibWebRTCSocket.cpp 632 633 WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp 634 WebProcess/Network/webrtc/RTCDataChannelRemoteManager.cpp 633 635 WebProcess/Network/webrtc/WebMDNSRegister.cpp 634 636 WebProcess/Network/webrtc/WebRTCMonitor.cpp … … 719 721 WebProcess/WebStorage/WebStorageNamespaceProvider.cpp 720 722 723 RTCDataChannelRemoteManagerMessageReceiver.cpp 724 RTCDataChannelRemoteManagerProxyMessageReceiver.cpp 721 725 RemoteGraphicsContextGLMessageReceiver.cpp 722 726 RemoteGraphicsContextGLProxyMessageReceiver.cpp -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r274697 r274758 3652 3652 410BA13A257135F2002E2F8A /* NetworkRTCSocketCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NetworkRTCSocketCocoa.h; sourceTree = "<group>"; }; 3653 3653 4111436320F677B10026F912 /* InjectUserScriptImmediately.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectUserScriptImmediately.h; sourceTree = "<group>"; }; 3654 411223B72602152B00B0A0B6 /* RTCDataChannelRemoteManager.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = RTCDataChannelRemoteManager.messages.in; path = Network/webrtc/RTCDataChannelRemoteManager.messages.in; sourceTree = "<group>"; }; 3655 411223BB26024E8000B0A0B6 /* RTCDataChannelRemoteManagerProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelRemoteManagerProxy.h; sourceTree = "<group>"; }; 3656 411223BC26024E8100B0A0B6 /* RTCDataChannelRemoteManagerProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RTCDataChannelRemoteManagerProxy.cpp; sourceTree = "<group>"; }; 3657 411223BD26024E8100B0A0B6 /* RTCDataChannelRemoteManagerProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = RTCDataChannelRemoteManagerProxy.messages.in; sourceTree = "<group>"; }; 3654 3658 411286EF21C8A90C003A8550 /* MediaUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaUtilities.h; sourceTree = "<group>"; }; 3655 3659 411286F021C8A90D003A8550 /* MediaUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaUtilities.mm; sourceTree = "<group>"; }; … … 3713 3717 41684C51246450FD001CE8ED /* RemoteRealtimeVideoSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteRealtimeVideoSource.h; sourceTree = "<group>"; }; 3714 3718 416CD74523FB178B00661D99 /* MDNSRegisterIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MDNSRegisterIdentifier.h; path = Network/webrtc/MDNSRegisterIdentifier.h; sourceTree = "<group>"; }; 3719 416EDC052600F6B000092675 /* RTCDataChannelRemoteManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = RTCDataChannelRemoteManager.cpp; path = Network/webrtc/RTCDataChannelRemoteManager.cpp; sourceTree = "<group>"; }; 3720 416EDC062600F6B000092675 /* RTCDataChannelRemoteManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RTCDataChannelRemoteManager.h; path = Network/webrtc/RTCDataChannelRemoteManager.h; sourceTree = "<group>"; }; 3715 3721 416F8086245B397400B68F02 /* LibWebRTCNetwork.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LibWebRTCNetwork.messages.in; path = Network/webrtc/LibWebRTCNetwork.messages.in; sourceTree = "<group>"; }; 3716 3722 416F8089245C7FF500B68F02 /* LibWebRTCNetwork.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCNetwork.cpp; path = Network/webrtc/LibWebRTCNetwork.cpp; sourceTree = "<group>"; }; … … 8247 8253 410BA13A257135F2002E2F8A /* NetworkRTCSocketCocoa.h */, 8248 8254 410BA139257135F2002E2F8A /* NetworkRTCSocketCocoa.mm */, 8255 411223BC26024E8100B0A0B6 /* RTCDataChannelRemoteManagerProxy.cpp */, 8256 411223BB26024E8000B0A0B6 /* RTCDataChannelRemoteManagerProxy.h */, 8257 411223BD26024E8100B0A0B6 /* RTCDataChannelRemoteManagerProxy.messages.in */, 8249 8258 ); 8250 8259 path = webrtc; … … 8267 8276 413075A61DE85EE70039EC69 /* LibWebRTCSocketFactory.h */, 8268 8277 416CD74523FB178B00661D99 /* MDNSRegisterIdentifier.h */, 8278 416EDC052600F6B000092675 /* RTCDataChannelRemoteManager.cpp */, 8279 416EDC062600F6B000092675 /* RTCDataChannelRemoteManager.h */, 8280 411223B72602152B00B0A0B6 /* RTCDataChannelRemoteManager.messages.in */, 8269 8281 41B7ED6E20681DCF0087D853 /* WebMDNSRegister.cpp */, 8270 8282 41B7ED6C20681DCE0087D853 /* WebMDNSRegister.h */, -
trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp
r274189 r274758 30 30 #include "LibWebRTCNetwork.h" 31 31 #include "NetworkConnectionToWebProcessMessages.h" 32 #include "RTCDataChannelRemoteManager.h" 32 33 #include "StorageAreaMap.h" 33 34 #include "StorageAreaMapMessages.h" … … 321 322 } 322 323 324 #if ENABLE(WEB_RTC) 325 void NetworkProcessConnection::connectToRTCDataChannelRemoteSource(WebCore::RTCDataChannelIdentifier localIdentifier, WebCore::RTCDataChannelIdentifier remoteIdentifier, CompletionHandler<void(Optional<bool>)>&& callback) 326 { 327 callback(RTCDataChannelRemoteManager::sharedManager().connectToRemoteSource(localIdentifier, remoteIdentifier)); 328 } 329 #endif 330 323 331 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.h
r274189 r274758 31 31 #include <JavaScriptCore/ConsoleTypes.h> 32 32 #include <WebCore/MessagePortChannelProvider.h> 33 #include <WebCore/RTCDataChannelIdentifier.h> 33 34 #include <WebCore/ServiceWorkerTypes.h> 34 35 #include <wtf/RefCounted.h> … … 110 111 void didCacheResource(const WebCore::ResourceRequest&, const ShareableResource::Handle&); 111 112 #endif 113 #if ENABLE(SHAREABLE_RESOURCE) 114 void connectToRTCDataChannelRemoteSource(WebCore::RTCDataChannelIdentifier source, WebCore::RTCDataChannelIdentifier handler, CompletionHandler<void(Optional<bool>)>&&); 115 #endif 112 116 113 117 void broadcastConsoleMessage(MessageSource, MessageLevel, const String& message); -
trunk/Source/WebKit/WebProcess/Network/NetworkProcessConnection.messages.in
r259236 r274758 38 38 #endif 39 39 40 #if ENABLE(WEB_RTC) 41 ConnectToRTCDataChannelRemoteSource(struct WebCore::RTCDataChannelIdentifier source, struct WebCore::RTCDataChannelIdentifier handler) -> (Optional<bool> result) Async 42 #endif 43 40 44 CheckProcessLocalPortForActivity(struct WebCore::MessagePortIdentifier port) -> (WebCore::MessagePortChannelProvider::HasActivity hasActivity) Async 41 45 MessagesAvailableForPort(struct WebCore::MessagePortIdentifier port) -
trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp
r272858 r274758 34 34 35 35 #include "LibWebRTCNetwork.h" 36 #include "RTCDataChannelRemoteManager.h" 36 37 #include "WebPage.h" 37 38 #include "WebProcess.h" … … 153 154 } 154 155 156 RefPtr<RTCDataChannelRemoteHandlerConnection> LibWebRTCProvider::createRTCDataChannelRemoteHandlerConnection() 157 { 158 return &RTCDataChannelRemoteManager::sharedManager().remoteHandlerConnection(); 159 } 160 155 161 } // namespace WebKit 156 162 -
trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.h
r272858 r274758 61 61 void disableNonLocalhostConnections() final; 62 62 void startedNetworkThread() final; 63 RefPtr<WebCore::RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final; 63 64 64 65 #if ENABLE(GPU_PROCESS) && PLATFORM(COCOA) && !PLATFORM(MACCATALYST) -
trunk/Source/WebKit/WebProcess/Network/webrtc/RTCDataChannelRemoteManager.messages.in
r274756 r274758 1 # Copyright (C) 20 12Apple Inc. All rights reserved.1 # Copyright (C) 2021 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 21 21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 22 23 messages -> NetworkProcessConnection LegacyReceiver { 23 #if ENABLE(WEB_RTC) 24 24 25 #if ENABLE(SHAREABLE_RESOURCE) 26 DidCacheResource(WebCore::ResourceRequest request, WebKit::ShareableResource::Handle resource) 27 #endif 25 messages -> RTCDataChannelRemoteManager NotRefCounted { 26 // To source 27 SendData(struct WebCore::RTCDataChannelIdentifier source, bool isRaw, IPC::DataReference text); 28 Close(struct WebCore::RTCDataChannelIdentifier source); 28 29 29 DidFinishPingLoad(uint64_t pingLoadIdentifier, WebCore::ResourceError error, WebCore::ResourceResponse response) 30 DidFinishPreconnection(uint64_t preconnectionIdentifier, WebCore::ResourceError error) 31 SetOnLineState(bool isOnLine); 32 CookieAcceptPolicyChanged(enum:uint8_t WebCore::HTTPCookieAcceptPolicy policy); 30 // To handler 31 ChangeReadyState(struct WebCore::RTCDataChannelIdentifier handler, enum:uint8_t WebCore::RTCDataChannelState state); 32 ReceiveData(struct WebCore::RTCDataChannelIdentifier handler, bool isRaw, IPC::DataReference data); 33 DetectError(struct WebCore::RTCDataChannelIdentifier handler); 34 BufferedAmountIsDecreasing(struct WebCore::RTCDataChannelIdentifier handler, size_t amount); 35 } 33 36 34 #if HAVE(COOKIE_CHANGE_LISTENER_API) 35 CookiesAdded(String host, Vector<struct WebCore::Cookie> cookies); 36 CookiesDeleted(String host, Vector<struct WebCore::Cookie> cookies); 37 AllCookiesDeleted(); 38 #endif 39 40 CheckProcessLocalPortForActivity(struct WebCore::MessagePortIdentifier port) -> (WebCore::MessagePortChannelProvider::HasActivity hasActivity) Async 41 MessagesAvailableForPort(struct WebCore::MessagePortIdentifier port) 42 43 BroadcastConsoleMessage(enum:uint8_t JSC::MessageSource messageSource, enum:uint8_t JSC::MessageLevel messageLevel, String message) 44 } 37 #endif // ENABLE(WEB_RTC) -
trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
r272550 r274758 34 34 #include "NetworkConnectionToWebProcessMessages.h" 35 35 #include "NetworkProcessMessages.h" 36 #include "RTCDataChannelRemoteManager.h" 36 37 #include "ServiceWorkerFetchTaskMessages.h" 37 38 #include "ServiceWorkerInitializationData.h" … … 75 76 76 77 78 #if ENABLE(WEB_RTC) 79 class ServiceWorkerLibWebRTCProvider final : public WebCore::LibWebRTCProvider { 80 public: 81 ServiceWorkerLibWebRTCProvider() = default; 82 83 private: 84 RefPtr<WebCore::RTCDataChannelRemoteHandlerConnection> createRTCDataChannelRemoteHandlerConnection() final { return &RTCDataChannelRemoteManager::sharedManager().remoteHandlerConnection(); } 85 }; 86 #endif 87 77 88 ServiceWorkerFrameLoaderClient::ServiceWorkerFrameLoaderClient(WebPageProxyIdentifier webPageProxyID, PageIdentifier pageID, FrameIdentifier frameID, const String& userAgent) 78 89 : m_webPageProxyID(webPageProxyID) … … 134 145 pageConfiguration.socketProvider = WebSocketProvider::create(); 135 146 pageConfiguration.userContentProvider = m_userContentController; 147 #if ENABLE(WEB_RTC) 148 pageConfiguration.libWebRTCProvider = makeUniqueRef<ServiceWorkerLibWebRTCProvider>(); 149 #endif 136 150 137 151 auto effectiveUserAgent = WTFMove(userAgent); -
trunk/Tools/ChangeLog
r274754 r274758 1 2021-03-22 Youenn Fablet <youenn@apple.com> 2 3 Implement RTCDataChannel transfer out of process 4 https://bugs.webkit.org/show_bug.cgi?id=223443 5 6 Reviewed by Eric Carlson. 7 8 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 9 1 10 2021-03-22 Youenn Fablet <youenn@apple.com> 2 11 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r274460 r274758 236 236 3FCC4FE51EC4E8520076E37C /* PictureInPictureDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FCC4FE41EC4E8520076E37C /* PictureInPictureDelegate.mm */; }; 237 237 3FCC4FE81EC4E8CA0076E37C /* PictureInPictureDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 3FCC4FE61EC4E87E0076E37C /* PictureInPictureDelegate.html */; }; 238 411223C726035FBF00B0A0B6 /* WebRTC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 411223C626035FBE00B0A0B6 /* WebRTC.mm */; }; 238 239 41157237234B240C0050A1D1 /* GetUserMedia.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41157236234B24040050A1D1 /* GetUserMedia.mm */; }; 239 240 4135FB842011FAA700332139 /* InjectInternals_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4135FB832011FAA300332139 /* InjectInternals_Bundle.cpp */; }; … … 1998 1999 3FCC4FE41EC4E8520076E37C /* PictureInPictureDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PictureInPictureDelegate.mm; sourceTree = "<group>"; }; 1999 2000 3FCC4FE61EC4E87E0076E37C /* PictureInPictureDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = PictureInPictureDelegate.html; sourceTree = "<group>"; }; 2001 411223C626035FBE00B0A0B6 /* WebRTC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebRTC.mm; sourceTree = "<group>"; }; 2000 2002 41157236234B24040050A1D1 /* GetUserMedia.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetUserMedia.mm; sourceTree = "<group>"; }; 2001 2003 4135FB832011FAA300332139 /* InjectInternals_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InjectInternals_Bundle.cpp; path = Tests/InjectInternals_Bundle.cpp; sourceTree = SOURCE_ROOT; }; … … 4273 4275 520BCF4B141EB09E00937EA8 /* WebArchive.cpp */, 4274 4276 520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */, 4277 411223C626035FBE00B0A0B6 /* WebRTC.mm */, 4275 4278 7CFBCADD1743234F00B2BFCF /* WillLoad.cpp */, 4276 4279 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */, … … 5679 5682 448110C2253F40300097FC33 /* WebPreferencesTest.mm in Sources */, 5680 5683 51714EB81CF8CA17004723C4 /* WebProcessKillIDBCleanup.mm in Sources */, 5684 411223C726035FBF00B0A0B6 /* WebRTC.mm in Sources */, 5681 5685 536770341CC8022800D425B1 /* WebScriptObjectDescription.mm in Sources */, 5682 5686 5120C83D1E6751290025B250 /* WebsiteDataStoreCustomPaths.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.