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

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: jfhgjdhgjdf Created 4 years, 6 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
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..b0fb82dae5c3ac7dced49401f88eb420cc95d1d2 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.
@@ -39,9 +41,12 @@ class NaClBrokerSandboxedProcessLauncherDelegate
namespace nacl {
-NaClBrokerHost::NaClBrokerHost() : is_terminating_(false) {
+NaClBrokerHost::NaClBrokerHost()
+ : is_terminating_(false),
+ mojo_child_token_(mojo::edk::GenerateRandomToken()) {
process_.reset(content::BrowserChildProcessHost::Create(
Mark Seaborn 2016/07/08 20:26:19 It looks like this Create() call could be moved in
Anand Mistry (off Chromium) 2016/07/12 07:26:23 Done.
- static_cast<content::ProcessType>(PROCESS_TYPE_NACL_BROKER), this));
+ static_cast<content::ProcessType>(PROCESS_TYPE_NACL_BROKER), this,
+ mojo_child_token_));
}
NaClBrokerHost::~NaClBrokerHost() {
@@ -49,8 +54,9 @@ NaClBrokerHost::~NaClBrokerHost() {
bool NaClBrokerHost::Init() {
// Create the channel that will be used for communicating with the broker.
- 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())
return false;
// Create the path to the nacl broker/loader executable.
@@ -63,7 +69,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);

Powered by Google App Engine
This is Rietveld 408576698