Chromium Code Reviews| Index: components/nacl/browser/nacl_process_host.cc |
| diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc |
| index 2d154f38d986a846756618da10884de75f8dd870..c5fe4e48c295846fcaf664c8b4c902483889ed86 100644 |
| --- a/components/nacl/browser/nacl_process_host.cc |
| +++ b/components/nacl/browser/nacl_process_host.cc |
| @@ -664,7 +664,7 @@ void NaClProcessHost::SendMessageToRenderer( |
| } |
| // TCP port we chose for NaCl debug stub. It can be any other number. |
| -static const int kDebugStubPort = 4014; |
| +static const int kInitialDebugStubPort = 4014; |
| #if defined(OS_POSIX) |
| net::SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { |
| @@ -672,15 +672,17 @@ net::SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { |
| net::SocketDescriptor s = net::kInvalidSocket; |
| // We allocate currently unused TCP port for debug stub tests. The port |
|
noelallen_use_chromium
2013/12/20 01:00:28
Update comment.
We always try to allocate the def
bradn
2013/12/20 01:25:35
Done.
|
| // number is passed to the test via debug stub port listener. |
| - if (nacl_browser->HasGdbDebugStubPortListener()) { |
| - int port; |
| + int port = kInitialDebugStubPort; |
| + s = net::TCPListenSocket::CreateAndBind("127.0.0.1", port); |
| + if (s == net::kInvalidSocket) { |
| s = net::TCPListenSocket::CreateAndBindAnyPort("127.0.0.1", &port); |
| - if (s != net::kInvalidSocket) { |
| + } |
| + if (s != net::kInvalidSocket) { |
| + if (nacl_browser->HasGdbDebugStubPortListener()) { |
| nacl_browser->FireGdbDebugStubPortOpened(port); |
| } |
| - } else { |
| - s = net::TCPListenSocket::CreateAndBind("127.0.0.1", kDebugStubPort); |
| } |
| + process_->SetNaClDebugStubPort(port); |
| if (s == net::kInvalidSocket) { |
| LOG(ERROR) << "failed to open socket for debug stub"; |
|
noelallen_use_chromium
2013/12/20 01:00:28
print port number?
bradn
2013/12/20 01:25:35
Done.
|
| return net::kInvalidSocket; |