Title: [211726] trunk/Source/WebKit2
Revision
211726
Author
ander...@apple.com
Date
2017-02-06 08:54:31 -0800 (Mon, 06 Feb 2017)

Log Message

Guard and unguard ports in a much less intrusive way
https://bugs.webkit.org/show_bug.cgi?id=167813

Reviewed by Sam Weinig.

Instead of adopting mach_port_construct/mach_port_destruct, just guard and unguard the ports where appropriate.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (211725 => 211726)


--- trunk/Source/WebKit2/ChangeLog	2017-02-06 16:21:07 UTC (rev 211725)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-06 16:54:31 UTC (rev 211726)
@@ -1,3 +1,16 @@
+2017-02-03  Anders Carlsson  <ander...@apple.com>
+
+        Guard and unguard ports in a much less intrusive way
+        https://bugs.webkit.org/show_bug.cgi?id=167813
+
+        Reviewed by Sam Weinig.
+
+        Instead of adopting mach_port_construct/mach_port_destruct, just guard and unguard the ports where appropriate.
+
+        * Platform/IPC/mac/ConnectionMac.mm:
+        (IPC::Connection::platformInitialize):
+        (IPC::Connection::open):
+
 2017-02-06  Miguel Gomez  <mago...@igalia.com>
 
         [GTK][EFL] Release unused UpdateAtlas when in memory pressure situation

Modified: trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm (211725 => 211726)


--- trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm	2017-02-06 16:21:07 UTC (rev 211725)
+++ trunk/Source/WebKit2/Platform/IPC/mac/ConnectionMac.mm	2017-02-06 16:54:31 UTC (rev 211726)
@@ -120,6 +120,7 @@
         }
 
         if (m_receivePort) {
+            mach_port_unguard(mach_task_self(), m_receivePort, reinterpret_cast<mach_port_context_t>(this));
             mach_port_mod_refs(mach_task_self(), m_receivePort, MACH_PORT_RIGHT_RECEIVE, -1);
             m_receivePort = MACH_PORT_NULL;
         }
@@ -170,6 +171,8 @@
     if (m_isServer) {
         m_receivePort = identifier.port;
         m_sendPort = MACH_PORT_NULL;
+
+        mach_port_guard(mach_task_self(), m_receivePort, reinterpret_cast<mach_port_context_t>(this), true);
     } else {
         m_receivePort = MACH_PORT_NULL;
         m_sendPort = identifier.port;
@@ -191,8 +194,8 @@
         ASSERT(!m_receivePort);
         ASSERT(m_sendPort);
 
-        // Create the receive port.
         mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &m_receivePort);
+        mach_port_guard(mach_task_self(), m_receivePort, reinterpret_cast<mach_port_context_t>(this), true);
 
 #if PLATFORM(MAC)
         mach_port_set_attributes(mach_task_self(), m_receivePort, MACH_PORT_DENAP_RECEIVER, (mach_port_info_t)0, 0);
@@ -218,6 +221,7 @@
         connection->receiveSourceEventHandler();
     });
     dispatch_source_set_cancel_handler(m_receiveSource, [connection, receivePort = m_receivePort] {
+        mach_port_unguard(mach_task_self(), receivePort, reinterpret_cast<mach_port_context_t>(connection.get()));
         mach_port_mod_refs(mach_task_self(), receivePort, MACH_PORT_RIGHT_RECEIVE, -1);
     });
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to