Diff
Modified: branches/safari-609-branch/Source/WebKit/CMakeLists.txt (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/CMakeLists.txt 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/CMakeLists.txt 2020-05-20 20:12:35 UTC (rev 261943)
@@ -177,10 +177,10 @@
WebProcess/Geolocation/WebGeolocationManager.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
Modified: branches/safari-609-branch/Source/WebKit/ChangeLog (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/ChangeLog 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog 2020-05-20 20:12:35 UTC (rev 261943)
@@ -1,3 +1,56 @@
+2020-05-19 Alan Coon <[email protected]>
+
+ Apply patch. rdar://problem/63156066
+
+ 2020-05-19 Youenn Fablet <[email protected]>
+
+ Receiving WebRTC network packets should not go through the main thread
+ https://bugs.webkit.org/show_bug.cgi?id=211290
+
+ Reviewed by Alex Christensen.
+
+ 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-13 Russell Epstein <[email protected]>
Cherry-pick r260982. rdar://problem/62978869
Modified: branches/safari-609-branch/Source/WebKit/DerivedSources-input.xcfilelist (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/DerivedSources-input.xcfilelist 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/DerivedSources-input.xcfilelist 2020-05-20 20:12:35 UTC (rev 261943)
@@ -108,10 +108,10 @@
$(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
Modified: branches/safari-609-branch/Source/WebKit/DerivedSources-output.xcfilelist (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/DerivedSources-output.xcfilelist 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/DerivedSources-output.xcfilelist 2020-05-20 20:12:35 UTC (rev 261943)
@@ -54,6 +54,9 @@
$(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
@@ -297,9 +300,6 @@
$(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
Modified: branches/safari-609-branch/Source/WebKit/DerivedSources.make (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/DerivedSources.make 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/DerivedSources.make 2020-05-20 20:12:35 UTC (rev 261943)
@@ -119,6 +119,7 @@
LegacyCustomProtocolManagerProxy \
LibWebRTCCodecs \
LibWebRTCCodecsProxy \
+ LibWebRTCNetwork \
NPObjectMessageReceiver \
NetworkConnectionToWebProcess \
NetworkContentRuleListManager \
@@ -192,7 +193,6 @@
WebProcessProxy \
WebRTCMonitor \
WebRTCResolver \
- WebRTCSocket \
WebResourceLoader \
WebSWClientConnection \
WebSWContextManagerConnection \
Modified: branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp 2020-05-20 20:12:35 UTC (rev 261943)
@@ -30,8 +30,8 @@
#include "Connection.h"
#include "DataReference.h"
+#include "LibWebRTCNetworkMessages.h"
#include "NetworkRTCProvider.h"
-#include "WebRTCSocketMessages.h"
#include <WebCore/SharedBuffer.h>
#include <wtf/Function.h>
@@ -92,7 +92,7 @@
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);
});
}
@@ -100,7 +100,7 @@
{
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);
});
}
@@ -114,7 +114,7 @@
{
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);
});
}
@@ -127,7 +127,7 @@
{
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);
});
}
@@ -135,7 +135,7 @@
{
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.
Modified: branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/NetworkProcess/webrtc/NetworkRTCProvider.cpp 2020-05-20 20:12:35 UTC (rev 261943)
@@ -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 @@
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 @@
{
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 @@
{
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]() {
@@ -191,7 +191,7 @@
{
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));
}
@@ -262,7 +262,7 @@
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();
});
Modified: branches/safari-609-branch/Source/WebKit/Sources.txt (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/Sources.txt 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/Sources.txt 2020-05-20 20:12:35 UTC (rev 261943)
@@ -522,6 +522,7 @@
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
@@ -529,7 +530,6 @@
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
Modified: branches/safari-609-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-05-20 20:12:35 UTC (rev 261943)
@@ -1066,7 +1066,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 */; };
@@ -3319,6 +3319,8 @@
4151E5C31FBB90A900E47E2D /* FormDataReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormDataReference.h; sourceTree = "<group>"; };
4157853021276B6F00DD3800 /* copy-webcontent-resources-to-private-headers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "copy-webcontent-resources-to-private-headers.sh"; sourceTree = "<group>"; };
4157E4AF20E2EC9800A6C0D7 /* com.google.o1dbrowserplugin.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.google.o1dbrowserplugin.sb; 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>"; };
@@ -3659,7 +3661,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; };
@@ -7092,7 +7094,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 */,
@@ -9315,6 +9319,7 @@
2984F587164BA095004BC0C6 /* LegacyCustomProtocolManagerMessages.h */,
2984F57A164B915F004BC0C6 /* LegacyCustomProtocolManagerProxyMessageReceiver.cpp */,
2984F57B164B915F004BC0C6 /* LegacyCustomProtocolManagerProxyMessages.h */,
+ 51F060DD1654317500F3281C /* LibWebRTCNetworkMessageReceiver.cpp */,
51DD9F2616367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp */,
51DD9F2716367DA2001578E9 /* NetworkConnectionToWebProcessMessages.h */,
52F060DD1654317500F3281B /* NetworkContentRuleListManagerMessageReceiver.cpp */,
@@ -9474,7 +9479,6 @@
51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */,
51F060DD1654317500F3281F /* WebRTCMonitorMessageReceiver.cpp */,
51F060DD1654317500F3282C /* WebRTCResolverMessageReceiver.cpp */,
- 51F060DD1654317500F3281C /* WebRTCSocketMessageReceiver.cpp */,
41F060DD1654317500F3281C /* WebSocketChannelMessageReceiver.cpp */,
5C0B17761E7C879C00E9123C /* WebSocketStreamMessageReceiver.cpp */,
5C0B17771E7C879C00E9123C /* WebSocketStreamMessages.h */,
@@ -11870,6 +11874,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 */,
1D3AB05523AC01F3005C1FF0 /* MediaPlayerPrivateRemote.cpp in Sources */,
@@ -12191,7 +12196,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 */,
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp 2020-05-20 20:12:35 UTC (rev 261943)
@@ -44,7 +44,6 @@
#include "WebRTCMonitor.h"
#include "WebRTCMonitorMessages.h"
#include "WebRTCResolverMessages.h"
-#include "WebRTCSocketMessages.h"
#include "WebResourceLoaderMessages.h"
#include "WebSWClientConnection.h"
#include "WebSWClientConnectionMessages.h"
@@ -72,6 +71,7 @@
: m_connection(IPC::Connection::createClientConnection(connectionIdentifier, *this))
{
m_connection->open();
+ WebProcess::singleton().libWebRTCNetwork().setConnection(m_connection.copyRef());
}
NetworkProcessConnection::~NetworkProcessConnection()
@@ -107,10 +107,6 @@
}
#if USE(LIBWEBRTC)
- if (decoder.messageReceiverName() == Messages::WebRTCSocket::messageReceiverName()) {
- WebProcess::singleton().libWebRTCNetwork().socket(makeObjectIdentifier<LibWebRTCSocketIdentifierType>(decoder.destinationID())).didReceiveMessage(connection, decoder);
- return;
- }
if (decoder.messageReceiverName() == Messages::WebRTCMonitor::messageReceiverName()) {
WebProcess::singleton().libWebRTCNetwork().monitor().didReceiveMessage(connection, decoder);
return;
Added: branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.cpp (0 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.cpp (rev 0)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.cpp 2020-05-20 20:12:35 UTC (rev 261943)
@@ -0,0 +1,131 @@
+/*
+ * 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>
+#include <wtf/MainThread.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 USE(LIBWEBRTC)
+ if (m_connection)
+ m_connection->removeThreadMessageReceiver(Messages::LibWebRTCNetwork::messageReceiverName());
+#endif
+ m_connection = WTFMove(connection);
+#if USE(LIBWEBRTC)
+ if (m_connection)
+ m_connection->addThreadMessageReceiver(Messages::LibWebRTCNetwork::messageReceiverName(), this);
+#endif
+}
+
+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)
+{
+ ASSERT(!WTF::isMainRunLoop());
+ 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)
+{
+ ASSERT(!WTF::isMainRunLoop());
+ 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)
+{
+ ASSERT(!WTF::isMainRunLoop());
+ if (auto* socket = m_socketFactory.socket(identifier))
+ socket->signalSentPacket(rtcPacketID, sendTimeMs);
+}
+
+void LibWebRTCNetwork::signalConnect(WebCore::LibWebRTCSocketIdentifier identifier)
+{
+ ASSERT(!WTF::isMainRunLoop());
+ if (auto* socket = m_socketFactory.socket(identifier))
+ socket->signalConnect();
+}
+
+void LibWebRTCNetwork::signalClose(WebCore::LibWebRTCSocketIdentifier identifier, int error)
+{
+ ASSERT(!WTF::isMainRunLoop());
+ if (auto* socket = m_socketFactory.socket(identifier))
+ socket->signalClose(error);
+}
+
+void LibWebRTCNetwork::signalNewConnection(WebCore::LibWebRTCSocketIdentifier identifier, WebCore::LibWebRTCSocketIdentifier newSocketIdentifier, const RTCNetwork::SocketAddress& remoteAddress)
+{
+ ASSERT(!WTF::isMainRunLoop());
+ if (auto* socket = m_socketFactory.socket(identifier))
+ socket->signalNewConnection(m_socketFactory.createNewConnectionSocket(*socket, newSocketIdentifier, remoteAddress.value));
+}
+#endif
+
+} // namespace WebKit
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.h 2020-05-20 20:12:35 UTC (rev 261943)
@@ -25,32 +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;
+
#if USE(LIBWEBRTC)
+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&);
+
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(uint64_t identifier) { return WebRTCResolver(socketFactory(), identifier); }
#endif
@@ -60,6 +63,18 @@
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;
#endif
@@ -66,13 +81,7 @@
#if ENABLE(WEB_RTC)
WebMDNSRegister m_mdnsRegister;
#endif
+ RefPtr<IPC::Connection> m_connection;
};
-inline void LibWebRTCNetwork::networkProcessCrashed()
-{
-#if USE(LIBWEBRTC)
- m_webNetworkMonitor.networkProcessCrashed();
-#endif
-}
-
} // namespace WebKit
Copied: branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in (from rev 261942, branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.messages.in) (0 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in (rev 0)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCNetwork.messages.in 2020-05-20 20:12:35 UTC (rev 261943)
@@ -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)
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp 2020-05-20 20:12:35 UTC (rev 261943)
@@ -81,13 +81,13 @@
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)
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h 2020-05-20 20:12:35 UTC (rev 261943)
@@ -39,10 +39,6 @@
class Decoder;
}
-namespace WebCore {
-class SharedBuffer;
-}
-
namespace WebKit {
class LibWebRTCSocketFactory;
@@ -69,8 +65,8 @@
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();
Modified: branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp 2020-05-20 20:12:35 UTC (rev 261943)
@@ -32,7 +32,6 @@
#include "NetworkRTCMonitorMessages.h"
#include "NetworkRTCProviderMessages.h"
#include "WebProcess.h"
-#include "WebRTCSocket.h"
#include <wtf/MainThread.h>
namespace WebKit {
Deleted: branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.cpp (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.cpp 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.cpp 2020-05-20 20:12:35 UTC (rev 261943)
@@ -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)
Deleted: branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.h (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.h 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.h 2020-05-20 20:12:35 UTC (rev 261943)
@@ -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)
Deleted: branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.messages.in (261942 => 261943)
--- branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.messages.in 2020-05-20 20:12:28 UTC (rev 261942)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/Network/webrtc/WebRTCSocket.messages.in 2020-05-20 20:12:35 UTC (rev 261943)
@@ -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)