Index: ppapi/proxy/plugin_main_nacl.cc |
diff --git a/ppapi/proxy/plugin_main_nacl.cc b/ppapi/proxy/plugin_main_nacl.cc |
index 8733b9c46748ba8c90d48d89ba7833c89bad0724..cb646c61bedf262a55c41fd6acd89eaa78837284 100644 |
--- a/ppapi/proxy/plugin_main_nacl.cc |
+++ b/ppapi/proxy/plugin_main_nacl.cc |
@@ -11,6 +11,7 @@ |
// IPC_MESSAGE_MACROS_LOG_ENABLED so ppapi_messages.h will generate the |
// ViewMsgLog et al. functions. |
+#include "base/command_line.h" |
#include "base/message_loop.h" |
#include "base/synchronization/waitable_event.h" |
#include "base/threading/thread.h" |
@@ -83,8 +84,7 @@ class PpapiDispatcher : public ProxyChannel, |
private: |
void OnMsgCreateNaClChannel(int renderer_id, |
- const ppapi::PpapiPermissions& permissions, |
- bool incognito, |
+ const ppapi::PpapiNaClChannelArgs& args, |
SerializedHandle handle); |
void OnMsgResourceReply( |
const ppapi::proxy::ResourceMessageReplyParams& reply_params, |
@@ -179,18 +179,36 @@ bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) { |
return true; |
} |
+static bool cmdline_and_logging_initialized = false; |
+ |
void PpapiDispatcher::OnMsgCreateNaClChannel( |
int renderer_id, |
- const ppapi::PpapiPermissions& permissions, |
- bool incognito, |
+ const ppapi::PpapiNaClChannelArgs& args, |
SerializedHandle handle) { |
+ if (!cmdline_and_logging_initialized) { |
dmichael (off chromium)
2013/04/10 23:10:22
Does this ever happen more than once? If it really
|
+ CommandLine::Init(0, NULL); |
+ for (size_t i = 0; i < args.switch_names.size(); ++i) { |
+ DCHECK(i < args.switch_values.size()); |
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
+ args.switch_names[i], args.switch_values[i]); |
+ } |
+ logging::InitLogging( |
+ NULL, |
+ logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
+ logging::DONT_LOCK_LOG_FILE, |
+ logging::DELETE_OLD_LOG_FILE, |
+ logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
+ cmdline_and_logging_initialized = true; |
+ } |
+ |
// Tell the process-global GetInterface which interfaces it can return to the |
// plugin. |
ppapi::proxy::InterfaceList::SetProcessGlobalPermissions( |
- permissions); |
+ args.permissions); |
PluginDispatcher* dispatcher = |
- new PluginDispatcher(::PPP_GetInterface, permissions, incognito); |
+ 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()); |
if (!dispatcher->InitPluginWithChannel(this, base::kNullProcessId, |