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

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 Created 4 years, 12 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/renderer/ppb_nacl_private.h ('k') | ppapi/nacl_irt/irt_pnacl_translator_link.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6cbdfe43b49d192c20d296ccb3192fda4ef0d01e..7f87ddcbcfda95799ced4e0394d12d34d4828950 100644
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc
@@ -389,6 +389,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,
@@ -397,6 +407,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());
@@ -516,8 +528,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)) =
« no previous file with comments | « components/nacl/renderer/ppb_nacl_private.h ('k') | ppapi/nacl_irt/irt_pnacl_translator_link.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698