summaryrefslogtreecommitdiffstats
path: root/content/browser/plugin_service.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 19:04:04 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 19:04:04 +0000
commit661f8c4e2a4def96d0c1964a92c9a73e8f4b60bc (patch)
treeb51465ef928b9d0644bcde5eb4cabd40721778ca /content/browser/plugin_service.cc
parente3c580aaf78abbf990e49a60389f50477c98348e (diff)
downloadchromium_src-661f8c4e2a4def96d0c1964a92c9a73e8f4b60bc.zip
chromium_src-661f8c4e2a4def96d0c1964a92c9a73e8f4b60bc.tar.gz
chromium_src-661f8c4e2a4def96d0c1964a92c9a73e8f4b60bc.tar.bz2
Cancel plugin channel requests when the renderer goes away.
Logic: - Profile shutdown kills all renderer processes - When the RMF detects the channel closing, it kills off any plugin channel requests from: * PluginService (which needs to check the PluginServiceFilter on the FILE thread) * PluginProcessHost (which may need to wait for the channel to get established) - RMF uses the new OnPluginProcessHostFound() to cancel at the PluginService or PluginProcessHost BUG=94704 TEST=New PluginService test, no known manual test Review URL: http://codereview.chromium.org/7867031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100733 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/plugin_service.cc')
-rw-r--r--content/browser/plugin_service.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/content/browser/plugin_service.cc b/content/browser/plugin_service.cc
index 86670db..daa0c62 100644
--- a/content/browser/plugin_service.cc
+++ b/content/browser/plugin_service.cc
@@ -100,6 +100,8 @@ PluginService::~PluginService() {
if (hklm_event_.get())
hklm_event_->Release();
#endif
+ // Make sure no plugin channel requests have been leaked.
+ DCHECK(pending_plugin_clients_.empty());
}
void PluginService::StartWatchingPlugins() {
@@ -285,6 +287,8 @@ void PluginService::OpenChannelToNpapiPlugin(
const GURL& page_url,
const std::string& mime_type,
PluginProcessHost::Client* client) {
+ DCHECK(!ContainsKey(pending_plugin_clients_, client));
+ pending_plugin_clients_.insert(client);
// The PluginList::GetPluginInfo may need to load the plugins. Don't do it on
// the IO thread.
BrowserThread::PostTask(
@@ -316,6 +320,13 @@ void PluginService::OpenChannelToPpapiBroker(
client->OnChannelOpened(base::kNullProcessHandle, IPC::ChannelHandle());
}
+void PluginService::CancelOpenChannelToNpapiPlugin(
+ PluginProcessHost::Client* client) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK(ContainsKey(pending_plugin_clients_, client));
+ pending_plugin_clients_.erase(client);
+}
+
void PluginService::GetAllowedPluginForOpenChannelToPlugin(
int render_process_id,
int render_view_id,
@@ -347,11 +358,18 @@ void PluginService::FinishOpenChannelToPlugin(
PluginProcessHost::Client* client) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ // Make sure it hasn't been canceled yet.
+ if (!ContainsKey(pending_plugin_clients_, client))
+ return;
+ pending_plugin_clients_.erase(client);
+
PluginProcessHost* plugin_host = FindOrStartNpapiPluginProcess(plugin_path);
- if (plugin_host)
+ if (plugin_host) {
+ client->OnFoundPluginProcessHost(plugin_host);
plugin_host->OpenChannelToPlugin(client);
- else
+ } else {
client->OnError();
+ }
}
bool PluginService::GetPluginInfo(int render_process_id,