Chromium Code Reviews| Index: components/nacl/loader/nacl_listener.cc |
| diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc |
| index b5ee5f74fa0039b76c9bd1d75a347bd203df3bec..f30fbdf82cee6ab89e343f57f0a2e0156946358f 100644 |
| --- a/components/nacl/loader/nacl_listener.cc |
| +++ b/components/nacl/loader/nacl_listener.cc |
| @@ -84,10 +84,10 @@ int CreateMemoryObject(size_t size, int executable) { |
| return content::MakeSharedMemorySegmentViaIPC(size, executable); |
| } |
| -#elif defined(OS_WIN) |
| - |
| NaClListener* g_listener; |
|
Mark Seaborn
2014/03/26 23:34:04
Shouldn't this be unconditional? Doesn't look lik
bradn
2014/05/05 18:46:07
Oops. Done. Not sure why it ended up like that.
|
| +#elif defined(OS_WIN) |
| + |
| // We wrap the function to convert the bool return value to an int. |
| int BrokerDuplicateHandle(NaClHandle source_handle, |
| uint32_t process_id, |
| @@ -110,6 +110,10 @@ int AttachDebugExceptionHandler(const void* info, size_t info_size) { |
| #endif |
| +void DebugStubPortSelectedHandler(uint16_t port) { |
| + g_listener->Send(new NaClProcessHostMsg_DebugStubPortSelected(port)); |
| +} |
| + |
| // Creates the PPAPI IPC channel between the NaCl IRT and the host |
| // (browser/renderer) process, and starts to listen it on the thread where |
| // the given message_loop_proxy runs. |
| @@ -209,18 +213,14 @@ NaClListener::NaClListener() : shutdown_event_(true, false), |
| main_loop_(NULL) { |
| io_thread_.StartWithOptions( |
| base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| -#if defined(OS_WIN) |
| DCHECK(g_listener == NULL); |
| g_listener = this; |
| -#endif |
| } |
| NaClListener::~NaClListener() { |
| NOTREACHED(); |
| shutdown_event_.Signal(); |
| -#if defined(OS_WIN) |
| g_listener = NULL; |
| -#endif |
| } |
| bool NaClListener::Send(IPC::Message* msg) { |
| @@ -412,6 +412,8 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { |
| args->debug_stub_server_bound_socket_fd = nacl::ToNativeHandle( |
| params.debug_stub_server_bound_socket); |
| #endif |
| + args->debug_stub_server_port_selected_handler_func = |
| + DebugStubPortSelectedHandler; |
| #if defined(OS_WIN) |
| args->broker_duplicate_handle_func = BrokerDuplicateHandle; |
| args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; |