Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Unified Diff: components/nacl/browser/nacl_broker_host_win.cc

Issue 2081183005: Use ChannelMojo from the browser to NaCl loader process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-ipc-channel-handle
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/nacl/browser/nacl_broker_host_win.h ('k') | components/nacl/browser/nacl_process_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/browser/nacl_broker_host_win.cc
diff --git a/components/nacl/browser/nacl_broker_host_win.cc b/components/nacl/browser/nacl_broker_host_win.cc
index 3aa98862384a5509791596523bed9441fc8e5f68..15419d999a4acb1a8197c6c45ab92fbce1c2a286 100644
--- a/components/nacl/browser/nacl_broker_host_win.cc
+++ b/components/nacl/browser/nacl_broker_host_win.cc
@@ -17,8 +17,10 @@
#include "content/public/browser/child_process_data.h"
#include "content/public/common/child_process_host.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/mojo_channel_switches.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "ipc/ipc_switches.h"
+#include "mojo/edk/embedder/embedder.h"
namespace {
// NOTE: changes to this class need to be reviewed by the security team.
@@ -40,17 +42,22 @@ class NaClBrokerSandboxedProcessLauncherDelegate
namespace nacl {
NaClBrokerHost::NaClBrokerHost() : is_terminating_(false) {
- process_.reset(content::BrowserChildProcessHost::Create(
- static_cast<content::ProcessType>(PROCESS_TYPE_NACL_BROKER), this));
}
NaClBrokerHost::~NaClBrokerHost() {
}
bool NaClBrokerHost::Init() {
+ const std::string mojo_child_token = mojo::edk::GenerateRandomToken();
+ DCHECK(!process_);
+ process_.reset(content::BrowserChildProcessHost::Create(
+ static_cast<content::ProcessType>(PROCESS_TYPE_NACL_BROKER), this,
+ mojo_child_token));
+
// Create the channel that will be used for communicating with the broker.
- std::string channel_id = process_->GetHost()->CreateChannel();
- if (channel_id.empty())
+ const std::string mojo_channel_token =
+ process_->GetHost()->CreateChannelMojo(mojo_child_token);
+ if (mojo_channel_token.empty())
return false;
// Create the path to the nacl broker/loader executable.
@@ -63,7 +70,7 @@ bool NaClBrokerHost::Init() {
cmd_line->AppendSwitchASCII(switches::kProcessType,
switches::kNaClBrokerProcess);
- cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id);
+ cmd_line->AppendSwitchASCII(switches::kMojoChannelToken, mojo_channel_token);
if (NaClBrowser::GetDelegate()->DialogsAreSuppressed())
cmd_line->AppendSwitch(switches::kNoErrorDialogs);
@@ -84,14 +91,15 @@ bool NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) {
return handled;
}
-bool NaClBrokerHost::LaunchLoader(const std::string& loader_channel_id) {
+bool NaClBrokerHost::LaunchLoader(const std::string& loader_channel_token) {
return process_->Send(
- new NaClProcessMsg_LaunchLoaderThroughBroker(loader_channel_id));
+ new NaClProcessMsg_LaunchLoaderThroughBroker(loader_channel_token));
}
-void NaClBrokerHost::OnLoaderLaunched(const std::string& loader_channel_id,
+void NaClBrokerHost::OnLoaderLaunched(const std::string& loader_channel_token,
base::ProcessHandle handle) {
- NaClBrokerService::GetInstance()->OnLoaderLaunched(loader_channel_id, handle);
+ NaClBrokerService::GetInstance()->OnLoaderLaunched(loader_channel_token,
+ handle);
}
bool NaClBrokerHost::LaunchDebugExceptionHandler(
« no previous file with comments | « components/nacl/browser/nacl_broker_host_win.h ('k') | components/nacl/browser/nacl_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698