Have the plugin process track visibility of it’s plugin and sleep when none
authorslewis@apple.com <slewis@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Mar 2014 01:15:44 +0000 (01:15 +0000)
committerslewis@apple.com <slewis@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Mar 2014 01:15:44 +0000 (01:15 +0000)
commitdff758025f230bb3197ee9c4ea79d3b34a295271
tree3ca3680deb99e0bdb8d22a9ae9057a3a5f0b45ae
parentee65427c3c44917ada518400d91451f055b5ceee
Have the plugin process track visibility of it’s plugin and sleep when none
are visible.
Part of <rdar://problem/16061257> PluginProcess should AppNap when no plugins on active tab.
https://bugs.webkit.org/show_bug.cgi?id=130694

Reviewed by Anders Carlsson.

Currently AppSleep is enabled on the PluginProcess based on web page visibility.
Add visibility tracking to plugins and move the decision to AppSleep into the the
PluginProcess

* PluginProcess/PluginProcess.cpp:
(WebKit::PluginProcess::PluginProcess): Add a new activity for visible plugins
(WebKit::PluginProcess::pluginsForWebProcessDidBecomeVisible): take an activity
     assertion if any web processes have a visible plugin.
(WebKit::PluginProcess::pluginsForWebProcessDidBecomeHidden):
* PluginProcess/PluginProcess.h:
* PluginProcess/WebProcessConnection.cpp:
(WebKit::WebProcessConnection::removePluginControllerProxy): remove plugin from
    visible plugins when destroying it
(WebKit::WebProcessConnection::pluginDidBecomeVisible):
(WebKit::WebProcessConnection::pluginDidBecomeHidden): track which plugins are
    visible for each web process
* PluginProcess/WebProcessConnection.h:
* PluginProcess/mac/PluginControllerProxyMac.mm:
(WebKit::PluginControllerProxy::windowVisibilityChanged): notify WebProcessConnection
    when visibility changed.
* UIProcess/WebContext.h:
* UIProcess/mac/WebContextMac.mm:  instead of tracking plugin app sleep state on the web pref.
    and visibility state, just use the web pref.
(WebKit::WebContext::updateProcessSuppressionState):
(WebKit::WebContext::processSuppressionPreferenceIsEnabledForAllContexts):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166441 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/PluginProcess/PluginProcess.cpp
Source/WebKit2/PluginProcess/PluginProcess.h
Source/WebKit2/PluginProcess/WebProcessConnection.cpp
Source/WebKit2/PluginProcess/WebProcessConnection.h
Source/WebKit2/PluginProcess/mac/PluginControllerProxyMac.mm
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/UIProcess/mac/WebContextMac.mm