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

Unified Diff: components/nacl/loader/nonsfi/nonsfi_listener.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/loader/nonsfi/nonsfi_listener.h ('k') | content/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nonsfi/nonsfi_listener.cc
diff --git a/components/nacl/loader/nonsfi/nonsfi_listener.cc b/components/nacl/loader/nonsfi/nonsfi_listener.cc
index 3ee8aa096384f2961030b0464e7b1fa6866b8a73..d85e181ad9674857ccdc37ba4973bb9fcb4d4575 100644
--- a/components/nacl/loader/nonsfi/nonsfi_listener.cc
+++ b/components/nacl/loader/nonsfi/nonsfi_listener.cc
@@ -7,16 +7,21 @@
#include "base/command_line.h"
#include "base/file_descriptor_posix.h"
#include "base/logging.h"
+#include "base/posix/global_descriptors.h"
#include "base/rand_util.h"
#include "build/build_config.h"
#include "components/nacl/common/nacl_messages.h"
#include "components/nacl/common/nacl_types.h"
#include "components/nacl/loader/nacl_trusted_listener.h"
#include "components/nacl/loader/nonsfi/nonsfi_main.h"
+#include "content/public/common/content_descriptors.h"
+#include "content/public/common/mojo_channel_switches.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_switches.h"
#include "ipc/ipc_sync_channel.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/scoped_ipc_support.h"
#include "native_client/src/public/nonsfi/irt_random.h"
#include "ppapi/nacl_irt/irt_manifest.h"
#include "ppapi/nacl_irt/plugin_startup.h"
@@ -35,15 +40,29 @@ NonSfiListener::NonSfiListener()
key_fd_map_(new std::map<std::string, int>) {
io_thread_.StartWithOptions(
base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
+
+ mojo_ipc_support_.reset(new mojo::edk::ScopedIPCSupport(
+ io_thread_.task_runner().get()));
+ mojo::edk::ScopedPlatformHandle platform_channel(
+ mojo::edk::PlatformHandle(
+ base::GlobalDescriptors::GetInstance()->Get(kMojoIPCChannel)));
+ DCHECK(platform_channel.is_valid());
+ mojo::edk::SetParentPipeHandle(std::move(platform_channel));
}
NonSfiListener::~NonSfiListener() {
}
void NonSfiListener::Listen() {
+ mojo::ScopedMessagePipeHandle handle(
+ mojo::edk::CreateChildMessagePipe(
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kMojoChannelToken)));
+ DCHECK(handle.is_valid());
+ IPC::ChannelHandle channel_handle = IPC::ChannelHandle(handle.release());
+
channel_ = IPC::SyncChannel::Create(
- base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kProcessChannelID),
+ channel_handle,
IPC::Channel::MODE_CLIENT,
this, // As a Listener.
io_thread_.task_runner().get(),
@@ -96,7 +115,7 @@ void NonSfiListener::OnStart(const nacl::NaClStartParams& params) {
params.ppapi_browser_channel_handle,
params.ppapi_renderer_channel_handle,
params.manifest_service_channel_handle);
- ppapi::StartUpPlugin();
+ ppapi::StartUpPlugin(false);
// TODO(teravest): Do we plan on using this renderer handle for nexe loading
// for non-SFI? Right now, passing an empty channel handle instead causes
« no previous file with comments | « components/nacl/loader/nonsfi/nonsfi_listener.h ('k') | content/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698