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

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

Issue 2305913002: Use ChannelMojo from the browser to NaCl loader process. (Closed)
Patch Set: Created 4 years, 3 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_process_host.h ('k') | components/nacl/loader/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/browser/nacl_process_host.cc
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc
index 45b02d53b1c0a8b132cdab79e44dad1bb5d39868..633bace8b53ab92d7133240f4ae2bab9262345c8 100644
--- a/components/nacl/browser/nacl_process_host.cc
+++ b/components/nacl/browser/nacl_process_host.cc
@@ -22,6 +22,7 @@
#include "base/process/process_iterator.h"
#include "base/rand_util.h"
#include "base/single_thread_task_runner.h"
+#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
@@ -49,10 +50,12 @@
#include "content/public/browser/web_contents.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/process_type.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_switches.h"
+#include "mojo/edk/embedder/embedder.h"
#include "net/socket/socket_descriptor.h"
#include "ppapi/host/host_factory.h"
#include "ppapi/host/ppapi_host.h"
@@ -307,9 +310,11 @@ NaClProcessHost::NaClProcessHost(
process_type_(process_type),
profile_directory_(profile_directory),
render_view_id_(render_view_id),
+ mojo_child_token_(mojo::edk::GenerateRandomToken()),
weak_factory_(this) {
process_.reset(content::BrowserChildProcessHost::Create(
Ken Rockot(use gerrit already) 2016/09/26 21:21:07 I'm not sure why this CL works, but this is not co
- static_cast<content::ProcessType>(PROCESS_TYPE_NACL_LOADER), this));
+ static_cast<content::ProcessType>(PROCESS_TYPE_NACL_LOADER), this,
+ mojo_child_token_));
// Set the display name so the user knows what plugin the process is running.
// We aren't on the UI thread so getting the pref locale for language
@@ -577,9 +582,13 @@ void NaClProcessHost::LaunchNaClGdb() {
}
bool NaClProcessHost::LaunchSelLdr() {
- std::string channel_id = process_->GetHost()->CreateChannel();
- if (channel_id.empty()) {
- SendErrorToRenderer("CreateChannel() failed");
+ DCHECK(!mojo_child_token_.empty());
+ std::string mojo_channel_token =
+ process_->GetHost()->CreateChannelMojo(mojo_child_token_);
+ // |mojo_child_token_| is no longer used.
+ base::STLClearObject(&mojo_child_token_);
+ if (mojo_channel_token.empty()) {
+ SendErrorToRenderer("CreateChannelMojo() failed");
return false;
}
@@ -639,7 +648,7 @@ bool NaClProcessHost::LaunchSelLdr() {
(uses_nonsfi_mode_ ?
switches::kNaClLoaderNonSfiProcess :
switches::kNaClLoaderProcess));
- cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id);
+ cmd_line->AppendSwitchASCII(switches::kMojoChannelToken, mojo_channel_token);
if (NaClBrowser::GetDelegate()->DialogsAreSuppressed())
cmd_line->AppendSwitch(switches::kNoErrorDialogs);
@@ -651,7 +660,7 @@ bool NaClProcessHost::LaunchSelLdr() {
#if defined(OS_WIN)
if (RunningOnWOW64()) {
if (!NaClBrokerService::GetInstance()->LaunchLoader(
- weak_factory_.GetWeakPtr(), channel_id)) {
+ weak_factory_.GetWeakPtr(), mojo_channel_token)) {
SendErrorToRenderer("broker service did not launch process");
return false;
}
« no previous file with comments | « components/nacl/browser/nacl_process_host.h ('k') | components/nacl/loader/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698