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

Unified Diff: chrome/browser/nacl_host/nacl_process_host.cc

Issue 10928050: Open socket for NaCl GDB debug stub in browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/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, &params.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

Powered by Google App Engine
This is Rietveld 408576698