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

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

Issue 2025763002: Use ChannelMojo in Pepper and NaCl processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-utility-channel-mojo
Patch Set: iujbhirtughfbnjrthiubj 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
« no previous file with comments | « components/nacl/browser/nacl_process_host.h ('k') | components/nacl/common/nacl_messages.h » ('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 bf4bbac82b0c1ba3a5793a4ed0998649c5ae9e97..fd35c5d2aaa6831811165fab1d197b8ccb3580fc 100644
--- a/components/nacl/browser/nacl_process_host.cc
+++ b/components/nacl/browser/nacl_process_host.cc
@@ -49,10 +49,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"
@@ -164,11 +166,7 @@ content::ZygoteHandle g_nacl_zygote;
class NaClSandboxedProcessLauncherDelegate
: public content::SandboxedProcessLauncherDelegate {
public:
- NaClSandboxedProcessLauncherDelegate(ChildProcessHost* host)
-#if defined(OS_POSIX)
- : ipc_fd_(host->TakeClientFileDescriptor())
-#endif
- {}
+ NaClSandboxedProcessLauncherDelegate(ChildProcessHost* host) {}
~NaClSandboxedProcessLauncherDelegate() override {}
@@ -192,13 +190,8 @@ class NaClSandboxedProcessLauncherDelegate
}
#endif // !defined(OS_MACOSX)
- base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
+ base::ScopedFD TakeIpcFd() override { return base::ScopedFD(-1); }
#endif // OS_WIN
-
- private:
-#if defined(OS_POSIX)
- base::ScopedFD ipc_fd_;
-#endif // OS_POSIX
};
void CloseFile(base::File file) {
@@ -308,9 +301,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(
- 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
@@ -578,9 +573,10 @@ void NaClProcessHost::LaunchNaClGdb() {
}
bool NaClProcessHost::LaunchSelLdr() {
- std::string channel_id = process_->GetHost()->CreateChannel();
- if (channel_id.empty()) {
- SendErrorToRenderer("CreateChannel() failed");
+ std::string mojo_channel_token =
+ process_->GetHost()->CreateChannelMojo(mojo_child_token_);
+ if (mojo_channel_token.empty()) {
+ SendErrorToRenderer("CreateChannelMojo() failed");
return false;
}
@@ -640,7 +636,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);
@@ -653,7 +649,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/common/nacl_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698