 Chromium Code Reviews
 Chromium Code Reviews Issue 11236025:
  Test that debug stub works with browser.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/
    
  
    Issue 11236025:
  Test that debug stub works with browser.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/| Index: chrome/browser/nacl_host/nacl_process_host.cc | 
| =================================================================== | 
| --- chrome/browser/nacl_host/nacl_process_host.cc (revision 170891) | 
| +++ chrome/browser/nacl_host/nacl_process_host.cc (working copy) | 
| @@ -662,10 +662,24 @@ | 
| #if defined(OS_POSIX) | 
| SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { | 
| - SocketDescriptor s = net::TCPListenSocket::CreateAndBind("127.0.0.1", | 
| - kDebugStubPort); | 
| + NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); | 
| + SocketDescriptor s; | 
| + if (nacl_browser->HasDebugStubPortListener()) { | 
| 
Mark Seaborn
2012/12/04 21:46:42
Please add a comment to explain that this code pat
 
halyavin
2012/12/05 10:05:57
Done.
 | 
| + int port; | 
| + s = net::TCPListenSocket::CreateAndBindAnyPort("127.0.0.1", &port); | 
| + if (s != net::TCPListenSocket::kInvalidSocket) { | 
| + nacl_browser->DebugStubNewPortAllocated(port); | 
| + } | 
| + } else { | 
| + s = net::TCPListenSocket::CreateAndBind("127.0.0.1", kDebugStubPort); | 
| + } | 
| + if (s == net::TCPListenSocket::kInvalidSocket) { | 
| + LOG(ERROR) << "failed to open socket for debug stub"; | 
| + return net::TCPListenSocket::kInvalidSocket; | 
| + } | 
| if (listen(s, 1)) { | 
| LOG(ERROR) << "listen() failed on debug stub socket"; | 
| + close(s); | 
| 
Mark Seaborn
2012/12/04 21:46:42
Please CHECK that close() doesn't return an error
 
halyavin
2012/12/05 10:05:57
I don't think we should kill release browser for t
 
Mark Seaborn
2012/12/05 18:00:47
I disagree.  EBADF from close() indicates a progra
 | 
| return net::TCPListenSocket::kInvalidSocket; | 
| } | 
| return s; |