summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 20:11:31 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-31 20:11:31 +0000
commitdd9a0958e0d3e43f156b83d5e0feed841312e2a9 (patch)
tree76da18db75d06d948b8a54d900ee63fc196114c5
parent5ddb63596ea03f2932644f4dec9dbc835b8ca2b8 (diff)
downloadchromium_src-dd9a0958e0d3e43f156b83d5e0feed841312e2a9.zip
chromium_src-dd9a0958e0d3e43f156b83d5e0feed841312e2a9.tar.gz
chromium_src-dd9a0958e0d3e43f156b83d5e0feed841312e2a9.tar.bz2
Run a ppapi process per (profile, plugin) pair.
This prevents sharing a ppapi process across profiles. This is a good idea for the same reasons that we don't share renderers across profiles. This is also a prerequisite for fixing the associated bug. BUG=127624 Review URL: https://chromiumcodereview.appspot.com/10383202 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139848 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/plugin_service_impl.cc19
-rw-r--r--content/browser/plugin_service_impl.h8
-rw-r--r--content/browser/ppapi_plugin_process_host.cc8
-rw-r--r--content/browser/ppapi_plugin_process_host.h9
-rw-r--r--content/browser/renderer_host/render_message_filter.cc5
-rw-r--r--content/browser/renderer_host/render_message_filter.h5
6 files changed, 35 insertions, 19 deletions
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index 29873b4..9523b33 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -242,12 +242,14 @@ PluginProcessHost* PluginServiceImpl::FindNpapiPluginProcess(
}
PpapiPluginProcessHost* PluginServiceImpl::FindPpapiPluginProcess(
- const FilePath& plugin_path) {
+ const FilePath& plugin_path,
+ const FilePath& profile_data_directory) {
for (PpapiPluginProcessHostIterator iter; !iter.Done(); ++iter) {
- if (iter->plugin_path() == plugin_path)
+ if (iter->plugin_path() == plugin_path &&
+ iter->profile_data_directory() == profile_data_directory) {
return *iter;
+ }
}
-
return NULL;
}
@@ -285,10 +287,12 @@ PluginProcessHost* PluginServiceImpl::FindOrStartNpapiPluginProcess(
PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiPluginProcess(
const FilePath& plugin_path,
+ const FilePath& profile_data_directory,
PpapiPluginProcessHost::PluginClient* client) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- PpapiPluginProcessHost* plugin_host = FindPpapiPluginProcess(plugin_path);
+ PpapiPluginProcessHost* plugin_host =
+ FindPpapiPluginProcess(plugin_path, profile_data_directory);
if (plugin_host)
return plugin_host;
@@ -299,7 +303,7 @@ PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiPluginProcess(
// This plugin isn't loaded by any plugin process, so create a new process.
return PpapiPluginProcessHost::CreatePluginHost(
- *info,
+ *info, profile_data_directory,
client->GetResourceContext()->GetHostResolver());
}
@@ -347,10 +351,11 @@ void PluginServiceImpl::OpenChannelToNpapiPlugin(
}
void PluginServiceImpl::OpenChannelToPpapiPlugin(
- const FilePath& path,
+ const FilePath& plugin_path,
+ const FilePath& profile_data_directory,
PpapiPluginProcessHost::PluginClient* client) {
PpapiPluginProcessHost* plugin_host = FindOrStartPpapiPluginProcess(
- path, client);
+ plugin_path, profile_data_directory, client);
if (plugin_host) {
plugin_host->OpenChannelToPlugin(client);
} else {
diff --git a/content/browser/plugin_service_impl.h b/content/browser/plugin_service_impl.h
index b3fcbf9..fed0c76 100644
--- a/content/browser/plugin_service_impl.h
+++ b/content/browser/plugin_service_impl.h
@@ -128,6 +128,7 @@ class CONTENT_EXPORT PluginServiceImpl
const FilePath& plugin_path);
PpapiPluginProcessHost* FindOrStartPpapiPluginProcess(
const FilePath& plugin_path,
+ const FilePath& profile_data_directory,
PpapiPluginProcessHost::PluginClient* client);
PpapiPluginProcessHost* FindOrStartPpapiBrokerProcess(
const FilePath& plugin_path);
@@ -141,7 +142,8 @@ class CONTENT_EXPORT PluginServiceImpl
const GURL& page_url,
const std::string& mime_type,
PluginProcessHost::Client* client);
- void OpenChannelToPpapiPlugin(const FilePath& path,
+ void OpenChannelToPpapiPlugin(const FilePath& plugin_path,
+ const FilePath& profile_data_directory,
PpapiPluginProcessHost::PluginClient* client);
void OpenChannelToPpapiBroker(const FilePath& path,
PpapiPluginProcessHost::BrokerClient* client);
@@ -173,7 +175,9 @@ class CONTENT_EXPORT PluginServiceImpl
// has been started by this service. Returns NULL if no process has been
// started.
PluginProcessHost* FindNpapiPluginProcess(const FilePath& plugin_path);
- PpapiPluginProcessHost* FindPpapiPluginProcess(const FilePath& plugin_path);
+ PpapiPluginProcessHost* FindPpapiPluginProcess(
+ const FilePath& plugin_path,
+ const FilePath& profile_data_directory);
PpapiPluginProcessHost* FindPpapiBrokerProcess(const FilePath& broker_path);
void RegisterPepperPlugins();
diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc
index 3bffd15..71cadc4 100644
--- a/content/browser/ppapi_plugin_process_host.cc
+++ b/content/browser/ppapi_plugin_process_host.cc
@@ -72,9 +72,10 @@ PpapiPluginProcessHost::~PpapiPluginProcessHost() {
PpapiPluginProcessHost* PpapiPluginProcessHost::CreatePluginHost(
const content::PepperPluginInfo& info,
+ const FilePath& profile_data_directory,
net::HostResolver* host_resolver) {
PpapiPluginProcessHost* plugin_host =
- new PpapiPluginProcessHost(host_resolver);
+ new PpapiPluginProcessHost(profile_data_directory, host_resolver);
if (plugin_host->Init(info))
return plugin_host;
@@ -110,10 +111,13 @@ void PpapiPluginProcessHost::OpenChannelToPlugin(Client* client) {
RequestPluginChannel(client);
}
-PpapiPluginProcessHost::PpapiPluginProcessHost(net::HostResolver* host_resolver)
+PpapiPluginProcessHost::PpapiPluginProcessHost(
+ const FilePath& profile_data_directory,
+ net::HostResolver* host_resolver)
: filter_(new PepperMessageFilter(PepperMessageFilter::PLUGIN,
host_resolver)),
network_observer_(new PluginNetworkObserver(this)),
+ profile_data_directory_(profile_data_directory),
is_broker_(false) {
process_.reset(new BrowserChildProcessHostImpl(
content::PROCESS_TYPE_PPAPI_PLUGIN, this));
diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h
index deef50f..71314b1 100644
--- a/content/browser/ppapi_plugin_process_host.h
+++ b/content/browser/ppapi_plugin_process_host.h
@@ -65,6 +65,7 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate,
static PpapiPluginProcessHost* CreatePluginHost(
const content::PepperPluginInfo& info,
+ const FilePath& profile_data_directory,
net::HostResolver* host_resolver);
static PpapiPluginProcessHost* CreateBrokerHost(
const content::PepperPluginInfo& info);
@@ -77,6 +78,8 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate,
void OpenChannelToPlugin(Client* client);
const FilePath& plugin_path() const { return plugin_path_; }
+ const FilePath& profile_data_directory() const {
+ return profile_data_directory_; }
// The client pointer must remain valid until its callback is issued.
@@ -85,7 +88,8 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate,
// Constructors for plugin and broker process hosts, respectively.
// You must call Init before doing anything else.
- PpapiPluginProcessHost(net::HostResolver* host_resolver);
+ PpapiPluginProcessHost(const FilePath& profile_data_directory,
+ net::HostResolver* host_resolver);
PpapiPluginProcessHost();
// Actually launches the process with the given plugin info. Returns true
@@ -122,6 +126,9 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate,
// Path to the plugin library.
FilePath plugin_path_;
+ // Path to the top-level plugin data directory (differs based upon profile).
+ FilePath profile_data_directory_;
+
const bool is_broker_;
scoped_ptr<BrowserChildProcessHostImpl> process_;
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 939f665..b345caa 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -279,7 +279,7 @@ RenderMessageFilter::RenderMessageFilter(
content::MediaObserver* media_observer)
: resource_dispatcher_host_(ResourceDispatcherHostImpl::Get()),
plugin_service_(plugin_service),
- browser_context_(browser_context),
+ profile_data_directory_(browser_context->GetPath()),
request_context_(request_context),
resource_context_(browser_context->GetResourceContext()),
render_widget_helper_(render_widget_helper),
@@ -663,8 +663,7 @@ void RenderMessageFilter::OnOpenChannelToPepperPlugin(
const FilePath& path,
IPC::Message* reply_msg) {
plugin_service_->OpenChannelToPpapiPlugin(
- path,
- new OpenChannelToPpapiPluginCallback(
+ path, profile_data_directory_, new OpenChannelToPpapiPluginCallback(
this, resource_context_, reply_msg));
}
diff --git a/content/browser/renderer_host/render_message_filter.h b/content/browser/renderer_host/render_message_filter.h
index fc04214..ab54ac3 100644
--- a/content/browser/renderer_host/render_message_filter.h
+++ b/content/browser/renderer_host/render_message_filter.h
@@ -240,10 +240,7 @@ class RenderMessageFilter : public content::BrowserMessageFilter {
// by the BrowserProcess, which has a wider scope than we do.
content::ResourceDispatcherHostImpl* resource_dispatcher_host_;
PluginServiceImpl* plugin_service_;
-
- // The browser context associated with our renderer process. This should only
- // be accessed on the UI thread!
- content::BrowserContext* browser_context_;
+ FilePath profile_data_directory_;
// Contextual information to be used for requests created here.
scoped_refptr<net::URLRequestContextGetter> request_context_;