Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Inline createReceiveSource in its two call sites
https://bugs.webkit.org/show_bug.cgi?id=167809

Reviewed by Alex Christensen.

* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::open):
(IPC::createReceiveSource): Deleted.

Canonical link: https://commits.webkit.org/184847@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Feb 3, 2017
1 parent edeb628 commit 073ab3c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
11 changes: 11 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,14 @@
2017-02-03 Anders Carlsson <andersca@apple.com>

Inline createReceiveSource in its two call sites
https://bugs.webkit.org/show_bug.cgi?id=167809

Reviewed by Alex Christensen.

* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::open):
(IPC::createReceiveSource): Deleted.

2017-02-03 Wenson Hsieh <wenson_hsieh@apple.com>

WKActionSheet should dismiss with animation when done with the sheet
Expand Down
26 changes: 10 additions & 16 deletions Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm
Expand Up @@ -181,19 +181,6 @@ void watchdogTimerFired()
m_xpcConnection = identifier.xpcConnection;
}

template<typename 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);

dispatch_source_set_cancel_handler(source, ^{
mach_port_mod_refs(mach_task_self(), receivePort, MACH_PORT_RIGHT_RECEIVE, -1);
});

return source;
}

bool Connection::open()
{
if (m_isServer) {
Expand Down Expand Up @@ -225,17 +212,24 @@ static dispatch_source_t createReceiveSource(mach_port_t receivePort, WorkQueue&
// Change the message queue length for the receive port.
setMachPortQueueLength(m_receivePort, MACH_PORT_QLIMIT_LARGE);

// Register the data available handler.
RefPtr<Connection> connection(this);
m_receiveSource = createReceiveSource(m_receivePort, m_connectionQueue, [connection] {
m_receiveSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_RECV, m_receivePort, 0, m_connectionQueue->dispatchQueue());
dispatch_source_set_event_handler(m_receiveSource, [connection] {
connection->receiveSourceEventHandler();
});
dispatch_source_set_cancel_handler(m_receiveSource, [connection] {
mach_port_mod_refs(mach_task_self(), connection->m_receivePort, MACH_PORT_RIGHT_RECEIVE, -1);
});

#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 101000
if (m_exceptionPort) {
m_exceptionPortDataAvailableSource = createReceiveSource(m_exceptionPort, m_connectionQueue, [connection] {
m_exceptionPortDataAvailableSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_RECV, m_exceptionPort, 0, m_connectionQueue->dispatchQueue());
dispatch_source_set_event_handler(m_exceptionPortDataAvailableSource, [connection] {
connection->exceptionSourceEventHandler();
});
dispatch_source_set_cancel_handler(m_exceptionPortDataAvailableSource, [connection] {
mach_port_mod_refs(mach_task_self(), connection->m_exceptionPort, MACH_PORT_RIGHT_RECEIVE, -1);
});

auto encoder = std::make_unique<Encoder>("IPC", "SetExceptionPort", 0);
encoder->encode(MachPort(m_exceptionPort, MACH_MSG_TYPE_MAKE_SEND));
Expand Down

0 comments on commit 073ab3c

Please sign in to comment.