Fix some errors due to some mach port APIs being unavailable on watchOS
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Mar 2018 23:11:46 +0000 (23:11 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Mar 2018 23:11:46 +0000 (23:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=183262
<rdar://problem/38028521>

Reviewed by Tim Horton.

Minor build fix; mach_port_guard and mach_port_unguard are not available on this platform.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229148 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/Platform/IPC/mac/ConnectionMac.mm

index 01bdb3a..7d440e2 100644 (file)
@@ -1,3 +1,18 @@
+2018-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Fix some errors due to some mach port APIs being unavailable on watchOS
+        https://bugs.webkit.org/show_bug.cgi?id=183262
+        <rdar://problem/38028521>
+
+        Reviewed by Tim Horton.
+
+        Minor build fix; mach_port_guard and mach_port_unguard are not available on this platform.
+
+        * Platform/IPC/mac/ConnectionMac.mm:
+        (IPC::Connection::platformInvalidate):
+        (IPC::Connection::platformInitialize):
+        (IPC::Connection::open):
+
 2018-03-01  Per Arne Vollan  <pvollan@apple.com>
 
         Unreviewed build fix after r229140.
index fd32860..d853f76 100644 (file)
@@ -120,7 +120,9 @@ void Connection::platformInvalidate()
         }
 
         if (m_receivePort) {
+#if !PLATFORM(WATCHOS)
             mach_port_unguard(mach_task_self(), m_receivePort, reinterpret_cast<mach_port_context_t>(this));
+#endif
             mach_port_mod_refs(mach_task_self(), m_receivePort, MACH_PORT_RIGHT_RECEIVE, -1);
             m_receivePort = MACH_PORT_NULL;
         }
@@ -158,7 +160,9 @@ void Connection::platformInitialize(Identifier identifier)
         m_receivePort = identifier.port;
         m_sendPort = MACH_PORT_NULL;
 
+#if !PLATFORM(WATCHOS)
         mach_port_guard(mach_task_self(), m_receivePort, reinterpret_cast<mach_port_context_t>(this), true);
+#endif
     } else {
         m_receivePort = MACH_PORT_NULL;
         m_sendPort = identifier.port;
@@ -181,7 +185,9 @@ bool Connection::open()
         ASSERT(m_sendPort);
 
         mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &m_receivePort);
+#if !PLATFORM(WATCHOS)
         mach_port_guard(mach_task_self(), m_receivePort, reinterpret_cast<mach_port_context_t>(this), true);
+#endif
 
 #if PLATFORM(MAC)
         mach_port_set_attributes(mach_task_self(), m_receivePort, MACH_PORT_DENAP_RECEIVER, (mach_port_info_t)0, 0);
@@ -207,7 +213,11 @@ bool Connection::open()
         connection->receiveSourceEventHandler();
     });
     dispatch_source_set_cancel_handler(m_receiveSource, [connection, receivePort = m_receivePort] {
+#if PLATFORM(WATCHOS)
+        UNUSED_PARAM(connection);
+#else
         mach_port_unguard(mach_task_self(), receivePort, reinterpret_cast<mach_port_context_t>(connection.get()));
+#endif
         mach_port_mod_refs(mach_task_self(), receivePort, MACH_PORT_RIGHT_RECEIVE, -1);
     });