Modified: trunk/Source/WebKit2/ChangeLog (209480 => 209481)
--- trunk/Source/WebKit2/ChangeLog 2016-12-07 22:28:58 UTC (rev 209480)
+++ trunk/Source/WebKit2/ChangeLog 2016-12-07 22:30:58 UTC (rev 209481)
@@ -1,3 +1,24 @@
+2016-12-07 Anders Carlsson <ander...@apple.com>
+
+ Rename the connection sources to better indicate what data direction they are used for
+ https://bugs.webkit.org/show_bug.cgi?id=165548
+
+ Reviewed by Tim Horton.
+
+ * Platform/IPC/Connection.h:
+ * Platform/IPC/mac/ConnectionMac.mm:
+ (IPC::Connection::platformInvalidate):
+ (IPC::Connection::platformInitialize):
+ (IPC::createReceiveSource):
+ (IPC::Connection::initializeSendSource):
+ (IPC::Connection::receiveSourceEventHandler):
+ (IPC::createDataAvailableSource): Deleted.
+ (IPC::Connection::initializeDeadNameSource): Deleted.
+ Rename m_deadNameSource to m_sendSource, and m_receivePortDataAvailableSource to m_receiveSource.
+
+ (IPC::Connection::open):
+ Initialize the send source before we attempt to send a first message.
+
2016-12-07 Simon Fraser <simon.fra...@apple.com>
Fix use of enum in a WK2 C SPI header.
Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (209480 => 209481)
--- trunk/Source/WebKit2/Platform/IPC/Connection.h 2016-12-07 22:28:58 UTC (rev 209480)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h 2016-12-07 22:30:58 UTC (rev 209481)
@@ -312,13 +312,13 @@
#elif OS(DARWIN)
// Called on the connection queue.
void receiveSourceEventHandler();
- void initializeDeadNameSource();
+ void initializeSendSource();
mach_port_t m_sendPort;
- dispatch_source_t m_deadNameSource;
+ dispatch_source_t m_sendSource;
mach_port_t m_receivePort;
- dispatch_source_t m_receivePortDataAvailableSource;
+ dispatch_source_t m_receiveSource;
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
void exceptionSourceEventHandler();
Modified: trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm (209480 => 209481)
--- trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm 2016-12-07 22:28:58 UTC (rev 209480)
+++ trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm 2016-12-07 22:30:58 UTC (rev 209481)
@@ -132,14 +132,14 @@
ASSERT(m_receivePort);
// Unregister our ports.
- dispatch_source_cancel(m_deadNameSource);
- dispatch_release(m_deadNameSource);
- m_deadNameSource = 0;
+ dispatch_source_cancel(m_sendSource);
+ dispatch_release(m_sendSource);
+ m_sendSource = 0;
m_sendPort = MACH_PORT_NULL;
- dispatch_source_cancel(m_receivePortDataAvailableSource);
- dispatch_release(m_receivePortDataAvailableSource);
- m_receivePortDataAvailableSource = 0;
+ dispatch_source_cancel(m_receiveSource);
+ dispatch_release(m_receiveSource);
+ m_receiveSource = 0;
m_receivePort = MACH_PORT_NULL;
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
@@ -173,14 +173,14 @@
m_sendPort = identifier.port;
}
- m_deadNameSource = nullptr;
- m_receivePortDataAvailableSource = nullptr;
+ m_sendSource = nullptr;
+ m_receiveSource = nullptr;
m_xpcConnection = identifier.xpcConnection;
}
template<typename Function>
-static dispatch_source_t createDataAvailableSource(mach_port_t receivePort, WorkQueue& workQueue, Function&& function)
+static dispatch_source_t createReceiveSource(mach_port_t receivePort, WorkQueue& workQueue, Function&& function)
{
dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_RECV, receivePort, 0, workQueue.dispatchQueue());
dispatch_source_set_event_handler(source, function);
@@ -215,9 +215,9 @@
auto encoder = std::make_unique<Encoder>("IPC", "InitializeConnection", 0);
encoder->encode(MachPort(m_receivePort, MACH_MSG_TYPE_MAKE_SEND));
+ initializeSendSource();
+
sendMessage(WTFMove(encoder), { });
-
- initializeDeadNameSource();
}
// Change the message queue length for the receive port.
@@ -225,7 +225,7 @@
// Register the data available handler.
RefPtr<Connection> connection(this);
- m_receivePortDataAvailableSource = createDataAvailableSource(m_receivePort, m_connectionQueue, [connection] {
+ m_receiveSource = createReceiveSource(m_receivePort, m_connectionQueue, [connection] {
connection->receiveSourceEventHandler();
});
@@ -244,10 +244,10 @@
ref();
dispatch_async(m_connectionQueue->dispatchQueue(), ^{
- dispatch_resume(m_receivePortDataAvailableSource);
+ dispatch_resume(m_receiveSource);
- if (m_deadNameSource)
- dispatch_resume(m_deadNameSource);
+ if (m_sendSource)
+ dispatch_resume(m_sendSource);
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
if (m_exceptionPortDataAvailableSource)
dispatch_resume(m_exceptionPortDataAvailableSource);
@@ -356,17 +356,17 @@
return true;
}
-void Connection::initializeDeadNameSource()
+void Connection::initializeSendSource()
{
- m_deadNameSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_SEND, m_sendPort, 0, m_connectionQueue->dispatchQueue());
+ m_sendSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_SEND, m_sendPort, 0, m_connectionQueue->dispatchQueue());
RefPtr<Connection> connection(this);
- dispatch_source_set_event_handler(m_deadNameSource, [connection] {
+ dispatch_source_set_event_handler(m_sendSource, [connection] {
connection->connectionDidClose();
});
mach_port_t sendPort = m_sendPort;
- dispatch_source_set_cancel_handler(m_deadNameSource, ^{
+ dispatch_source_set_cancel_handler(m_sendSource, ^{
// Release our send right.
mach_port_deallocate(mach_task_self(), sendPort);
});
@@ -510,8 +510,8 @@
if (previousNotificationPort != MACH_PORT_NULL)
mach_port_deallocate(mach_task_self(), previousNotificationPort);
- initializeDeadNameSource();
- dispatch_resume(m_deadNameSource);
+ initializeSendSource();
+ dispatch_resume(m_sendSource);
}
m_isConnected = true;