WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-211290-20200501191705.patch (text/plain), 47.78 KB, created by
youenn fablet
on 2020-05-01 10:17:07 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2020-05-01 10:17:07 PDT
Size:
47.78 KB
patch
obsolete
>Subversion Revision: 260997 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 2afc57c7896ec779a985da96417101467f60ed25..64e621b153c4dac85f91a51e483c6a4c754ddc5c 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,52 @@ >+2020-05-01 Youenn Fablet <youenn@apple.com> >+ >+ Receiving WebRTC network packets should not go through the main thread >+ https://bugs.webkit.org/show_bug.cgi?id=211290 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Instead of going to main thread before going to rtc network thread, we register a message receiver and dispatch directly to rtc network thread. >+ This ensures rtc packets are not blocked if main thread is busy. >+ >+ * DerivedSources-input.xcfilelist: >+ * DerivedSources-output.xcfilelist: >+ * DerivedSources.make: >+ * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: >+ (WebKit::LibWebRTCSocketClient::signalReadPacket): >+ (WebKit::LibWebRTCSocketClient::signalSentPacket): >+ (WebKit::LibWebRTCSocketClient::signalAddressReady): >+ (WebKit::LibWebRTCSocketClient::signalConnect): >+ (WebKit::LibWebRTCSocketClient::signalClose): >+ * NetworkProcess/webrtc/NetworkRTCProvider.cpp: >+ (WebKit::NetworkRTCProvider::createSocket): >+ (WebKit::NetworkRTCProvider::createServerTCPSocket): >+ (WebKit::NetworkRTCProvider::createClientTCPSocket): >+ (WebKit::NetworkRTCProvider::newConnection): >+ (WebKit::NetworkRTCProvider::closeListeningSockets): >+ * Sources.txt: >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/Network/NetworkProcessConnection.cpp: >+ (WebKit::NetworkProcessConnection::NetworkProcessConnection): >+ (WebKit::NetworkProcessConnection::didReceiveMessage): >+ * WebProcess/Network/webrtc/LibWebRTCNetwork.cpp: Added >+ * WebProcess/Network/webrtc/LibWebRTCNetwork.h: >+ (WebKit::LibWebRTCNetwork::connection): >+ (WebKit::LibWebRTCNetwork::~LibWebRTCNetwork): >+ (WebKit::LibWebRTCNetwork::networkProcessCrashed): >+ (WebKit::LibWebRTCNetwork::setConnection): >+ (WebKit::LibWebRTCNetwork::dispatchToThread): >+ (WebKit::LibWebRTCNetwork::signalAddressReady): >+ (WebKit::LibWebRTCNetwork::signalReadPacket): >+ (WebKit::LibWebRTCNetwork::signalSentPacket): >+ (WebKit::LibWebRTCNetwork::signalConnect): >+ (WebKit::LibWebRTCNetwork::signalClose): >+ (WebKit::LibWebRTCNetwork::signalNewConnection): >+ * WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in: Added. >+ * WebProcess/Network/webrtc/LibWebRTCSocket.h: >+ * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: >+ * WebProcess/Network/webrtc/WebRTCSocket.cpp: Removed. >+ * WebProcess/Network/webrtc/WebRTCSocket.h: Removed. >+ > 2020-05-01 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK] Move focus out of the web view when tab is pressed and there isn't a next element to focus >diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt >index daecd86c74c8410a56680670afe6e391cc462256..377ab406a4fd29655fcaea4dfde0018214fbf17f 100644 >--- a/Source/WebKit/CMakeLists.txt >+++ b/Source/WebKit/CMakeLists.txt >@@ -234,10 +234,10 @@ set(WebKit_MESSAGES_IN_FILES > WebProcess/Inspector/WebInspectorInterruptDispatcher.messages.in > WebProcess/Inspector/WebInspectorUI.messages.in > >+ WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in > WebProcess/Network/webrtc/WebMDNSRegister.messages.in > WebProcess/Network/webrtc/WebRTCMonitor.messages.in > WebProcess/Network/webrtc/WebRTCResolver.messages.in >- WebProcess/Network/webrtc/WebRTCSocket.messages.in > > WebProcess/Network/NetworkProcessConnection.messages.in > WebProcess/Network/WebResourceLoader.messages.in >diff --git a/Source/WebKit/DerivedSources-input.xcfilelist b/Source/WebKit/DerivedSources-input.xcfilelist >index 8bdb51a16d3988973d83db71577ef985e3fdebff..ad99d335627dd1a7379c278fac89b7cd1b14964b 100644 >--- a/Source/WebKit/DerivedSources-input.xcfilelist >+++ b/Source/WebKit/DerivedSources-input.xcfilelist >@@ -140,10 +140,10 @@ $(PROJECT_DIR)/WebProcess/Network/NetworkProcessConnection.messages.in > $(PROJECT_DIR)/WebProcess/Network/WebResourceLoader.messages.in > $(PROJECT_DIR)/WebProcess/Network/WebSocketChannel.messages.in > $(PROJECT_DIR)/WebProcess/Network/WebSocketStream.messages.in >+$(PROJECT_DIR)/WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in > $(PROJECT_DIR)/WebProcess/Network/webrtc/WebMDNSRegister.messages.in > $(PROJECT_DIR)/WebProcess/Network/webrtc/WebRTCMonitor.messages.in > $(PROJECT_DIR)/WebProcess/Network/webrtc/WebRTCResolver.messages.in >-$(PROJECT_DIR)/WebProcess/Network/webrtc/WebRTCSocket.messages.in > $(PROJECT_DIR)/WebProcess/Notifications/WebNotificationManager.messages.in > $(PROJECT_DIR)/WebProcess/Plugins/PluginProcessConnection.messages.in > $(PROJECT_DIR)/WebProcess/Plugins/PluginProcessConnectionManager.messages.in >diff --git a/Source/WebKit/DerivedSources-output.xcfilelist b/Source/WebKit/DerivedSources-output.xcfilelist >index d10046339fe4c3694926a878a2eb1cd08b17080d..a25f5608cb545aa319420196938fd4319b3c0d36 100644 >--- a/Source/WebKit/DerivedSources-output.xcfilelist >+++ b/Source/WebKit/DerivedSources-output.xcfilelist >@@ -57,6 +57,9 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCCodecsMessagesReplies.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCCodecsProxyMessageReceiver.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCCodecsProxyMessages.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCCodecsProxyMessagesReplies.h >+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCNetworkMessageReceiver.cpp >+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCNetworkMessages.h >+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCNetworkMessagesReplies.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCRemoteCodecsMessageReceiver.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCRemoteCodecsMessages.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/LibWebRTCRemoteCodecsMessagesReplies.h >@@ -384,9 +387,6 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebRTCMonitorMessagesReplies.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebRTCResolverMessageReceiver.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebRTCResolverMessages.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebRTCResolverMessagesReplies.h >-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebRTCSocketMessageReceiver.cpp >-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebRTCSocketMessages.h >-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebRTCSocketMessagesReplies.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebResourceLoaderMessageReceiver.cpp > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebResourceLoaderMessages.h > $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/WebResourceLoaderMessagesReplies.h >diff --git a/Source/WebKit/DerivedSources.make b/Source/WebKit/DerivedSources.make >index e45da893d9a7c9ec6a177192ecf0672ce350dd6b..f1ea1f100d40acfc89ee2a845ce212c6553e5de4 100644 >--- a/Source/WebKit/DerivedSources.make >+++ b/Source/WebKit/DerivedSources.make >@@ -129,6 +129,7 @@ MESSAGE_RECEIVERS = \ > LegacyCustomProtocolManagerProxy \ > LibWebRTCCodecs \ > LibWebRTCCodecsProxy \ >+ LibWebRTCNetwork \ > MediaPlayerPrivateRemote \ > NPObjectMessageReceiver \ > NetworkConnectionToWebProcess \ >@@ -228,7 +229,6 @@ MESSAGE_RECEIVERS = \ > WebProcessProxy \ > WebRTCMonitor \ > WebRTCResolver \ >- WebRTCSocket \ > WebResourceLoader \ > WebSWClientConnection \ > WebSWContextManagerConnection \ >diff --git a/Source/WebKit/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp b/Source/WebKit/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp >index c1d5cbb7dea1893c1055e584ea24ca8cd25da41c..352ffd4f0f59d831b74f2c72aae753a3d2e22915 100644 >--- a/Source/WebKit/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp >+++ b/Source/WebKit/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp >@@ -30,9 +30,9 @@ > > #include "Connection.h" > #include "DataReference.h" >+#include "LibWebRTCNetworkMessages.h" > #include "Logging.h" > #include "NetworkRTCProvider.h" >-#include "WebRTCSocketMessages.h" > #include <WebCore/SharedBuffer.h> > #include <wtf/Function.h> > >@@ -100,7 +100,7 @@ void LibWebRTCSocketClient::signalReadPacket(rtc::AsyncPacketSocket* socket, con > auto buffer = WebCore::SharedBuffer::create(value, length); > m_rtcProvider.sendFromMainThread([identifier = m_identifier, buffer = WTFMove(buffer), address = RTCNetwork::isolatedCopy(address), packetTime](IPC::Connection& connection) { > IPC::DataReference data(reinterpret_cast<const uint8_t*>(buffer->data()), buffer->size()); >- connection.send(Messages::WebRTCSocket::SignalReadPacket(data, RTCNetwork::IPAddress(address.ipaddr()), address.port(), packetTime), identifier); >+ connection.send(Messages::LibWebRTCNetwork::SignalReadPacket(identifier, data, RTCNetwork::IPAddress(address.ipaddr()), address.port(), packetTime), 0); > }); > } > >@@ -108,7 +108,7 @@ void LibWebRTCSocketClient::signalSentPacket(rtc::AsyncPacketSocket* socket, con > { > ASSERT_UNUSED(socket, m_socket.get() == socket); > m_rtcProvider.sendFromMainThread([identifier = m_identifier, sentPacket](IPC::Connection& connection) { >- connection.send(Messages::WebRTCSocket::SignalSentPacket(sentPacket.packet_id, sentPacket.send_time_ms), identifier); >+ connection.send(Messages::LibWebRTCNetwork::SignalSentPacket(identifier, sentPacket.packet_id, sentPacket.send_time_ms), 0); > }); > } > >@@ -122,7 +122,7 @@ void LibWebRTCSocketClient::signalAddressReady(rtc::AsyncPacketSocket* socket, c > { > ASSERT_UNUSED(socket, m_socket.get() == socket); > m_rtcProvider.sendFromMainThread([identifier = m_identifier, address = RTCNetwork::isolatedCopy(address)](IPC::Connection& connection) { >- connection.send(Messages::WebRTCSocket::SignalAddressReady(RTCNetwork::SocketAddress(address)), identifier); >+ connection.send(Messages::LibWebRTCNetwork::SignalAddressReady(identifier, RTCNetwork::SocketAddress(address)), 0); > }); > } > >@@ -135,7 +135,7 @@ void LibWebRTCSocketClient::signalConnect(rtc::AsyncPacketSocket* socket) > { > ASSERT_UNUSED(socket, m_socket.get() == socket); > m_rtcProvider.sendFromMainThread([identifier = m_identifier](IPC::Connection& connection) { >- connection.send(Messages::WebRTCSocket::SignalConnect(), identifier); >+ connection.send(Messages::LibWebRTCNetwork::SignalConnect(identifier), 0); > }); > } > >@@ -143,7 +143,7 @@ void LibWebRTCSocketClient::signalClose(rtc::AsyncPacketSocket* socket, int erro > { > ASSERT_UNUSED(socket, m_socket.get() == socket); > m_rtcProvider.sendFromMainThread([identifier = m_identifier, error](IPC::Connection& connection) { >- connection.send(Messages::WebRTCSocket::SignalClose(error), identifier); >+ connection.send(Messages::LibWebRTCNetwork::SignalClose(identifier, error), 0); > }); > // We want to remove 'this' from the socket map now but we will destroy it asynchronously > // so that the socket parameter of signalClose remains alive as the caller of signalClose may actually being using it afterwards. >diff --git a/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp b/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp >index a2bcc6b7522b21cf2a885d3bf7220dc92e8a33b9..2a005af07cf17731bcc32a891ad69776820cdf2a 100644 >--- a/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp >+++ b/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp >@@ -28,6 +28,7 @@ > > #if USE(LIBWEBRTC) > >+#include "LibWebRTCNetworkMessages.h" > #include "LibWebRTCSocketClient.h" > #include "Logging.h" > #include "NetworkConnectionToWebProcess.h" >@@ -35,7 +36,6 @@ > #include "NetworkRTCResolver.h" > #include "NetworkRTCSocket.h" > #include "WebRTCResolverMessages.h" >-#include "WebRTCSocketMessages.h" > #include <WebCore/LibWebRTCMacros.h> > #include <webrtc/rtc_base/async_packet_socket.h> > #include <webrtc/rtc_base/logging.h> >@@ -118,7 +118,7 @@ void NetworkRTCProvider::createSocket(LibWebRTCSocketIdentifier identifier, std: > if (!socket) { > sendFromMainThread([this, identifier, size = m_sockets.size()](IPC::Connection& connection) { > RELEASE_LOG_ERROR_IF_ALLOWED("createSocket with %u sockets is unable to create a new socket", size); >- connection.send(Messages::WebRTCSocket::SignalClose(1), identifier); >+ connection.send(Messages::LibWebRTCNetwork::SignalClose(identifier, 1), 0); > }); > return; > } >@@ -137,7 +137,7 @@ void NetworkRTCProvider::createServerTCPSocket(LibWebRTCSocketIdentifier identif > { > if (!m_isListeningSocketAuthorized) { > if (m_connection) >- m_connection->connection().send(Messages::WebRTCSocket::SignalClose(1), identifier); >+ m_connection->connection().send(Messages::LibWebRTCNetwork::SignalClose(identifier, 1), 0); > return; > } > >@@ -158,7 +158,7 @@ void NetworkRTCProvider::createClientTCPSocket(LibWebRTCSocketIdentifier identif > { > auto* session = m_connection->networkSession(); > if (!session) { >- m_connection->connection().send(Messages::WebRTCSocket::SignalClose(1), identifier); >+ m_connection->connection().send(Messages::LibWebRTCNetwork::SignalClose(identifier, 1), 0); > return; > } > callOnRTCNetworkThread([this, identifier, localAddress = RTCNetwork::isolatedCopy(localAddress.value), remoteAddress = RTCNetwork::isolatedCopy(remoteAddress.value), proxyInfo = proxyInfoFromSession(remoteAddress, *session), userAgent = WTFMove(userAgent).isolatedCopy(), options]() { >@@ -193,7 +193,7 @@ void NetworkRTCProvider::newConnection(Socket& serverSocket, std::unique_ptr<rtc > { > auto incomingSocketIdentifier = LibWebRTCSocketIdentifier::generate(); > sendFromMainThread([identifier = serverSocket.identifier(), incomingSocketIdentifier, remoteAddress = RTCNetwork::isolatedCopy(newSocket->GetRemoteAddress())](IPC::Connection& connection) { >- connection.send(Messages::WebRTCSocket::SignalNewConnection(incomingSocketIdentifier, RTCNetwork::SocketAddress(remoteAddress)), identifier); >+ connection.send(Messages::LibWebRTCNetwork::SignalNewConnection(identifier, incomingSocketIdentifier, RTCNetwork::SocketAddress(remoteAddress)), 0); > }); > m_pendingIncomingSockets.add(incomingSocketIdentifier, WTFMove(newSocket)); > } >@@ -264,7 +264,7 @@ void NetworkRTCProvider::closeListeningSockets(Function<void()>&& completionHand > callOnMainThread([provider = makeRef(*this), listeningSocketIdentifiers = WTFMove(listeningSocketIdentifiers), completionHandler = WTFMove(completionHandler)] { > if (provider->m_connection) { > for (auto identifier : listeningSocketIdentifiers) >- provider->m_connection->connection().send(Messages::WebRTCSocket::SignalClose(ECONNABORTED), identifier); >+ provider->m_connection->connection().send(Messages::LibWebRTCNetwork::SignalClose(identifier, ECONNABORTED), 0); > } > completionHandler(); > }); >diff --git a/Source/WebKit/Sources.txt b/Source/WebKit/Sources.txt >index ad016bee57d2d1c9d8e8267cf1181b7a8833a39a..89434b54cde8a18a87c755238fffb0c0c2a372c8 100644 >--- a/Source/WebKit/Sources.txt >+++ b/Source/WebKit/Sources.txt >@@ -589,6 +589,7 @@ WebProcess/Network/WebSocketChannelManager.cpp > WebProcess/Network/WebSocketProvider.cpp > WebProcess/Network/WebSocketStream.cpp > >+WebProcess/Network/webrtc/LibWebRTCNetwork.cpp > WebProcess/Network/webrtc/LibWebRTCProvider.cpp > WebProcess/Network/webrtc/LibWebRTCResolver.cpp > WebProcess/Network/webrtc/LibWebRTCSocket.cpp >@@ -596,7 +597,6 @@ WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp > WebProcess/Network/webrtc/WebMDNSRegister.cpp > WebProcess/Network/webrtc/WebRTCMonitor.cpp > WebProcess/Network/webrtc/WebRTCResolver.cpp >-WebProcess/Network/webrtc/WebRTCSocket.cpp > > WebProcess/Notifications/NotificationPermissionRequestManager.cpp > WebProcess/Notifications/WebNotificationManager.cpp >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 50f042ad036aff3c3b0d94dfb517962311272f5e..e8e9bc02c53fe69978b19586d09b7356a1e142cb 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -1074,7 +1074,7 @@ > 51EFC1CF1524E62500C9A938 /* WKBundleDOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FA2D541521118600C1BA0B /* WKBundleDOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */; }; > 51F060E11654318500F3281B /* WebResourceLoaderMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */; }; >- 51F060E11654318500F3281C /* WebRTCSocketMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3281C /* WebRTCSocketMessageReceiver.cpp */; }; >+ 51F060E11654318500F3281C /* LibWebRTCNetworkMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3281C /* LibWebRTCNetworkMessageReceiver.cpp */; }; > 51F060E11654318500F3281D /* NetworkRTCSocketMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3281D /* NetworkRTCSocketMessageReceiver.cpp */; }; > 51F060E11654318500F3281E /* NetworkRTCMonitorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3281E /* NetworkRTCMonitorMessageReceiver.cpp */; }; > 51F060E11654318500F3281F /* WebRTCMonitorMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3281F /* WebRTCMonitorMessageReceiver.cpp */; }; >@@ -3429,6 +3429,8 @@ > 4157E4AF20E2EC9800A6C0D7 /* com.google.o1dbrowserplugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.google.o1dbrowserplugin.sb; sourceTree = "<group>"; }; > 4158649A23BE092400A0A61E /* RTCEncoderIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCEncoderIdentifier.h; sourceTree = "<group>"; }; > 416CD74523FB178B00661D99 /* MDNSRegisterIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MDNSRegisterIdentifier.h; path = Network/webrtc/MDNSRegisterIdentifier.h; sourceTree = "<group>"; }; >+ 416F8086245B397400B68F02 /* LibWebRTCNetwork.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LibWebRTCNetwork.messages.in; path = Network/webrtc/LibWebRTCNetwork.messages.in; sourceTree = "<group>"; }; >+ 416F8089245C7FF500B68F02 /* LibWebRTCNetwork.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCNetwork.cpp; path = Network/webrtc/LibWebRTCNetwork.cpp; sourceTree = "<group>"; }; > 4172198923B6128200AE5686 /* LibWebRTCCodecs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LibWebRTCCodecs.h; sourceTree = "<group>"; }; > 4172198A23B6128200AE5686 /* LibWebRTCCodecs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LibWebRTCCodecs.cpp; sourceTree = "<group>"; }; > 4172198C23B612E800AE5686 /* RTCDecoderIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDecoderIdentifier.h; sourceTree = "<group>"; }; >@@ -3811,7 +3813,7 @@ > 51E8B68D1E712873001B7132 /* WebURLSchemeTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebURLSchemeTask.cpp; sourceTree = "<group>"; }; > 51E949961D761CC700EC9EB9 /* UIGamepadProviderIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIGamepadProviderIOS.mm; sourceTree = "<group>"; }; > 51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = WebResourceLoaderMessageReceiver.cpp; path = DerivedSources/WebKit2/WebResourceLoaderMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >- 51F060DD1654317500F3281C /* WebRTCSocketMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = WebRTCSocketMessageReceiver.cpp; path = DerivedSources/WebKit2/WebRTCSocketMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >+ 51F060DD1654317500F3281C /* LibWebRTCNetworkMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCNetworkMessageReceiver.cpp; path = DerivedSources/WebKit2/LibWebRTCNetworkMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; > 51F060DD1654317500F3281D /* NetworkRTCSocketMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkRTCSocketMessageReceiver.cpp; path = DerivedSources/WebKit2/NetworkRTCSocketMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; > 51F060DD1654317500F3281E /* NetworkRTCMonitorMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkRTCMonitorMessageReceiver.cpp; path = DerivedSources/WebKit2/NetworkRTCMonitorMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; > 51F060DD1654317500F3281F /* WebRTCMonitorMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = WebRTCMonitorMessageReceiver.cpp; path = DerivedSources/WebKit2/WebRTCMonitorMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; >@@ -7585,7 +7587,9 @@ > 4130759E1DE85E650039EC69 /* webrtc */ = { > isa = PBXGroup; > children = ( >+ 416F8089245C7FF500B68F02 /* LibWebRTCNetwork.cpp */, > 411B22621E371244004F7363 /* LibWebRTCNetwork.h */, >+ 416F8086245B397400B68F02 /* LibWebRTCNetwork.messages.in */, > 413075A71DE85EE70039EC69 /* LibWebRTCProvider.cpp */, > 413075A81DE85EE70039EC69 /* LibWebRTCProvider.h */, > 41FAF5F71E3C0B47001AE678 /* LibWebRTCResolver.cpp */, >@@ -9983,6 +9987,7 @@ > 2984F587164BA095004BC0C6 /* LegacyCustomProtocolManagerMessages.h */, > 2984F57A164B915F004BC0C6 /* LegacyCustomProtocolManagerProxyMessageReceiver.cpp */, > 2984F57B164B915F004BC0C6 /* LegacyCustomProtocolManagerProxyMessages.h */, >+ 51F060DD1654317500F3281C /* LibWebRTCNetworkMessageReceiver.cpp */, > 07E19EF823D401F00094FFB4 /* MediaPlayerPrivateRemoteMessageReceiver.cpp */, > 07E19EF923D401F00094FFB4 /* MediaPlayerPrivateRemoteMessages.h */, > 07E19EFA23D401F00094FFB4 /* MediaPlayerPrivateRemoteMessagesReplies.h */, >@@ -10184,7 +10189,6 @@ > 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */, > 51F060DD1654317500F3281F /* WebRTCMonitorMessageReceiver.cpp */, > 51F060DD1654317500F3282C /* WebRTCResolverMessageReceiver.cpp */, >- 51F060DD1654317500F3281C /* WebRTCSocketMessageReceiver.cpp */, > 41F060DD1654317500F3281C /* WebSocketChannelMessageReceiver.cpp */, > 5C0B17761E7C879C00E9123C /* WebSocketStreamMessageReceiver.cpp */, > 5C0B17771E7C879C00E9123C /* WebSocketStreamMessages.h */, >@@ -12689,6 +12693,7 @@ > 2D913442212CF9F000128AFD /* JSNPObject.cpp in Sources */, > 2984F588164BA095004BC0C6 /* LegacyCustomProtocolManagerMessageReceiver.cpp in Sources */, > 2984F57C164B915F004BC0C6 /* LegacyCustomProtocolManagerProxyMessageReceiver.cpp in Sources */, >+ 51F060E11654318500F3281C /* LibWebRTCNetworkMessageReceiver.cpp in Sources */, > 449D90DA21FDC30B00F677C0 /* LocalAuthenticationSoftLink.mm in Sources */, > 2D92A779212B6A6100F493FD /* Logging.cpp in Sources */, > 07E19EFB23D401F10094FFB4 /* MediaPlayerPrivateRemoteMessageReceiver.cpp in Sources */, >@@ -13021,7 +13026,6 @@ > 51F060E11654318500F3281B /* WebResourceLoaderMessageReceiver.cpp in Sources */, > 51F060E11654318500F3281F /* WebRTCMonitorMessageReceiver.cpp in Sources */, > 51F060E11654318500F3282C /* WebRTCResolverMessageReceiver.cpp in Sources */, >- 51F060E11654318500F3281C /* WebRTCSocketMessageReceiver.cpp in Sources */, > 41E0A7CB23B645CD00561060 /* WebSocketChannel.cpp in Sources */, > 41F060E11654318500F3281C /* WebSocketChannelMessageReceiver.cpp in Sources */, > 5C0B17791E7C882100E9123C /* WebSocketStreamMessageReceiver.cpp in Sources */, >diff --git a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp >index 348d8c9c2b56a4f94e1f08213b50dc18d1e301bf..865c227c533ce0f71043a0efee3d7c528d2b4dcc 100644 >--- a/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp >+++ b/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp >@@ -46,7 +46,6 @@ > #include "WebRTCMonitor.h" > #include "WebRTCMonitorMessages.h" > #include "WebRTCResolverMessages.h" >-#include "WebRTCSocketMessages.h" > #include "WebResourceLoaderMessages.h" > #include "WebSWClientConnection.h" > #include "WebSWClientConnectionMessages.h" >@@ -77,6 +76,7 @@ NetworkProcessConnection::NetworkProcessConnection(IPC::Connection::Identifier c > , m_cookieAcceptPolicy(cookieAcceptPolicy) > { > m_connection->open(); >+ WebProcess::singleton().libWebRTCNetwork().setConnection(m_connection.copyRef()); > } > > NetworkProcessConnection::~NetworkProcessConnection() >@@ -112,14 +112,6 @@ void NetworkProcessConnection::didReceiveMessage(IPC::Connection& connection, IP > } > > #if USE(LIBWEBRTC) >- if (decoder.messageReceiverName() == Messages::WebRTCSocket::messageReceiverName()) { >- auto& network = WebProcess::singleton().libWebRTCNetwork(); >- if (network.isActive()) >- network.socket(makeObjectIdentifier<LibWebRTCSocketIdentifierType>(decoder.destinationID())).didReceiveMessage(connection, decoder); >- else >- RELEASE_LOG_ERROR(WebRTC, "Received WebRTCSocket message while libWebRTCNetwork is not active"); >- return; >- } > if (decoder.messageReceiverName() == Messages::WebRTCMonitor::messageReceiverName()) { > auto& network = WebProcess::singleton().libWebRTCNetwork(); > if (network.isActive()) >diff --git a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.cpp b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..841c8e1312c5ab41c7a731b0bbd2da52403e5584 >--- /dev/null >+++ b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.cpp >@@ -0,0 +1,120 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "LibWebRTCNetwork.h" >+ >+#include "DataReference.h" >+#include "LibWebRTCNetworkMessages.h" >+#include "Logging.h" >+#include <WebCore/SharedBuffer.h> >+ >+namespace WebKit { >+ >+LibWebRTCNetwork::~LibWebRTCNetwork() >+{ >+ setConnection(nullptr); >+} >+ >+void LibWebRTCNetwork::networkProcessCrashed() >+{ >+ setConnection(nullptr); >+ >+#if USE(LIBWEBRTC) >+ m_webNetworkMonitor.networkProcessCrashed(); >+#endif >+} >+ >+void LibWebRTCNetwork::setConnection(RefPtr<IPC::Connection>&& connection) >+{ >+ if (m_connection) >+ m_connection->removeThreadMessageReceiver(Messages::LibWebRTCNetwork::messageReceiverName()); >+ m_connection = WTFMove(connection); >+ if (m_connection) >+ m_connection->addThreadMessageReceiver(Messages::LibWebRTCNetwork::messageReceiverName(), this); >+} >+ >+bool LibWebRTCNetwork::isActive() const >+{ >+#if USE(LIBWEBRTC) >+ return WebCore::LibWebRTCProvider::hasWebRTCThreads(); >+#else >+ return false; >+#endif >+} >+ >+void LibWebRTCNetwork::dispatchToThread(Function<void()>&& callback) >+{ >+ if (!isActive()) { >+ RELEASE_LOG_ERROR(WebRTC, "Received WebRTCSocket message while libWebRTCNetwork is not active"); >+ return; >+ } >+ >+#if USE(LIBWEBRTC) >+ WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread(WTFMove(callback)); >+#else >+ UNUSED_PARAM(callback); >+#endif >+} >+ >+#if USE(LIBWEBRTC) >+void LibWebRTCNetwork::signalAddressReady(WebCore::LibWebRTCSocketIdentifier identifier, const RTCNetwork::SocketAddress& address) >+{ >+ if (auto* socket = m_socketFactory.socket(identifier)) >+ socket->signalAddressReady(address.value); >+} >+ >+void LibWebRTCNetwork::signalReadPacket(WebCore::LibWebRTCSocketIdentifier identifier, const IPC::DataReference& data, const RTCNetwork::IPAddress& address, uint16_t port, int64_t timestamp) >+{ >+ if (auto* socket = m_socketFactory.socket(identifier)) >+ socket->signalReadPacket(data.data(), data.size(), rtc::SocketAddress(address.value, port), timestamp); >+} >+ >+void LibWebRTCNetwork::signalSentPacket(WebCore::LibWebRTCSocketIdentifier identifier, int rtcPacketID, int64_t sendTimeMs) >+{ >+ if (auto* socket = m_socketFactory.socket(identifier)) >+ socket->signalSentPacket(rtcPacketID, sendTimeMs); >+} >+ >+void LibWebRTCNetwork::signalConnect(WebCore::LibWebRTCSocketIdentifier identifier) >+{ >+ if (auto* socket = m_socketFactory.socket(identifier)) >+ socket->signalConnect(); >+} >+ >+void LibWebRTCNetwork::signalClose(WebCore::LibWebRTCSocketIdentifier identifier, int error) >+{ >+ if (auto* socket = m_socketFactory.socket(identifier)) >+ socket->signalClose(error); >+} >+ >+void LibWebRTCNetwork::signalNewConnection(WebCore::LibWebRTCSocketIdentifier identifier, WebCore::LibWebRTCSocketIdentifier newSocketIdentifier, const RTCNetwork::SocketAddress& remoteAddress) >+{ >+ if (auto* socket = m_socketFactory.socket(identifier)) >+ socket->signalNewConnection(m_socketFactory.createNewConnectionSocket(*socket, newSocketIdentifier, remoteAddress.value)); >+} >+#endif >+ >+} // namespace WebKit >diff --git a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h >index d1f49f0688de6bd4f70eab6400306161a181914f..b1ef49621802ac7b46478a701266fedefe2c8eb4 100644 >--- a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h >+++ b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h >@@ -25,35 +25,35 @@ > > #pragma once > >-#if USE(LIBWEBRTC) >+#include "Connection.h" > #include "LibWebRTCProvider.h" > #include "LibWebRTCSocketFactory.h" >+#include "WebMDNSRegister.h" > #include "WebRTCMonitor.h" > #include "WebRTCResolver.h" >-#include "WebRTCSocket.h" >-#endif >- >-#include "WebMDNSRegister.h" > #include <WebCore/LibWebRTCSocketIdentifier.h> > > namespace WebKit { > >-class LibWebRTCNetwork { >+class LibWebRTCNetwork : public IPC::Connection::ThreadMessageReceiver { > WTF_MAKE_FAST_ALLOCATED; > public: > LibWebRTCNetwork() = default; >+ ~LibWebRTCNetwork(); > >+ void setConnection(RefPtr<IPC::Connection>&&); > void networkProcessCrashed(); > > bool isActive() const; > >+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&); >+ > #if USE(LIBWEBRTC) > WebRTCMonitor& monitor() { return m_webNetworkMonitor; } > LibWebRTCSocketFactory& socketFactory() { return m_socketFactory; } > > void disableNonLocalhostConnections() { socketFactory().disableNonLocalhostConnections(); } > >- WebRTCSocket socket(WebCore::LibWebRTCSocketIdentifier identifier) { return WebRTCSocket(socketFactory(), identifier); } > WebRTCResolver resolver(LibWebRTCResolverIdentifier identifier) { return WebRTCResolver(socketFactory(), identifier); } > #endif > >@@ -62,6 +62,18 @@ public: > #endif > > private: >+#if USE(LIBWEBRTC) >+ void signalReadPacket(WebCore::LibWebRTCSocketIdentifier, const IPC::DataReference&, const RTCNetwork::IPAddress&, uint16_t port, int64_t); >+ void signalSentPacket(WebCore::LibWebRTCSocketIdentifier, int, int64_t); >+ void signalAddressReady(WebCore::LibWebRTCSocketIdentifier, const RTCNetwork::SocketAddress&); >+ void signalConnect(WebCore::LibWebRTCSocketIdentifier); >+ void signalClose(WebCore::LibWebRTCSocketIdentifier, int); >+ void signalNewConnection(WebCore::LibWebRTCSocketIdentifier socketIdentifier, WebCore::LibWebRTCSocketIdentifier newSocketIdentifier, const WebKit::RTCNetwork::SocketAddress&); >+#endif >+ >+ // IPC::Connection::ThreadMessageReceiver >+ void dispatchToThread(Function<void()>&&) final; >+ > #if USE(LIBWEBRTC) > LibWebRTCSocketFactory m_socketFactory; > WebRTCMonitor m_webNetworkMonitor; >@@ -69,22 +81,7 @@ private: > #if ENABLE(WEB_RTC) > WebMDNSRegister m_mdnsRegister; > #endif >+ RefPtr<IPC::Connection> m_connection; > }; > >-inline void LibWebRTCNetwork::networkProcessCrashed() >-{ >-#if USE(LIBWEBRTC) >- m_webNetworkMonitor.networkProcessCrashed(); >-#endif >-} >- >-inline bool LibWebRTCNetwork::isActive() const >-{ >-#if USE(LIBWEBRTC) >- return WebCore::LibWebRTCProvider::hasWebRTCThreads(); >-#else >- return false; >-#endif >-} >- > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in >new file mode 100644 >index 0000000000000000000000000000000000000000..996d1b62ac6bad13c96c5afaea7c81251010ba44 >--- /dev/null >+++ b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in >@@ -0,0 +1,34 @@ >+# Copyright (C) 2017 Apple Inc. All rights reserved. >+# >+# Redistribution and use in source and binary forms, with or without >+# modification, are permitted provided that the following conditions >+# are met: >+# 1. Redistributions of source code must retain the above copyright >+# notice, this list of conditions and the following disclaimer. >+# 2. Redistributions in binary form must reproduce the above copyright >+# notice, this list of conditions and the following disclaimer in the >+# documentation and/or other materials provided with the distribution. >+# >+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND >+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR >+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR >+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER >+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ >+#if USE(LIBWEBRTC) >+ >+messages -> LibWebRTCNetwork NotRefCounted { >+ SignalReadPacket(WebCore::LibWebRTCSocketIdentifier socketIdentifier, IPC::DataReference data, WebKit::RTCNetwork::IPAddress address, uint16_t port, int64_t timestamp) >+ SignalSentPacket(WebCore::LibWebRTCSocketIdentifier socketIdentifier, int packetSize, int64_t timestamp) >+ SignalAddressReady(WebCore::LibWebRTCSocketIdentifier socketIdentifier, WebKit::RTCNetwork::SocketAddress address) >+ SignalConnect(WebCore::LibWebRTCSocketIdentifier socketIdentifier) >+ SignalClose(WebCore::LibWebRTCSocketIdentifier socketIdentifier, int error) >+ SignalNewConnection(WebCore::LibWebRTCSocketIdentifier socketIdentifier, WebCore::LibWebRTCSocketIdentifier newSocketIdentifier, WebKit::RTCNetwork::SocketAddress remoteAddress) >+} >+ >+#endif // USE(LIBWEBRTC) >diff --git a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp >index b5e43f456eb30e02ff1d34d5c1572f12a5137399..7aed6457a838157b72b023740d8d75248ba52643 100644 >--- a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp >+++ b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp >@@ -81,13 +81,13 @@ void LibWebRTCSocket::signalAddressReady(const rtc::SocketAddress& address) > SignalAddressReady(this, m_localAddress); > } > >-void LibWebRTCSocket::signalReadPacket(const WebCore::SharedBuffer& buffer, rtc::SocketAddress&& address, int64_t timestamp) >+void LibWebRTCSocket::signalReadPacket(const uint8_t* data, size_t size, rtc::SocketAddress&& address, int64_t timestamp) > { > if (m_isSuspended) > return; > > m_remoteAddress = WTFMove(address); >- SignalReadPacket(this, buffer.data(), buffer.size(), m_remoteAddress, timestamp); >+ SignalReadPacket(this, reinterpret_cast<const char*>(data), size, m_remoteAddress, timestamp); > } > > void LibWebRTCSocket::signalSentPacket(int rtcPacketID, int64_t sendTimeMs) >diff --git a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h >index 3fd1ce1780a9ac6e525576c304dee504a7455952..b2e8ecc798f913e6c926bd7235f3319685b59b10 100644 >--- a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h >+++ b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h >@@ -39,10 +39,6 @@ class DataReference; > class Decoder; > } > >-namespace WebCore { >-class SharedBuffer; >-} >- > namespace WebKit { > > class LibWebRTCSocketFactory; >@@ -69,8 +65,8 @@ public: > private: > bool willSend(size_t); > >- friend class WebRTCSocket; >- void signalReadPacket(const WebCore::SharedBuffer&, rtc::SocketAddress&&, int64_t); >+ friend class LibWebRTCNetwork; >+ void signalReadPacket(const uint8_t*, size_t, rtc::SocketAddress&&, int64_t); > void signalSentPacket(int, int64_t); > void signalAddressReady(const rtc::SocketAddress&); > void signalConnect(); >diff --git a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp >index ff017139f26297f7c5be553a33df530ec6d50e69..a8da7cc9ae804fe9c288bef2d53e65f236adc806 100644 >--- a/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp >+++ b/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp >@@ -32,7 +32,6 @@ > #include "NetworkRTCMonitorMessages.h" > #include "NetworkRTCProviderMessages.h" > #include "WebProcess.h" >-#include "WebRTCSocket.h" > #include <wtf/MainThread.h> > > namespace WebKit { >diff --git a/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.cpp b/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.cpp >deleted file mode 100644 >index 78293bccfb9f2d9bc2f65b0479cb4d58b8c6f9f6..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.cpp >+++ /dev/null >@@ -1,103 +0,0 @@ >-/* >- * Copyright (C) 2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "WebRTCSocket.h" >- >-#if USE(LIBWEBRTC) >- >-#include "DataReference.h" >-#include "LibWebRTCSocket.h" >-#include "LibWebRTCSocketFactory.h" >-#include "NetworkRTCSocketMessages.h" >-#include <WebCore/SharedBuffer.h> >-#include <wtf/Function.h> >- >-namespace WebKit { >-using namespace WebCore; >- >-void WebRTCSocket::signalOnNetworkThread(LibWebRTCSocketFactory& factory, LibWebRTCSocketIdentifier identifier, Function<void(LibWebRTCSocket&)>&& callback) >-{ >- // factory is staying valid during the process lifetime. >- WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread([&factory, identifier, callback = WTFMove(callback)]() { >- auto* socket = factory.socket(identifier); >- if (!socket) >- return; >- callback(*socket); >- }); >-} >- >-WebRTCSocket::WebRTCSocket(LibWebRTCSocketFactory& factory, LibWebRTCSocketIdentifier identifier) >- : m_factory(factory) >- , m_identifier(identifier) >-{ >-} >- >-void WebRTCSocket::signalAddressReady(const RTCNetwork::SocketAddress& address) >-{ >- signalOnNetworkThread(m_factory, m_identifier, [address](LibWebRTCSocket& socket) { >- socket.signalAddressReady(address.value); >- }); >-} >- >-void WebRTCSocket::signalReadPacket(const IPC::DataReference& data, const RTCNetwork::IPAddress& address, uint16_t port, int64_t timestamp) >-{ >- auto buffer = WebCore::SharedBuffer::create(data.data(), data.size()); >- signalOnNetworkThread(m_factory, m_identifier, [buffer = WTFMove(buffer), address, port, timestamp](LibWebRTCSocket& socket) { >- socket.signalReadPacket(buffer.get(), rtc::SocketAddress(address.value, port), timestamp); >- }); >-} >- >-void WebRTCSocket::signalSentPacket(int rtcPacketID, int64_t sendTimeMs) >-{ >- signalOnNetworkThread(m_factory, m_identifier, [rtcPacketID, sendTimeMs](auto& socket) { >- socket.signalSentPacket(rtcPacketID, sendTimeMs); >- }); >-} >- >-void WebRTCSocket::signalConnect() >-{ >- signalOnNetworkThread(m_factory, m_identifier, [](auto& socket) { >- socket.signalConnect(); >- }); >-} >- >-void WebRTCSocket::signalClose(int error) >-{ >- signalOnNetworkThread(m_factory, m_identifier, [error](auto& socket) { >- socket.signalClose(error); >- }); >-} >- >-void WebRTCSocket::signalNewConnection(LibWebRTCSocketIdentifier newSocketIdentifier, const RTCNetwork::SocketAddress& remoteAddress) >-{ >- signalOnNetworkThread(m_factory, m_identifier, [newSocketIdentifier, remoteAddress = RTCNetwork::isolatedCopy(remoteAddress.value)](auto& socket) { >- socket.signalNewConnection(socket.m_factory.createNewConnectionSocket(socket, newSocketIdentifier, remoteAddress)); >- }); >-} >- >-} // namespace WebKit >- >-#endif // USE(LIBWEBRTC) >diff --git a/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.h b/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.h >deleted file mode 100644 >index 57e18dfe3038fce7e72ab49efe8a2870b4f982fc..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.h >+++ /dev/null >@@ -1,67 +0,0 @@ >-/* >- * Copyright (C) 2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if USE(LIBWEBRTC) >- >-#include "RTCNetwork.h" >-#include <WebCore/LibWebRTCSocketIdentifier.h> >-#include <wtf/Function.h> >- >-namespace IPC { >-class Connection; >-class DataReference; >-class Decoder; >-} >- >-namespace WebKit { >- >-class LibWebRTCSocket; >-class LibWebRTCSocketFactory; >- >-class WebRTCSocket { >-public: >- WebRTCSocket(LibWebRTCSocketFactory&, WebCore::LibWebRTCSocketIdentifier); >- >- void didReceiveMessage(IPC::Connection&, IPC::Decoder&); >- >- static void signalOnNetworkThread(LibWebRTCSocketFactory&, WebCore::LibWebRTCSocketIdentifier, Function<void(LibWebRTCSocket&)>&&); >- >-private: >- void signalReadPacket(const IPC::DataReference&, const RTCNetwork::IPAddress&, uint16_t port, int64_t); >- void signalSentPacket(int, int64_t); >- void signalAddressReady(const RTCNetwork::SocketAddress&); >- void signalConnect(); >- void signalClose(int); >- void signalNewConnection(WebCore::LibWebRTCSocketIdentifier newSocketIdentifier, const WebKit::RTCNetwork::SocketAddress&); >- >- LibWebRTCSocketFactory& m_factory; >- WebCore::LibWebRTCSocketIdentifier m_identifier; >-}; >- >-} // namespace WebKit >- >-#endif // USE(LIBWEBRTC) >diff --git a/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.messages.in b/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.messages.in >deleted file mode 100644 >index f59d0ced1b6cbdd376a30bf65246ed710a286a4b..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.messages.in >+++ /dev/null >@@ -1,34 +0,0 @@ >-# Copyright (C) 2017 Apple Inc. All rights reserved. >-# >-# Redistribution and use in source and binary forms, with or without >-# modification, are permitted provided that the following conditions >-# are met: >-# 1. Redistributions of source code must retain the above copyright >-# notice, this list of conditions and the following disclaimer. >-# 2. Redistributions in binary form must reproduce the above copyright >-# notice, this list of conditions and the following disclaimer in the >-# documentation and/or other materials provided with the distribution. >-# >-# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND >-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >-# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR >-# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR >-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER >-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- >-#if USE(LIBWEBRTC) >- >-messages -> WebRTCSocket NotRefCounted { >- SignalReadPacket(IPC::DataReference data, WebKit::RTCNetwork::IPAddress address, uint16_t port, int64_t timestamp) >- SignalSentPacket(int packetSize, int64_t timestamp) >- SignalAddressReady(WebKit::RTCNetwork::SocketAddress address) >- SignalConnect() >- SignalClose(int error) >- SignalNewConnection(WebCore::LibWebRTCSocketIdentifier newSocketIdentifier, WebKit::RTCNetwork::SocketAddress remoteAddress) >-} >- >-#endif // USE(LIBWEBRTC)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 211290
:
398184
|
398190
|
398196
|
398362
|
398489
|
398494