Modified: trunk/Source/WebKit/ChangeLog (240744 => 240745)
--- trunk/Source/WebKit/ChangeLog 2019-01-31 01:35:26 UTC (rev 240744)
+++ trunk/Source/WebKit/ChangeLog 2019-01-31 01:50:45 UTC (rev 240745)
@@ -1,3 +1,19 @@
+2019-01-30 Daniel Steffen <[email protected]>
+
+ <rdar://problem/29471922> Safari should switch from the legacy denap SPI to handling vouchers
+ https://bugs.webkit.org/show_bug.cgi?id=193992
+
+ Reviewed by Geoffrey Garen.
+
+ The denap SPI is deprecated.
+ The new way of staying out of AppNap is through a voucher.
+
+ * Platform/IPC/mac/ConnectionMac.mm:
+ (IPC::readFromMachPort):
+ * Platform/IPC/mac/ImportanceAssertion.h:
+ (IPC::ImportanceAssertion::ImportanceAssertion):
+ (IPC::ImportanceAssertion::~ImportanceAssertion):
+
2019-01-30 Chris Dumez <[email protected]>
Fix crashes when trying to ref the CallbackAggregator in NetworkProcess
Modified: trunk/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm (240744 => 240745)
--- trunk/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm 2019-01-31 01:35:26 UTC (rev 240744)
+++ trunk/Source/WebKit/Platform/IPC/mac/ConnectionMac.mm 2019-01-31 01:50:45 UTC (rev 240745)
@@ -476,7 +476,7 @@
buffer.resize(receiveBufferSize);
mach_msg_header_t* header = reinterpret_cast<mach_msg_header_t*>(buffer.data());
- kern_return_t kr = mach_msg(header, MACH_RCV_MSG | MACH_RCV_LARGE | MACH_RCV_TIMEOUT, 0, buffer.size(), machPort, 0, MACH_PORT_NULL);
+ kern_return_t kr = mach_msg(header, MACH_RCV_MSG | MACH_RCV_LARGE | MACH_RCV_TIMEOUT | MACH_RCV_VOUCHER, 0, buffer.size(), machPort, 0, MACH_PORT_NULL);
if (kr == MACH_RCV_TIMED_OUT)
return nullptr;
@@ -485,7 +485,7 @@
buffer.resize(header->msgh_size + MAX_TRAILER_SIZE);
header = reinterpret_cast<mach_msg_header_t*>(buffer.data());
- kr = mach_msg(header, MACH_RCV_MSG | MACH_RCV_LARGE | MACH_RCV_TIMEOUT, 0, buffer.size(), machPort, 0, MACH_PORT_NULL);
+ kr = mach_msg(header, MACH_RCV_MSG | MACH_RCV_LARGE | MACH_RCV_TIMEOUT | MACH_RCV_VOUCHER, 0, buffer.size(), machPort, 0, MACH_PORT_NULL);
ASSERT(kr != MACH_RCV_TOO_LARGE);
}
Modified: trunk/Source/WebKit/Platform/IPC/mac/ImportanceAssertion.h (240744 => 240745)
--- trunk/Source/WebKit/Platform/IPC/mac/ImportanceAssertion.h 2019-01-31 01:35:26 UTC (rev 240744)
+++ trunk/Source/WebKit/Platform/IPC/mac/ImportanceAssertion.h 2019-01-31 01:50:45 UTC (rev 240745)
@@ -28,13 +28,8 @@
#if PLATFORM(MAC)
-#if USE(APPLE_INTERNAL_SDK)
-#include <libproc_internal.h>
-#endif
+#include <mach/message.h>
-extern "C" int proc_denap_assertion_begin_with_msg(mach_msg_header_t*, uint64_t *);
-extern "C" int proc_denap_assertion_complete(uint64_t);
-
namespace IPC {
class ImportanceAssertion {
@@ -42,18 +37,25 @@
public:
explicit ImportanceAssertion(mach_msg_header_t* header)
- : m_assertion(0)
+ : m_voucher(0)
{
- proc_denap_assertion_begin_with_msg(header, &m_assertion);
+ if (MACH_MSGH_BITS_HAS_VOUCHER(header->msgh_bits)) {
+ m_voucher = header->msgh_voucher_port;
+ header->msgh_voucher_port = MACH_VOUCHER_NULL;
+ header->msgh_bits &= ~(MACH_MSGH_BITS_VOUCHER_MASK | MACH_MSGH_BITS_RAISEIMP);
+ }
}
~ImportanceAssertion()
{
- proc_denap_assertion_complete(m_assertion);
+ if (m_voucher) {
+ kern_return_t kr = mach_voucher_deallocate(m_voucher);
+ ASSERT_UNUSED(kr, !kr);
+ }
}
private:
- uint64_t m_assertion;
+ mach_voucher_t m_voucher;
};
}