[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 7cea79b..e15023b 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 30a8e60..40f5451 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 5166498..d11f320 100644 (file)
@@ -99,6 +99,7 @@ private:
     virtual void terminate() override;
     void platformTerminate();
 
+    void lowMemoryHandler(bool critical);
     void platformLowMemoryHandler(bool critical);
 
     // ChildProcess