[Wi-Fi Assertions] suspendWiFiAssertions() should be able to delay sending ProcessRea...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Aug 2018 16:08:48 +0000 (16:08 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Aug 2018 16:08:48 +0000 (16:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188373
<rdar://problem/42857398>

Reviewed by Tim Horton.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::actualPrepareToSuspend):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformPrepareToSuspend):
(WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
* NetworkProcess/curl/NetworkProcessCurl.cpp:
(WebKit::NetworkProcess::platformPrepareToSuspend):
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformPrepareToSuspend):

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

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp
Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp

index 36e2767..3e5f618 100644 (file)
@@ -1,3 +1,22 @@
+2018-08-06  Andy Estes  <aestes@apple.com>
+
+        [Wi-Fi Assertions] suspendWiFiAssertions() should be able to delay sending ProcessReadyToSuspend
+        https://bugs.webkit.org/show_bug.cgi?id=188373
+        <rdar://problem/42857398>
+
+        Reviewed by Tim Horton.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::actualPrepareToSuspend):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::platformPrepareToSuspend):
+        (WebKit::NetworkProcess::platformProcessDidTransitionToBackground):
+        * NetworkProcess/curl/NetworkProcessCurl.cpp:
+        (WebKit::NetworkProcess::platformPrepareToSuspend):
+        * NetworkProcess/soup/NetworkProcessSoup.cpp:
+        (WebKit::NetworkProcess::platformPrepareToSuspend):
+
 2018-08-06  Alex Christensen  <achristensen@webkit.org>
 
         Check with SafeBrowsing during navigation in WKWebView
index 14b4ef5..7de800e 100644 (file)
@@ -844,7 +844,6 @@ private:
 
 void NetworkProcess::actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend shouldAcknowledgeWhenReadyToSuspend)
 {
-    platformPrepareToSuspend();
     lowMemoryHandler(Critical::Yes);
 
     RefPtr<TaskCounter> delayedTaskCounter;
@@ -856,6 +855,7 @@ void NetworkProcess::actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend
         }));
     }
 
+    platformPrepareToSuspend([delayedTaskCounter] { });
     platformSyncAllCookies([delayedTaskCounter] { });
 
     for (auto& connection : m_webProcessConnections)
index de81924..ebff7fe 100644 (file)
@@ -180,7 +180,7 @@ private:
 
     enum class ShouldAcknowledgeWhenReadyToSuspend { No, Yes };
     void actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend);
-    void platformPrepareToSuspend();
+    void platformPrepareToSuspend(CompletionHandler<void()>&&);
     void platformProcessDidResume();
 
     // ChildProcess
index b693ba2..84e7d7d 100644 (file)
@@ -243,10 +243,12 @@ void NetworkProcess::platformSyncAllCookies(CompletionHandler<void()>&& completi
 #pragma clang diagnostic pop
 }
 
-void NetworkProcess::platformPrepareToSuspend()
+void NetworkProcess::platformPrepareToSuspend(CompletionHandler<void()>&& completionHandler)
 {
 #if ENABLE(WIFI_ASSERTIONS)
-    suspendWiFiAssertions(SuspensionReason::ProcessSuspending);
+    suspendWiFiAssertions(SuspensionReason::ProcessSuspending, WTFMove(completionHandler));
+#else
+    completionHandler();
 #endif
 }
 
@@ -260,10 +262,10 @@ void NetworkProcess::platformProcessDidResume()
 void NetworkProcess::platformProcessDidTransitionToBackground()
 {
 #if ENABLE(WIFI_ASSERTIONS)
-    suspendWiFiAssertions(SuspensionReason::ProcessBackgrounding);
+    suspendWiFiAssertions(SuspensionReason::ProcessBackgrounding, [] { });
 #endif
 }
-    
+
 void NetworkProcess::platformProcessDidTransitionToForeground()
 {
 #if ENABLE(WIFI_ASSERTIONS)
index 3960a2b..b046a9b 100644 (file)
@@ -69,9 +69,10 @@ void NetworkProcess::platformTerminate()
     notImplemented();
 }
 
-void NetworkProcess::platformPrepareToSuspend()
+void NetworkProcess::platformPrepareToSuspend(CompletionHandler<void()>&& completionHandler)
 {
     notImplemented();
+    completionHandler();
 }
 
 void NetworkProcess::platformProcessDidResume()
index e39b3d8..a4e9856 100644 (file)
@@ -172,9 +172,10 @@ void NetworkProcess::setNetworkProxySettings(const SoupNetworkProxySettings& set
     });
 }
 
-void NetworkProcess::platformPrepareToSuspend()
+void NetworkProcess::platformPrepareToSuspend(CompletionHandler<void()>&& completionHandler)
 {
     notImplemented();
+    completionHandler();
 }
 
 void NetworkProcess::platformProcessDidResume()