Index: content/browser/ppapi_plugin_process_host.cc |
diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc |
index 478f476f36d1370785b56029fe2e4173c588db02..2104e57c9840ab0edbdaa7644181680fcf3af8e5 100644 |
--- a/content/browser/ppapi_plugin_process_host.cc |
+++ b/content/browser/ppapi_plugin_process_host.cc |
@@ -26,6 +26,7 @@ |
#include "content/public/browser/content_browser_client.h" |
#include "content/public/common/content_constants.h" |
#include "content/public/common/content_switches.h" |
+#include "content/public/common/mojo_channel_switches.h" |
#include "content/public/common/pepper_plugin_info.h" |
#include "content/public/common/process_type.h" |
#include "content/public/common/sandbox_type.h" |
@@ -63,10 +64,8 @@ class PpapiPluginSandboxedProcessLauncherDelegate |
ChildProcessHost* host) |
#if defined(OS_WIN) |
: info_(info), is_broker_(is_broker) { |
-#elif defined(OS_MACOSX) || defined(OS_ANDROID) |
- : ipc_fd_(host->TakeClientFileDescriptor()) { |
-#elif defined(OS_POSIX) |
- : ipc_fd_(host->TakeClientFileDescriptor()), is_broker_(is_broker) { |
+#elif defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
+ : is_broker_(is_broker) { |
#else |
{ |
#endif |
@@ -129,7 +128,7 @@ class PpapiPluginSandboxedProcessLauncherDelegate |
} |
#endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) |
- base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } |
+ base::ScopedFD TakeIpcFd() override { return base::ScopedFD(-1); } |
#endif // OS_WIN |
SandboxType GetSandboxType() override { |
@@ -140,9 +139,6 @@ class PpapiPluginSandboxedProcessLauncherDelegate |
#if defined(OS_WIN) |
const PepperPluginInfo& info_; |
#endif // OS_WIN |
-#if defined(OS_POSIX) |
- base::ScopedFD ipc_fd_; |
-#endif // OS_POSIX |
#if (defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)) || \ |
defined(OS_WIN) |
bool is_broker_; |
@@ -317,7 +313,8 @@ PpapiPluginProcessHost::PpapiPluginProcessHost( |
const PepperPluginInfo& info, |
const base::FilePath& profile_data_directory) |
: profile_data_directory_(profile_data_directory), |
- is_broker_(false) { |
+ is_broker_(false), |
+ mojo_child_token_(mojo::edk::GenerateRandomToken()) { |
uint32_t base_permissions = info.permissions; |
// We don't have to do any whitelisting for APIs in this process host, so |
@@ -328,7 +325,7 @@ PpapiPluginProcessHost::PpapiPluginProcessHost( |
permissions_ = ppapi::PpapiPermissions::GetForCommandLine(base_permissions); |
process_.reset(new BrowserChildProcessHostImpl( |
- PROCESS_TYPE_PPAPI_PLUGIN, this, mojo::edk::GenerateRandomToken())); |
+ PROCESS_TYPE_PPAPI_PLUGIN, this, mojo_child_token_)); |
host_impl_.reset(new BrowserPpapiHostImpl(this, permissions_, info.name, |
info.path, profile_data_directory, |
@@ -350,9 +347,9 @@ PpapiPluginProcessHost::PpapiPluginProcessHost( |
} |
PpapiPluginProcessHost::PpapiPluginProcessHost() |
- : is_broker_(true) { |
+ : is_broker_(true), mojo_child_token_(mojo::edk::GenerateRandomToken()) { |
process_.reset(new BrowserChildProcessHostImpl( |
- PROCESS_TYPE_PPAPI_BROKER, this, mojo::edk::GenerateRandomToken())); |
+ PROCESS_TYPE_PPAPI_BROKER, this, mojo_child_token_)); |
ppapi::PpapiPermissions permissions; // No permissions. |
// The plugin name, path and profile data directory shouldn't be needed for |
@@ -372,8 +369,9 @@ bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { |
process_->SetName(base::UTF8ToUTF16(info.name)); |
} |
- std::string channel_id = process_->GetHost()->CreateChannel(); |
- if (channel_id.empty()) { |
+ std::string mojo_channel_token = |
+ process_->GetHost()->CreateChannelMojo(mojo_child_token_); |
+ if (mojo_channel_token.empty()) { |
VLOG(1) << "Could not create pepper host channel."; |
return false; |
} |
@@ -399,7 +397,7 @@ bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { |
cmd_line->AppendSwitchASCII(switches::kProcessType, |
is_broker_ ? switches::kPpapiBrokerProcess |
: switches::kPpapiPluginProcess); |
- cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
+ cmd_line->AppendSwitchASCII(switches::kMojoChannelToken, mojo_channel_token); |
#if defined(OS_WIN) |
if (GetContentClient()->browser()->ShouldUseWindowsPrefetchArgument()) { |