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

Unified Diff: components/nacl/renderer/ppb_nacl_private_impl.cc

Issue 1512733003: PNaCl: Use Chrome IPC to talk to the linker process, instead of SRPC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase + cleanup Created 5 years 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/renderer/ppb_nacl_private_impl.cc
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc
index 07d20e2b6281d9d964b251a66a9c9d3f27a04c01..28ac402597f1d55d4067c0dbf0918e04ce37cfa9 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -384,6 +384,16 @@ NaClAppProcessType PP_ToNaClAppProcessType(
return static_cast<NaClAppProcessType>(pp_process_type);
}
+// A dummy IPC::Listener object with a no-op message handler. We use
+// this with an IPC::SyncChannel where we only send synchronous
+// messages and don't need to handle any messages other than sync
+// replies.
+class NoOpListener : public IPC::Listener {
+ public:
+ bool OnMessageReceived(const IPC::Message& message) override { return false; }
+ void OnChannelError() override {}
+};
+
// Launch NaCl's sel_ldr process.
void LaunchSelLdr(PP_Instance instance,
PP_Bool main_service_runtime,
@@ -392,6 +402,8 @@ void LaunchSelLdr(PP_Instance instance,
PP_Bool uses_nonsfi_mode,
PP_NaClAppProcessType pp_process_type,
void* imc_handle,
+ scoped_ptr<IPC::SyncChannel>* translator_channel,
+ base::ProcessId* process_id,
PP_CompletionCallback callback) {
CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->
BelongsToCurrentThread());
@@ -511,8 +523,24 @@ void LaunchSelLdr(PP_Instance instance,
// Don't save instance_info if channel handle is invalid.
if (IsValidChannelHandle(instance_info.channel_handle)) {
- NaClPluginInstance* nacl_plugin_instance = GetNaClPluginInstance(instance);
- nacl_plugin_instance->instance_info.reset(new InstanceInfo(instance_info));
+ if (process_type == kPNaClTranslatorProcessType) {
+ // Return an IPC channel which allows communicating with a PNaCl
+ // translator process.
+ *translator_channel = IPC::SyncChannel::Create(
+ instance_info.channel_handle,
+ IPC::Channel::MODE_CLIENT,
+ new NoOpListener,
+ content::RenderThread::Get()->GetIOMessageLoopProxy(),
+ true,
+ content::RenderThread::Get()->GetShutdownEvent());
+ *process_id = launch_result.plugin_pid;
+ } else {
+ // Save the channel handle for when StartPpapiProxy() is called.
+ NaClPluginInstance* nacl_plugin_instance =
+ GetNaClPluginInstance(instance);
+ nacl_plugin_instance->instance_info.reset(
+ new InstanceInfo(instance_info));
+ }
}
*(static_cast<NaClHandle*>(imc_handle)) =

Powered by Google App Engine
This is Rietveld 408576698