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

Unified Diff: chrome/nacl/nacl_listener.cc

Issue 10214007: Add an IPC channel between the NaCl loader process and the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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
Index: chrome/nacl/nacl_listener.cc
===================================================================
--- chrome/nacl/nacl_listener.cc (revision 143375)
+++ chrome/nacl/nacl_listener.cc (working copy)
@@ -13,13 +13,19 @@
#include "base/message_loop.h"
#include "base/rand_util.h"
#include "chrome/common/nacl_messages.h"
+#include "chrome/nacl/nacl_ipc_adapter.h"
#include "chrome/nacl/nacl_validation_db.h"
#include "chrome/nacl/nacl_validation_query.h"
+#include "ipc/ipc_channel_handle.h"
+#include "ipc/ipc_switches.h"
#include "ipc/ipc_sync_channel.h"
#include "ipc/ipc_sync_message_filter.h"
-#include "ipc/ipc_switches.h"
#include "native_client/src/trusted/service_runtime/sel_main_chrome.h"
+#if defined(OS_POSIX)
+#include "base/file_descriptor_posix.h"
+#endif
+
#if defined(OS_LINUX)
#include "content/public/common/child_process_sandbox_support_linux.h"
#endif
@@ -188,6 +194,25 @@
return;
}
+ if (params.enable_ipc_proxy) {
+ // Create the server side of the channel and notify the process host so it
+ // can reply to the renderer, which will connect as client.
+ IPC::ChannelHandle channel_handle =
+ IPC::Channel::GenerateVerifiedChannelID("nacl");
+
+ scoped_refptr<NaClIPCAdapter> ipc_adapter(new NaClIPCAdapter(
+ channel_handle, io_thread_.message_loop_proxy()));
+ args->initial_ipc_desc = ipc_adapter.get()->MakeNaClDesc();
+
+#if defined(OS_POSIX)
+ channel_handle.socket = base::FileDescriptor(
+ ipc_adapter.get()->TakeClientFileDescriptor(), true);
+#endif
+
+ if (!Send(new NaClProcessHostMsg_PpapiChannelCreated(channel_handle)))
+ LOG(ERROR) << "Failed to send IPC channel handle to renderer.";
+ }
+
std::vector<nacl::FileDescriptor> handles = params.handles;
#if defined(OS_LINUX) || defined(OS_MACOSX)

Powered by Google App Engine
This is Rietveld 408576698