The network process tries to take a process assertion when NetworkProcess::processWil...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 May 2019 19:32:17 +0000 (19:32 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 May 2019 19:32:17 +0000 (19:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197888

Reviewed by Geoffrey Garen.

When actualPrepareToSuspend() in the Network process is called set the 'IsSuspended' flag on the SQLite database tracker and unset
the flag when the process resume. This is consistent with what we already do in the WebProcess and makes sure that
the network process does not try and take on a new assertion due to locked files when getting notified it is about to get
suspended.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::actualPrepareToSuspend):
(WebKit::NetworkProcess::processWillSuspendImminently):
(WebKit::NetworkProcess::resume):

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

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp

index b2490c9..1402774 100644 (file)
@@ -1,5 +1,22 @@
 2019-05-14  Chris Dumez  <cdumez@apple.com>
 
 2019-05-14  Chris Dumez  <cdumez@apple.com>
 
+        The network process tries to take a process assertion when NetworkProcess::processWillSuspendImminently() is called
+        https://bugs.webkit.org/show_bug.cgi?id=197888
+
+        Reviewed by Geoffrey Garen.
+
+        When actualPrepareToSuspend() in the Network process is called set the 'IsSuspended' flag on the SQLite database tracker and unset
+        the flag when the process resume. This is consistent with what we already do in the WebProcess and makes sure that
+        the network process does not try and take on a new assertion due to locked files when getting notified it is about to get
+        suspended.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::actualPrepareToSuspend):
+        (WebKit::NetworkProcess::processWillSuspendImminently):
+        (WebKit::NetworkProcess::resume):
+
+2019-05-14  Chris Dumez  <cdumez@apple.com>
+
         Update TBA macros for API / SPI that has already shipped
         https://bugs.webkit.org/show_bug.cgi?id=197841
         <rdar://problem/50698499>
         Update TBA macros for API / SPI that has already shipped
         https://bugs.webkit.org/show_bug.cgi?id=197841
         <rdar://problem/50698499>
index c459e63..9c64844 100644 (file)
@@ -1922,6 +1922,10 @@ private:
 
 void NetworkProcess::actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend shouldAcknowledgeWhenReadyToSuspend)
 {
 
 void NetworkProcess::actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend shouldAcknowledgeWhenReadyToSuspend)
 {
+#if PLATFORM(IOS_FAMILY)
+    m_webSQLiteDatabaseTracker.setIsSuspended(true);
+#endif
+
     lowMemoryHandler(Critical::Yes);
 
     RefPtr<TaskCounter> delayedTaskCounter;
     lowMemoryHandler(Critical::Yes);
 
     RefPtr<TaskCounter> delayedTaskCounter;
@@ -1947,6 +1951,7 @@ void NetworkProcess::actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend
 
 void NetworkProcess::processWillSuspendImminently(CompletionHandler<void(bool)>&& completionHandler)
 {
 
 void NetworkProcess::processWillSuspendImminently(CompletionHandler<void(bool)>&& completionHandler)
 {
+    RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::processWillSuspendImminently()", this);
 #if PLATFORM(IOS_FAMILY) && ENABLE(INDEXED_DATABASE)
     for (auto& server : m_idbServers.values())
         server->tryStop(IDBServer::ShouldForceStop::Yes);
 #if PLATFORM(IOS_FAMILY) && ENABLE(INDEXED_DATABASE)
     for (auto& server : m_idbServers.values())
         server->tryStop(IDBServer::ShouldForceStop::Yes);
@@ -1994,6 +1999,10 @@ void NetworkProcess::processDidResume()
 
 void NetworkProcess::resume()
 {
 
 void NetworkProcess::resume()
 {
+#if PLATFORM(IOS_FAMILY)
+    m_webSQLiteDatabaseTracker.setIsSuspended(false);
+#endif
+
     platformProcessDidResume();
     for (auto& connection : m_webProcessConnections)
         connection->endSuspension();
     platformProcessDidResume();
     for (auto& connection : m_webProcessConnections)
         connection->endSuspension();