diff options
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/plugin_process_host.cc | 17 | ||||
-rw-r--r-- | content/browser/plugin_process_host.h | 4 | ||||
-rw-r--r-- | content/browser/resource_context.cc | 9 |
3 files changed, 29 insertions, 1 deletions
diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index dfc3548..23516c7 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -332,6 +332,23 @@ void PluginProcessHost::CancelRequests() { } } +// static +void PluginProcessHost::CancelPendingRequestsForResourceContext( + const content::ResourceContext* context) { + for (BrowserChildProcessHost::Iterator host_it( + ChildProcessInfo::PLUGIN_PROCESS); + !host_it.Done(); ++host_it) { + PluginProcessHost* host = static_cast<PluginProcessHost*>(*host_it); + for (size_t i = 0; i < host->pending_requests_.size(); ++i) { + if (&host->pending_requests_[i]->GetResourceContext() == context) { + host->pending_requests_[i]->OnError(); + host->pending_requests_.erase(host->pending_requests_.begin() + i); + --i; + } + } + } +} + void PluginProcessHost::OpenChannelToPlugin(Client* client) { InstanceCreated(); client->SetPluginInfo(info_); diff --git a/content/browser/plugin_process_host.h b/content/browser/plugin_process_host.h index 3c5f116..fcec36c 100644 --- a/content/browser/plugin_process_host.h +++ b/content/browser/plugin_process_host.h @@ -79,6 +79,10 @@ class PluginProcessHost : public BrowserChildProcessHost { // OnChannelOpened in the client is called. void OpenChannelToPlugin(Client* client); + // Cancels all pending channel requests for the given resource context. + static void CancelPendingRequestsForResourceContext( + const content::ResourceContext* context); + // This function is called on the IO thread once we receive a reply from the // modal HTML dialog (in the form of a JSON string). This function forwards // that reply back to the plugin that requested the dialog. diff --git a/content/browser/resource_context.cc b/content/browser/resource_context.cc index efb73cd..bc3c6d6 100644 --- a/content/browser/resource_context.cc +++ b/content/browser/resource_context.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "content/browser/browser_thread.h" +#include "content/browser/plugin_process_host.h" #include "webkit/database/database_tracker.h" namespace content { @@ -23,7 +24,13 @@ ResourceContext::ResourceContext() DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } -ResourceContext::~ResourceContext() {} +ResourceContext::~ResourceContext() { + if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { + // Band-aid for http://crbug.com/94704 until we change plug-in channel + // requests to be owned by the ResourceContext. + PluginProcessHost::CancelPendingRequestsForResourceContext(this); + } +} void* ResourceContext::GetUserData(const void* key) const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |