Instantiate snapshot plugins in a PluginProcess with muted audio
https://bugs.webkit.org/show_bug.cgi?id=101536

Patch by Kiran Muppala <cmuppala@apple.com> on 2012-11-29
Reviewed by Anders Carlsson.

Plugins created for generation of a snapshot should be instantiated in a separate process with
muted audio so that any sound generated during the snapshot process is not audible to the user.

* Configurations/WebKit2.xcconfig: Add CoreAudio to the list of linked frameworks.
* PluginProcess/PluginProcess.h: Add PluginProcess::Type enum with values for regular and
snapshot process types. Provide DefaultHash and IsInteger template specializations for the enum
so that PluginProcessConnectionManager can store it in a HashMap.
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::muteAudio):
(WebKit::PluginProcess::platformInitialize): Mute audio if the process creation parameters indicate
that the plugin process type is snapshot process.
* Shared/Plugins/PluginProcessCreationParameters.cpp:
(WebKit::PluginProcessCreationParameters::encode):
(WebKit::PluginProcessCreationParameters::decode):
* Shared/Plugins/PluginProcessCreationParameters.h: Add processType process creation parameter.
* UIProcess/Plugins/PluginProcessManager.cpp:
(WebKit::PluginProcessManager::getPluginProcessConnection): Add process type parameter.
(WebKit::PluginProcessManager::getSitesWithData): Forward message to regular plugin process only.
(WebKit::PluginProcessManager::clearSiteData): Forward message to regular plugin process only.
(WebKit::PluginProcessManager::pluginProcessWithPath): Add process type parameter.
(WebKit::PluginProcessManager::getOrCreatePluginProcess): Ditto.
* UIProcess/Plugins/PluginProcessManager.h:
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::create): Add process type parameter.
(WebKit::PluginProcessProxy::PluginProcessProxy): Ditto.
(WebKit::PluginProcessProxy::didClose): Include process type with the plugin process crashed message.
(WebKit::PluginProcessProxy::didFinishLaunching): Set process type process creation parameter.
* UIProcess/Plugins/PluginProcessProxy.h:
(WebKit::PluginProcessProxy::processType):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getPluginProcessConnection): Pass along process type parameter to
PluginProcessManager.
* UIProcess/WebProcessProxy.h:
(WebProcessProxy):
* UIProcess/WebProcessProxy.messages.in: Add process type parameter to GetPluginProcessConnection message.
* WebProcess/Plugins/PluginProcessConnection.cpp:
(WebKit::PluginProcessConnection::PluginProcessConnection): Add process type parameter.
* WebProcess/Plugins/PluginProcessConnection.h:
(WebKit::PluginProcessConnection::create): Ditto.
(WebKit::PluginProcessConnection::processType): Ditto.
* WebProcess/Plugins/PluginProcessConnectionManager.cpp:
(WebKit::PluginProcessConnectionManager::getPluginProcessConnection): Add process type parameter.
(WebKit::PluginProcessConnectionManager::removePluginProcessConnection): Use process type in addition to
plugin path to find the connection to remove.
(WebKit::PluginProcessConnectionManager::pluginProcessCrashed): Add process type parameter.
* WebProcess/Plugins/PluginProcessConnectionManager.h:
* WebProcess/Plugins/PluginProxy.cpp:
(WebKit::PluginProxy::create): Ditto.
(WebKit::PluginProxy::PluginProxy): Ditto.
(WebKit::PluginProxy::initialize): Add process type parameter in call to
PluginProcessConnectionManager::getPluginProcessConnection.
* WebProcess/Plugins/PluginProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::createPlugin): Determine process type based on display state of plugin element and
pass it to PluginProxy::create.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::pluginProcessCrashed): Pass along process type parameter to
PluginProcessConnectionManager.
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in: Add process type parameter to PluginProcessCrashed message.

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