Title: [147592] trunk/Source/WebKit2
- Revision
- 147592
- Author
- [email protected]
- Date
- 2013-04-03 15:54:51 -0700 (Wed, 03 Apr 2013)
Log Message
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.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (147591 => 147592)
--- trunk/Source/WebKit2/ChangeLog 2013-04-03 22:35:36 UTC (rev 147591)
+++ trunk/Source/WebKit2/ChangeLog 2013-04-03 22:54:51 UTC (rev 147592)
@@ -1,3 +1,20 @@
+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-03 Dean Jackson <[email protected]>
Cross fade into restarted plugin
Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm (147591 => 147592)
--- trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm 2013-04-03 22:35:36 UTC (rev 147591)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm 2013-04-03 22:54:51 UTC (rev 147592)
@@ -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