<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[245334] trunk/Source/WebKit</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/245334">245334</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2019-05-15 11:29:40 -0700 (Wed, 15 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WK2][iOS] UIProcess may get killed because it is taking too long to release its background task after expiration
https://bugs.webkit.org/show_bug.cgi?id=197893
<rdar://problem/50234105>

Reviewed by Alex Christensen.

The UIProcess may get killed because it is taking too long to release its background task after its expiration handler
was called. The reason is that the background task's expiration handler was sequentially sending a ProcessWillSuspendImminently
synchronous IPC to each of its child processes and only then ends the background task. By the time we receive the response from
all child processes, it may be too late and we get killed.

To address the issue, we now:
1. Send the ProcessWillSuspendImminently asynchronously so that all processes can do their processing in parallel
2. After 2 seconds, the UIProcess releases the background task (We get killed after ~5 seconds)

Also, to make sure that the UIProcess supends promptly, we now make sure we never start a new background task *after*
the app has been backgrounded. The intention of our background task is too finish critical work (like releasing locked
files) after the app gets backgrounded, not to start new work and delay process suspension.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::processWillSuspendImminently):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::sendProcessWillSuspendImminently):
* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager init]):
(-[WKProcessAssertionBackgroundTaskManager _scheduleReleaseTask]):
(-[WKProcessAssertionBackgroundTaskManager _cancelPendingReleaseTask]):
(-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::didReceiveSyncMessage):
(WebKit::WebProcess::processWillSuspendImminently):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcesscpp">trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcessh">trunk/Source/WebKit/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#trunkSourceWebKitNetworkProcessNetworkProcessmessagesin">trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKitUIProcessNetworkNetworkProcessProxycpp">trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxycpp">trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosProcessAssertionIOSmm">trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebProcesscpp">trunk/Source/WebKit/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebProcessh">trunk/Source/WebKit/WebProcess/WebProcess.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebProcessmessagesin">trunk/Source/WebKit/WebProcess/WebProcess.messages.in</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/ChangeLog       2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2019-05-15  Chris Dumez  <cdumez@apple.com>
+
+        [WK2][iOS] UIProcess may get killed because it is taking too long to release its background task after expiration
+        https://bugs.webkit.org/show_bug.cgi?id=197893
+        <rdar://problem/50234105>
+
+        Reviewed by Alex Christensen.
+
+        The UIProcess may get killed because it is taking too long to release its background task after its expiration handler
+        was called. The reason is that the background task's expiration handler was sequentially sending a ProcessWillSuspendImminently
+        synchronous IPC to each of its child processes and only then ends the background task. By the time we receive the response from
+        all child processes, it may be too late and we get killed.
+
+        To address the issue, we now:
+        1. Send the ProcessWillSuspendImminently asynchronously so that all processes can do their processing in parallel
+        2. After 2 seconds, the UIProcess releases the background task (We get killed after ~5 seconds)
+
+        Also, to make sure that the UIProcess supends promptly, we now make sure we never start a new background task *after*
+        the app has been backgrounded. The intention of our background task is too finish critical work (like releasing locked
+        files) after the app gets backgrounded, not to start new work and delay process suspension.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::processWillSuspendImminently):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::sendProcessWillSuspendImminently):
+        * UIProcess/ios/ProcessAssertionIOS.mm:
+        (-[WKProcessAssertionBackgroundTaskManager init]):
+        (-[WKProcessAssertionBackgroundTaskManager _scheduleReleaseTask]):
+        (-[WKProcessAssertionBackgroundTaskManager _cancelPendingReleaseTask]):
+        (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::didReceiveSyncMessage):
+        (WebKit::WebProcess::processWillSuspendImminently):
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+
</ins><span class="cx"> 2019-05-15  Jiewen Tan  <jiewen_tan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [WebAuthN] Make WebAuthN default on
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp    2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp       2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -1949,15 +1949,15 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkProcess::processWillSuspendImminently(CompletionHandler<void(bool)>&& completionHandler)
</del><ins>+void NetworkProcess::processWillSuspendImminently()
</ins><span class="cx"> {
</span><del>-    RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::processWillSuspendImminently()", this);
</del><ins>+    RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::processWillSuspendImminently() BEGIN", this);
</ins><span class="cx"> #if PLATFORM(IOS_FAMILY) && ENABLE(INDEXED_DATABASE)
</span><span class="cx">     for (auto& server : m_idbServers.values())
</span><span class="cx">         server->tryStop(IDBServer::ShouldForceStop::Yes);
</span><span class="cx"> #endif
</span><span class="cx">     actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend::No);
</span><del>-    completionHandler(true);
</del><ins>+    RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::processWillSuspendImminently() END", this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::prepareToSuspend()
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h      2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -181,7 +181,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool canHandleHTTPSServerTrustEvaluation() const { return m_canHandleHTTPSServerTrustEvaluation; }
</span><span class="cx"> 
</span><del>-    void processWillSuspendImminently(CompletionHandler<void(bool)>&&);
</del><ins>+    void processWillSuspendImminently();
</ins><span class="cx">     void prepareToSuspend();
</span><span class="cx">     void cancelPrepareToSuspend();
</span><span class="cx">     void processDidResume();
</span></span></pre></div>
<a id="trunkSourceWebKitNetworkProcessNetworkProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in    2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in       2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx">     ProcessDidTransitionToBackground()
</span><span class="cx">     ProcessDidTransitionToForeground()
</span><span class="cx"> 
</span><del>-    ProcessWillSuspendImminently() -> (bool handled) Synchronous
</del><ins>+    ProcessWillSuspendImminently()
</ins><span class="cx">     PrepareToSuspend()
</span><span class="cx">     CancelPrepareToSuspend()
</span><span class="cx">     ProcessDidResume()
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessNetworkNetworkProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp    2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp       2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -957,11 +957,8 @@
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcessProxy::sendProcessWillSuspendImminently()
</span><span class="cx"> {
</span><del>-    if (!canSendMessage())
-        return;
-
-    bool handled = false;
-    sendSync(Messages::NetworkProcess::ProcessWillSuspendImminently(), Messages::NetworkProcess::ProcessWillSuspendImminently::Reply(handled), 0, 1_s);
</del><ins>+    if (canSendMessage())
+        send(Messages::NetworkProcess::ProcessWillSuspendImminently(), 0);
</ins><span class="cx"> }
</span><span class="cx">     
</span><span class="cx"> void NetworkProcessProxy::sendPrepareToSuspend()
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp        2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp   2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -1146,11 +1146,8 @@
</span><span class="cx"> 
</span><span class="cx"> void WebProcessProxy::sendProcessWillSuspendImminently()
</span><span class="cx"> {
</span><del>-    if (!canSendMessage())
-        return;
-
-    bool handled = false;
-    sendSync(Messages::WebProcess::ProcessWillSuspendImminently(), Messages::WebProcess::ProcessWillSuspendImminently::Reply(handled), 0, 1_s);
</del><ins>+    if (canSendMessage())
+        send(Messages::WebProcess::ProcessWillSuspendImminently(), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebProcessProxy::sendPrepareToSuspend()
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosProcessAssertionIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm 2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm    2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -37,6 +37,11 @@
</span><span class="cx"> 
</span><span class="cx"> using WebKit::ProcessAndUIAssertion;
</span><span class="cx"> 
</span><ins>+// This gives some time to our child processes to process the ProcessWillSuspendImminently IPC but makes sure we release
+// the background task before the UIKit timeout (We get killed if we do not release the background task within 5 seconds
+// on the expiration handler getting called).
+static const Seconds releaseBackgroundTaskAfterExpirationDelay { 2_s };
+
</ins><span class="cx"> @interface WKProcessAssertionBackgroundTaskManager : NSObject
</span><span class="cx"> 
</span><span class="cx"> + (WKProcessAssertionBackgroundTaskManager *)shared;
</span><span class="lines">@@ -50,7 +55,8 @@
</span><span class="cx"> {
</span><span class="cx">     UIBackgroundTaskIdentifier _backgroundTask;
</span><span class="cx">     HashSet<ProcessAndUIAssertion*> _assertionsNeedingBackgroundTask;
</span><del>-    BOOL _assertionHasExpiredInTheBackground;
</del><ins>+    BOOL _applicationIsBackgrounded;
+    dispatch_block_t _pendingTaskReleaseTask;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (WKProcessAssertionBackgroundTaskManager *)shared
</span><span class="lines">@@ -68,10 +74,15 @@
</span><span class="cx">     _backgroundTask = UIBackgroundTaskInvalid;
</span><span class="cx"> 
</span><span class="cx">     [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillEnterForegroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:^(NSNotification *) {
</span><del>-        _assertionHasExpiredInTheBackground = NO;
</del><ins>+        _applicationIsBackgrounded = NO;
+        [self _cancelPendingReleaseTask];
</ins><span class="cx">         [self _updateBackgroundTask];
</span><span class="cx">     }];
</span><span class="cx"> 
</span><ins>+    [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification object:[UIApplication sharedApplication] queue:nil usingBlock:^(NSNotification *) {
+        _applicationIsBackgrounded = YES;
+    }];
+
</ins><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -101,12 +112,40 @@
</span><span class="cx">         assertion->uiAssertionWillExpireImminently();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
+- (void)_scheduleReleaseTask
+{
+    ASSERT(!_pendingTaskReleaseTask);
+    if (_pendingTaskReleaseTask)
+        return;
+
+    RELEASE_LOG(ProcessSuspension, "%p - WKProcessAssertionBackgroundTaskManager - _scheduleReleaseTask because the expiration handler has been called", self);
+    _pendingTaskReleaseTask = dispatch_block_create((dispatch_block_flags_t)0, ^{
+        _pendingTaskReleaseTask = nil;
+        [self _releaseBackgroundTask];
+    });
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, releaseBackgroundTaskAfterExpirationDelay.value() * NSEC_PER_SEC), dispatch_get_main_queue(), _pendingTaskReleaseTask);
+#if !__has_feature(objc_arc)
+    // dispatch_async() does a Block_copy() / Block_release() on behalf of the caller.
+    Block_release(_pendingTaskReleaseTask);
+#endif
+}
+
+- (void)_cancelPendingReleaseTask
+{
+    if (!_pendingTaskReleaseTask)
+        return;
+
+    RELEASE_LOG(ProcessSuspension, "%p - WKProcessAssertionBackgroundTaskManager - _cancelPendingReleaseTask because the application is foreground again", self);
+    dispatch_block_cancel(_pendingTaskReleaseTask);
+    _pendingTaskReleaseTask = nil;
+}
+
</ins><span class="cx"> - (void)_updateBackgroundTask
</span><span class="cx"> {
</span><span class="cx">     if (!_assertionsNeedingBackgroundTask.isEmpty() && _backgroundTask == UIBackgroundTaskInvalid) {
</span><del>-        if (_assertionHasExpiredInTheBackground) {
-            RELEASE_LOG_ERROR(ProcessSuspension, "%p - WKProcessAssertionBackgroundTaskManager: Ignored request to start a background task because we're still in the background and the previous task expired", self);
-            // Our invalidation handler would not get called if we tried to re-take a new background assertion at this point, and the UIProcess would get killed (rdar://problem/50001505).
</del><ins>+        if (_applicationIsBackgrounded) {
+            RELEASE_LOG_ERROR(ProcessSuspension, "%p - WKProcessAssertionBackgroundTaskManager: Ignored request to start a new background task because the application is already in the background", self);
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         RELEASE_LOG(ProcessSuspension, "%p - WKProcessAssertionBackgroundTaskManager - beginBackgroundTaskWithName", self);
</span><span class="lines">@@ -121,9 +160,7 @@
</span><span class="cx">                 });
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            // Remember that the assertion has expired in the background so we do not try to re-take it until the application becomes foreground again.
-            _assertionHasExpiredInTheBackground = YES;
-            [self _releaseBackgroundTask];
</del><ins>+            [self _scheduleReleaseTask];
</ins><span class="cx">         }];
</span><span class="cx">     } else if (_assertionsNeedingBackgroundTask.isEmpty())
</span><span class="cx">         [self _releaseBackgroundTask];
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebProcess.cpp    2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp       2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -732,8 +732,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (messageReceiverMap().dispatchSyncMessage(connection, decoder, replyEncoder))
</span><span class="cx">         return;
</span><del>-
-    didReceiveSyncWebProcessMessage(connection, decoder, replyEncoder);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
</span><span class="lines">@@ -1490,19 +1488,11 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebProcess::processWillSuspendImminently(CompletionHandler<void(bool)>&& completionHandler)
</del><ins>+void WebProcess::processWillSuspendImminently()
</ins><span class="cx"> {
</span><del>-    if (parentProcessConnection()->inSendSync()) {
-        // Avoid reentrency bugs such as rdar://problem/21605505 by just bailing
-        // if we get an incoming ProcessWillSuspendImminently message when waiting for a
-        // reply to a sync message.
-        // FIXME: ProcessWillSuspendImminently should not be a sync message.
-        return completionHandler(false);
-    }
-
-    RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processWillSuspendImminently()", this);
</del><ins>+    RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processWillSuspendImminently() BEGIN", this);
</ins><span class="cx">     actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend::No);
</span><del>-    completionHandler(true);
</del><ins>+    RELEASE_LOG(ProcessSuspension, "%p - WebProcess::processWillSuspendImminently() END", this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::prepareToSuspend()
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebProcess.h      2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -216,7 +216,7 @@
</span><span class="cx"> 
</span><span class="cx">     void setHiddenPageDOMTimerThrottlingIncreaseLimit(int milliseconds);
</span><span class="cx"> 
</span><del>-    void processWillSuspendImminently(CompletionHandler<void(bool)>&&);
</del><ins>+    void processWillSuspendImminently();
</ins><span class="cx">     void prepareToSuspend();
</span><span class="cx">     void cancelPrepareToSuspend();
</span><span class="cx">     void processDidResume();
</span><span class="lines">@@ -420,7 +420,6 @@
</span><span class="cx"> 
</span><span class="cx">     // Implemented in generated WebProcessMessageReceiver.cpp
</span><span class="cx">     void didReceiveWebProcessMessage(IPC::Connection&, IPC::Decoder&);
</span><del>-    void didReceiveSyncWebProcessMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
</del><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     void setScreenProperties(const WebCore::ScreenProperties&);
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (245333 => 245334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in    2019-05-15 18:20:52 UTC (rev 245333)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in       2019-05-15 18:29:40 UTC (rev 245334)
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">     EnsureAutomationSessionProxy(String sessionIdentifier)
</span><span class="cx">     DestroyAutomationSessionProxy()
</span><span class="cx"> 
</span><del>-    ProcessWillSuspendImminently() -> (bool handled) Synchronous
</del><ins>+    ProcessWillSuspendImminently()
</ins><span class="cx">     PrepareToSuspend()
</span><span class="cx">     CancelPrepareToSuspend()
</span><span class="cx">     ProcessDidResume()
</span></span></pre>
</div>
</div>

</body>
</html>