Title: [147633] tags/Safari-537.35.8/Source/WebKit2
Revision
147633
Author
[email protected]
Date
2013-04-04 08:32:30 -0700 (Thu, 04 Apr 2013)

Log Message

Merged r147592.  <rdar://problem/13540351>

Modified Paths

Diff

Modified: tags/Safari-537.35.8/Source/WebKit2/ChangeLog (147632 => 147633)


--- tags/Safari-537.35.8/Source/WebKit2/ChangeLog	2013-04-04 15:29:37 UTC (rev 147632)
+++ tags/Safari-537.35.8/Source/WebKit2/ChangeLog	2013-04-04 15:32:30 UTC (rev 147633)
@@ -1,5 +1,26 @@
 2013-04-04  Lucas Forschler  <[email protected]>
 
+        Merge r147592
+
+    2013-04-02  Mark Rowe  <[email protected]>
+
+            Enable process suppression when no windows in the application have drawn recently.
+            <http://webkit.org/b/113854> / <rdar://problem/13540351>
+
+            Reviewed by Darin Adler.
+
+            * UIProcess/mac/WebContextMac.mm:
+            (WebKit::applicationWindowModificationsStarted): Note that modifications are no longer stopped.
+            (WebKit::applicationWindowModificationsStopped): Note that modifications have stopped.
+            (WebKit::registerOcclusionNotificationHandlers): Register handlers for the start and stop notifications.
+            (WebKit::unregisterOcclusionNotificationHandlers): Unregister handlers for the start and stop notifications.
+            (WebKit::WebContext::canEnableProcessSuppressionForNetworkProcess): Allow suppression if the application is occluded
+            or the application has not drawn recently.
+            (WebKit::WebContext::canEnableProcessSuppressionForWebProcess): Ditto.
+            (WebKit::WebContext::canEnableProcessSuppressionForGlobalChildProcesses): Ditto.
+
+2013-04-04  Lucas Forschler  <[email protected]>
+
         Merge r147579
 
     2013-04-03  Dean Jackson  <[email protected]>

Modified: tags/Safari-537.35.8/Source/WebKit2/UIProcess/mac/WebContextMac.mm (147632 => 147633)


--- tags/Safari-537.35.8/Source/WebKit2/UIProcess/mac/WebContextMac.mm	2013-04-04 15:29:37 UTC (rev 147632)
+++ tags/Safari-537.35.8/Source/WebKit2/UIProcess/mac/WebContextMac.mm	2013-04-04 15:32:30 UTC (rev 147633)
@@ -66,6 +66,7 @@
 NSString *SchemeForCustomProtocolUnregisteredNotificationName = @"WebKitSchemeForCustomProtocolUnregisteredNotification";
 
 static bool s_applicationIsOccluded = false;
+static bool s_applicationWindowModificationsHaveStopped = false;
 static bool s_occlusionNotificationHandlersRegistered = false;
 static bool s_processSuppressionEnabledForAllContexts = true;
 
@@ -128,6 +129,23 @@
     s_applicationIsOccluded = true;
     applicationOcclusionStateChanged();
 }
+
+static void applicationWindowModificationsStarted(uint32_t, void*, uint32_t, void*, uint32_t)
+{
+    if (!s_applicationWindowModificationsHaveStopped)
+        return;
+    s_applicationWindowModificationsHaveStopped = false;
+    applicationOcclusionStateChanged();
+}
+
+static void applicationWindowModificationsStopped(uint32_t, void*, uint32_t, void*, uint32_t)
+{
+    if (s_applicationWindowModificationsHaveStopped)
+        return;
+    s_applicationWindowModificationsHaveStopped = true;
+    applicationOcclusionStateChanged();
+}
+
 #endif
 
 static void registerOcclusionNotificationHandlers()
@@ -138,8 +156,20 @@
         return;
     }
     
-    if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameOccluded, applicationBecameOccluded))
+    if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameOccluded, applicationBecameOccluded)) {
         WTFLogAlways("Registration of \"Application Became Occluded\" notification handler failed.\n");
+        return;
+    }
+
+    if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationWindowModificationsStarted, applicationWindowModificationsStarted)) {
+        WTFLogAlways("Registration of \"Application Window Modifications Started\" notification handler failed.\n");
+        return;
+    }
+    
+    if (!WKRegisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationWindowModificationsStopped, applicationWindowModificationsStopped)) {
+        WTFLogAlways("Registration of \"Application Window Modifications Stopped\" notification handler failed.\n");
+        return;
+    }
 #endif
 }
 
@@ -151,8 +181,20 @@
         return;
     }
     
-    if (!WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameOccluded, applicationBecameVisible))
+    if (!WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationBecameOccluded, applicationBecameVisible)) {
         WTFLogAlways("Unregistration of \"Application Became Visible\" notification handler failed.\n");
+        return;
+    }
+
+    if (!WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationWindowModificationsStarted, applicationWindowModificationsStarted)) {
+        WTFLogAlways("Unregistration of \"Application Window Modifications Started\" notification handler failed.\n");
+        return;
+    }
+    
+    if (!WKUnregisterOcclusionNotificationHandler(WKOcclusionNotificationTypeApplicationWindowModificationsStopped, applicationWindowModificationsStopped)) {
+        WTFLogAlways("Unregistration of \"Application Window Modifications Stopped\" notification handler failed.\n");
+        return;
+    }
 #endif
 }
 
@@ -446,18 +488,18 @@
 
 bool WebContext::canEnableProcessSuppressionForNetworkProcess() const
 {
-    return s_applicationIsOccluded && m_processSuppressionEnabled && !omitProcessSuppression();
+    return (s_applicationIsOccluded || s_applicationWindowModificationsHaveStopped) && m_processSuppressionEnabled && !omitProcessSuppression();
 }
 
 bool WebContext::canEnableProcessSuppressionForWebProcess(const WebKit::WebProcessProxy *webProcess) const
 {
-    return (s_applicationIsOccluded || webProcess->allPagesAreProcessSuppressible())
+    return (s_applicationIsOccluded || s_applicationWindowModificationsHaveStopped || webProcess->allPagesAreProcessSuppressible())
            && m_processSuppressionEnabled && !omitProcessSuppression();
 }
 
 bool WebContext::canEnableProcessSuppressionForGlobalChildProcesses()
 {
-    return s_applicationIsOccluded && s_processSuppressionEnabledForAllContexts && !omitProcessSuppression();
+    return (s_applicationIsOccluded || s_applicationWindowModificationsHaveStopped) && s_processSuppressionEnabledForAllContexts && !omitProcessSuppression();
 }
 
 void WebContext::processSuppressionEnabledChanged()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to