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

Unified Diff: ppapi/proxy/plugin_main_nacl.cc

Issue 150713003: Create IPC channel to communicate with the renderer in NaClListener::OnStart(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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: ppapi/proxy/plugin_main_nacl.cc
diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc
index a128f638ee5c1bfb6c572bf888655060b2296637..80a87206f8f183a279c2c4e9c2f64060f11121ca 100644
--- a/ppapi/proxy/plugin_main_nacl.cc
+++ b/ppapi/proxy/plugin_main_nacl.cc
@@ -45,9 +45,13 @@ LogFunctionMap g_log_function_mapping;
#endif
#include "ppapi/proxy/ppapi_messages.h"
-// This must match up with NACL_CHROME_INITIAL_IPC_DESC,
-// defined in sel_main_chrome.h
-#define NACL_IPC_FD 6
+// The FD # to communicate with the browser. This must match up with
+// the value set in nacl_listener.cc.
+#define NACL_IPC_BROWSER_FD 6
Mark Seaborn 2014/02/04 19:28:12 Can you use NACL_CHROME_DESC_BASE instead, please?
hidehiko 2014/02/05 06:30:16 Done. Note that we cannot include sel_main_chrome.
Mark Seaborn 2014/02/05 17:25:14 If checkdeps complained about using sel_main_chrom
hidehiko 2014/02/06 19:27:30 Done. Note that, native_client/src/public was not
+
+// The FD # to communicate with the renderer. This must match up with
+// the value set in nacl_listener.cc.
+#define NACL_IPC_RENDERER_FD 7
using ppapi::proxy::PluginDispatcher;
using ppapi::proxy::PluginGlobals;
@@ -92,8 +96,8 @@ class PpapiDispatcher : public ProxyChannel,
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
private:
- void OnMsgCreateNaClChannel(const ppapi::PpapiNaClChannelArgs& args,
- SerializedHandle handle);
+ void OnMsgInitializeNaClDispatcher(
+ const ppapi::PpapiInitializeNaClDispatcherArgs& args);
void OnPluginDispatcherMessageReceived(const IPC::Message& msg);
void SetPpapiKeepAliveThrottleFromCommandLine();
@@ -110,7 +114,7 @@ PpapiDispatcher::PpapiDispatcher(scoped_refptr<base::MessageLoopProxy> io_loop)
message_loop_(io_loop),
shutdown_event_(true, false) {
IPC::ChannelHandle channel_handle(
- "NaCl IPC", base::FileDescriptor(NACL_IPC_FD, false));
+ "NaCl IPC", base::FileDescriptor(NACL_IPC_BROWSER_FD, false));
// We don't have/need a PID since handle sharing happens outside of the
// NaCl sandbox.
InitWithChannel(this, base::kNullProcessId, channel_handle,
@@ -189,16 +193,16 @@ PP_Resource PpapiDispatcher::CreateBrowserFont(
bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(PpapiDispatcher, msg)
- IPC_MESSAGE_HANDLER(PpapiMsg_CreateNaClChannel, OnMsgCreateNaClChannel)
+ IPC_MESSAGE_HANDLER(PpapiMsg_InitializeNaClDispatcher,
+ OnMsgInitializeNaClDispatcher)
// All other messages are simply forwarded to a PluginDispatcher.
IPC_MESSAGE_UNHANDLED(OnPluginDispatcherMessageReceived(msg))
IPC_END_MESSAGE_MAP()
return true;
}
-void PpapiDispatcher::OnMsgCreateNaClChannel(
- const ppapi::PpapiNaClChannelArgs& args,
- SerializedHandle handle) {
+void PpapiDispatcher::OnMsgInitializeNaClDispatcher(
Mark Seaborn 2014/02/04 19:28:12 Can you add a check that would abort or ignore the
hidehiko 2014/02/05 06:30:16 Done.
+ const ppapi::PpapiInitializeNaClDispatcherArgs& args) {
static bool command_line_and_logging_initialized = false;
if (!command_line_and_logging_initialized) {
CommandLine::Init(0, NULL);
@@ -228,7 +232,8 @@ void PpapiDispatcher::OnMsgCreateNaClChannel(
new PluginDispatcher(::PPP_GetInterface, args.permissions,
args.off_the_record);
// The channel handle's true name is not revealed here.
- IPC::ChannelHandle channel_handle("nacl", handle.descriptor());
+ IPC::ChannelHandle channel_handle(
+ "nacl", base::FileDescriptor(NACL_IPC_RENDERER_FD, false));
if (!dispatcher->InitPluginWithChannel(this, base::kNullProcessId,
channel_handle, false)) {
delete dispatcher;

Powered by Google App Engine
This is Rietveld 408576698