[WK2] Regression(r182194): The NetworkProcess is calling the wrong memory pressure...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Apr 2015 22:19:33 +0000 (22:19 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Apr 2015 22:19:33 +0000 (22:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143575
<rdar://problem/20484338>

Reviewed by Andreas Kling.

After r182194, the NetworkProcess is calling the memory pressure
handler before getting suspended to free-up as much memory as possible
at this point.

However, we were calling the default memory pressure handling code
instead of the custom handler registered by the NetworkProcess. This
patch fixes the problem.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::lowMemoryHandler):
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::processWillSuspend):
* NetworkProcess/NetworkProcess.h:

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

Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkProcess.cpp
Source/WebKit2/NetworkProcess/NetworkProcess.h

index 7cea79b75042c968d59dc7b497a23a9f6a802b08..e15023b387a69a115a4750f174775b0111c670e4 100644 (file)
@@ -1,3 +1,25 @@
+2015-04-09  Chris Dumez  <cdumez@apple.com>
+
+        [WK2] Regression(r182194): The NetworkProcess is calling the wrong memory pressure handler before suspending
+        https://bugs.webkit.org/show_bug.cgi?id=143575
+        <rdar://problem/20484338>
+
+        Reviewed by Andreas Kling.
+
+        After r182194, the NetworkProcess is calling the memory pressure
+        handler before getting suspended to free-up as much memory as possible
+        at this point.
+
+        However, we were calling the default memory pressure handling code
+        instead of the custom handler registered by the NetworkProcess. This
+        patch fixes the problem.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::lowMemoryHandler):
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        (WebKit::NetworkProcess::processWillSuspend):
+        * NetworkProcess/NetworkProcess.h:
+
 2015-04-09  Brady Eidson  <beidson@apple.com>
 
         REGRESSION (r182573): Action Menus no longer appear for WebKit2 views displaying an image
index 30a8e607cf8f0bfada3f019315cbb9cf011e9ce9..40f54519d3d359eb85894a552b00de978a630e89 100644 (file)
@@ -166,6 +166,12 @@ AuthenticationManager& NetworkProcess::downloadsAuthenticationManager()
     return authenticationManager();
 }
 
+void NetworkProcess::lowMemoryHandler(bool critical)
+{
+    platformLowMemoryHandler(critical);
+    WTF::releaseFastMallocFreeMemory();
+}
+
 void NetworkProcess::initializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
 {
     platformInitializeNetworkProcess(parameters);
@@ -174,8 +180,7 @@ void NetworkProcess::initializeNetworkProcess(const NetworkProcessCreationParame
 
     auto& memoryPressureHandler = MemoryPressureHandler::singleton();
     memoryPressureHandler.setLowMemoryHandler([this] (bool critical) {
-        platformLowMemoryHandler(critical);
-        WTF::releaseFastMallocFreeMemory();
+        lowMemoryHandler(critical);
     });
     memoryPressureHandler.install();
 
@@ -506,7 +511,7 @@ void NetworkProcess::terminate()
 
 void NetworkProcess::processWillSuspend()
 {
-    MemoryPressureHandler::singleton().releaseMemory(true);
+    lowMemoryHandler(true);
     parentProcessConnection()->send(Messages::NetworkProcessProxy::ProcessReadyToSuspend(), 0);
 }
 
index 5166498b9d7af267cfd9e66a32baa1d4494b2919..d11f320e829c7b910100d3c286c904bcefacb0e9 100644 (file)
@@ -99,6 +99,7 @@ private:
     virtual void terminate() override;
     void platformTerminate();
 
+    void lowMemoryHandler(bool critical);
     void platformLowMemoryHandler(bool critical);
 
     // ChildProcess