diff options
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/child_process_info.cc | 3 | ||||
-rw-r--r-- | chrome/common/child_process_info.h | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 12 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 4 | ||||
-rw-r--r-- | chrome/common/pepper_plugin_registry.cc | 27 | ||||
-rw-r--r-- | chrome/common/pepper_plugin_registry.h | 17 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 8 | ||||
-rw-r--r-- | chrome/common/sandbox_policy.cc | 2 |
8 files changed, 71 insertions, 5 deletions
diff --git a/chrome/common/child_process_info.cc b/chrome/common/child_process_info.cc index bd94ff26..1af0cdb 100644 --- a/chrome/common/child_process_info.cc +++ b/chrome/common/child_process_info.cc @@ -64,6 +64,8 @@ std::string ChildProcessInfo::GetTypeNameInEnglish( return "Native Client broker"; case GPU_PROCESS: return "GPU"; + case PPAPI_PLUGIN_PROCESS: + return "Pepper Plugin"; case UNKNOWN_PROCESS: default: DCHECK(false) << "Unknown child process type!"; @@ -96,6 +98,7 @@ string16 ChildProcessInfo::GetLocalizedTitle() const { return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NACL_BROKER_PREFIX); case ChildProcessInfo::PLUGIN_PROCESS: + case ChildProcessInfo::PPAPI_PLUGIN_PROCESS: return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_PREFIX, title, WideToUTF16Hack(version_)); diff --git a/chrome/common/child_process_info.h b/chrome/common/child_process_info.h index 78b0a2a..651978f 100644 --- a/chrome/common/child_process_info.h +++ b/chrome/common/child_process_info.h @@ -28,7 +28,8 @@ class ChildProcessInfo { ZYGOTE_PROCESS, SANDBOX_HELPER_PROCESS, NACL_BROKER_PROCESS, - GPU_PROCESS + GPU_PROCESS, + PPAPI_PLUGIN_PROCESS }; ChildProcessInfo(const ChildProcessInfo& original); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 2678d36..386395b 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -846,6 +846,18 @@ const char kPluginProcess[] = "plugin"; // Causes the plugin process to display a dialog on launch. const char kPluginStartupDialog[] = "plugin-startup-dialog"; +// Runs PPAPI (Pepper) plugins out-of-process. +const char kPpapiOutOfProcess[] = "ppapi-out-of-process"; + +// Like kPluginLauncher for PPAPI plugins. +const char kPpapiPluginLauncher[] = "ppapi-plugin-launcher"; + +// Argument to the process type that indicates a PPAPI plugin process type. +const char kPpapiPluginProcess[] = "ppapi"; + +// Causes the PPAPI sub process to display a dialog on launch. +const char kPpapiStartupDialog[] = "ppapi-startup-dialog"; + // Establishes a channel to the GPU process asynchronously and (re)launches it // if necessary when a renderer process starts. const char kPrelaunchGpuProcess[] = "prelaunch-gpu-process"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 8d7db8e..15ec7e5 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -243,6 +243,10 @@ extern const char kPluginLauncher[]; extern const char kPluginPath[]; extern const char kPluginProcess[]; extern const char kPluginStartupDialog[]; +extern const char kPpapiOutOfProcess[]; +extern const char kPpapiPluginLauncher[]; +extern const char kPpapiPluginProcess[]; +extern const char kPpapiStartupDialog[]; extern const char kPrelaunchGpuProcess[]; extern const char kPrint[]; extern const char kProcessPerSite[]; diff --git a/chrome/common/pepper_plugin_registry.cc b/chrome/common/pepper_plugin_registry.cc index 92fae2e..50f50e7 100644 --- a/chrome/common/pepper_plugin_registry.cc +++ b/chrome/common/pepper_plugin_registry.cc @@ -21,7 +21,9 @@ const char* PepperPluginRegistry::kPDFPluginExtension = "pdf"; const char* PepperPluginRegistry::kPDFPluginDescription = "Portable Document Format"; -PepperPluginInfo::PepperPluginInfo() : is_internal(false) { +PepperPluginInfo::PepperPluginInfo() + : is_internal(false), + is_out_of_process(false) { } PepperPluginInfo::~PepperPluginInfo() {} @@ -52,7 +54,7 @@ void PepperPluginRegistry::PreloadModules() { std::vector<PepperPluginInfo> plugins; GetList(&plugins); for (size_t i = 0; i < plugins.size(); ++i) { - if (!plugins[i].is_internal) { + if (!plugins[i].is_internal && !plugins[i].is_out_of_process) { base::NativeLibrary library = base::LoadNativeLibrary(plugins[i].path); LOG_IF(WARNING, !library) << "Unable to load plugin " << plugins[i].path.value(); @@ -69,6 +71,9 @@ void PepperPluginRegistry::GetPluginInfoFromSwitch( if (value.empty()) return; + bool out_of_process = + CommandLine::ForCurrentProcess()->HasSwitch(switches::kPpapiOutOfProcess); + // FORMAT: // command-line = <plugin-entry> + *( LWS + "," + LWS + <plugin-entry> ) // plugin-entry = <file-path> + ["#" + <name> + ["#" + <description>]] + @@ -88,6 +93,7 @@ void PepperPluginRegistry::GetPluginInfoFromSwitch( base::SplitString(parts[0], '#', &name_parts); PepperPluginInfo plugin; + plugin.is_out_of_process = out_of_process; #if defined(OS_WIN) // This means we can't provide plugins from non-ASCII paths, but // since this switch is only for development I don't think that's @@ -168,6 +174,19 @@ void PepperPluginRegistry::GetInternalPluginInfo( #endif } +bool PepperPluginRegistry::RunOutOfProcessForPlugin( + const FilePath& path) const { + // TODO(brettw) don't recompute this every time. But since this Pepper + // switch is only for development, it's OK for now. + std::vector<PepperPluginInfo> plugins; + GetList(&plugins); + for (size_t i = 0; i < plugins.size(); ++i) { + if (path == plugins[i].path) + return plugins[i].is_out_of_process; + } + return false; +} + pepper::PluginModule* PepperPluginRegistry::GetModule( const FilePath& path) const { ModuleMap::const_iterator it = modules_.find(path); @@ -181,6 +200,7 @@ PepperPluginRegistry::~PepperPluginRegistry() {} PepperPluginRegistry::PepperPluginRegistry() { InternalPluginInfoList internal_plugin_info; GetInternalPluginInfo(&internal_plugin_info); + // Register modules for these suckers. for (InternalPluginInfoList::const_iterator it = internal_plugin_info.begin(); @@ -203,6 +223,9 @@ PepperPluginRegistry::PepperPluginRegistry() { GetPluginInfoFromSwitch(&plugins); GetExtraPlugins(&plugins); for (size_t i = 0; i < plugins.size(); ++i) { + if (plugins[i].is_out_of_process) + continue; // Only preload in-process plugins. + const FilePath& path = plugins[i].path; ModuleHandle module = pepper::PluginModule::CreateModule(path); if (!module) { diff --git a/chrome/common/pepper_plugin_registry.h b/chrome/common/pepper_plugin_registry.h index ebabc2e..60762c5b 100644 --- a/chrome/common/pepper_plugin_registry.h +++ b/chrome/common/pepper_plugin_registry.h @@ -14,10 +14,16 @@ #include "webkit/glue/plugins/pepper_plugin_module.h" struct PepperPluginInfo { - PepperPluginInfo(); // Needed to initialize |is_internal|. + PepperPluginInfo(); ~PepperPluginInfo(); - bool is_internal; // Defaults to false (see constructor). + // Indicates internal plugins for which there's not actually a library. + // Defaults to false. + bool is_internal; + + // True when this plugin should be run out of process. Defaults to false. + bool is_out_of_process; + FilePath path; // Internal plugins have "internal-[name]" as path. std::vector<std::string> mime_types; std::string name; @@ -46,6 +52,13 @@ class PepperPluginRegistry { // access to the plugins before entering the sandbox. static void PreloadModules(); + // Returns true if the given plugin is a pepper plugin that should be run + // out of process. + bool RunOutOfProcessForPlugin(const FilePath& path) const; + + // Returns a preloaded module for the given path. This only works for + // non-out-of-process plugins since we preload them so they will run in the + // sandbox. Returns NULL if the plugin hasn't been preloaded. pepper::PluginModule* GetModule(const FilePath& path) const; ~PepperPluginRegistry(); diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index f00c806..a4ac77f 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1578,6 +1578,14 @@ IPC_BEGIN_MESSAGES(ViewHost) WebPluginInfo /* info */) // A renderer sends this to the browser process when it wants to + // create a pepper plugin. The browser will create the plugin process if + // necessary, and will return a handle to the channel on success. + // On error an empty string is returned. + IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_OpenChannelToPepperPlugin, + FilePath /* path */, + IPC::ChannelHandle /* handle to channel */) + + // A renderer sends this to the browser process when it wants to // create connect to the GPU. The browser will create the GPU process if // necessary, and will return a handle to the channel via // a GpuChannelEstablished message. diff --git a/chrome/common/sandbox_policy.cc b/chrome/common/sandbox_policy.cc index 0ab7563..4a6653f 100644 --- a/chrome/common/sandbox_policy.cc +++ b/chrome/common/sandbox_policy.cc @@ -475,6 +475,8 @@ base::ProcessHandle StartProcessWithAccess(CommandLine* cmd_line, type = ChildProcessInfo::NACL_BROKER_PROCESS; } else if (type_str == switches::kGpuProcess) { type = ChildProcessInfo::GPU_PROCESS; + } else if (type_str == switches::kPpapiPluginProcess) { + type = ChildProcessInfo::PPAPI_PLUGIN_PROCESS; } else { NOTREACHED(); return 0; |