Chromium Code Reviews| Index: chrome/browser/nacl_host/nacl_process_host.cc |
| =================================================================== |
| --- chrome/browser/nacl_host/nacl_process_host.cc (revision 155316) |
| +++ chrome/browser/nacl_host/nacl_process_host.cc (working copy) |
| @@ -39,6 +39,7 @@ |
| #include "ipc/ipc_switches.h" |
| #include "native_client/src/shared/imc/nacl_imc.h" |
| #include "net/base/net_util.h" |
| +#include "net/base/tcp_listen_socket.h" |
| #include "ppapi/proxy/ppapi_messages.h" |
| #if defined(OS_POSIX) |
| @@ -633,6 +634,17 @@ |
| return true; |
| } |
| +#if defined(OS_POSIX) |
| +SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { |
| + SocketDescriptor s = net::TCPListenSocket::CreateAndBind("127.0.0.1", 4014); |
|
Mark Seaborn
2012/09/10 15:39:45
Nit: Can you make 4014 a named constant? And comm
halyavin
2012/09/11 11:16:12
Done.
|
| + if (listen(s, 1)) { |
| + LOG(ERROR) << "Failed to listen debug stub socket"; |
|
Mark Seaborn
2012/09/10 15:39:45
Missing a preposition. Maybe "listen() failed on
halyavin
2012/09/11 11:16:12
Done.
|
| + return net::TCPListenSocket::kInvalidSocket; |
| + } |
| + return s; |
| +} |
| +#endif |
| + |
| bool NaClProcessHost::StartNaClExecution() { |
| NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |
| @@ -660,6 +672,16 @@ |
| if (!ShareHandleToSelLdr(data.handle, irt_file, false, ¶ms.handles)) |
| return false; |
| +#if defined(OS_POSIX) |
| + if (enable_debug_stub_) { |
|
Mark Seaborn
2012/09/10 15:39:45
Nit: can you put this after the Mac shared memory
halyavin
2012/09/11 11:16:12
Done.
|
| + SocketDescriptor server_socket = GetDebugStubSocketHandle(); |
| + if (server_socket != net::TCPListenSocket::kInvalidSocket) { |
| + params.debug_stub_server_socket = |
| + nacl::FileDescriptor(server_socket, true); |
| + } |
| + } |
| +#endif |
| + |
| #if defined(OS_MACOSX) |
| // For dynamic loading support, NaCl requires a file descriptor that |
| // was created in /tmp, since those created with shm_open() are not |