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 23a76b571edce3d33f2f4491bc9706eefc03ad1e..a99ff3d7e197a8e5aeec7795123ec98e0a133e4b 100644 |
| --- a/components/nacl/browser/nacl_process_host.cc |
| +++ b/components/nacl/browser/nacl_process_host.cc |
| @@ -619,6 +619,8 @@ bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { |
| #endif |
| IPC_MESSAGE_HANDLER(NaClProcessHostMsg_PpapiChannelsCreated, |
| OnPpapiChannelsCreated) |
| + IPC_MESSAGE_HANDLER(NaClProcessHostMsg_DebugStubPortSelected, |
| + OnDebugStubPortSelected) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| return handled; |
| @@ -717,9 +719,17 @@ void NaClProcessHost::SendMessageToRenderer( |
| // TCP port we chose for NaCl debug stub. It can be any other number. |
| static const int kInitialDebugStubPort = 4014; |
| +void NaClProcessHost::ChangeDebugStubPort(int port) { |
| + NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |
| + if (nacl_browser->HasGdbDebugStubPortListener()) { |
| + nacl_browser->FireGdbDebugStubPortOpened(port); |
| + } |
| + // Set debug stub port on the process object. |
| + process_->SetNaClDebugStubPort(port); |
| +} |
| + |
| #if defined(OS_POSIX) |
| net::SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { |
| - NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |
| net::SocketDescriptor s = net::kInvalidSocket; |
| // We always try to allocate the default port first. If this fails, we then |
| // allocate any available port. |
| @@ -731,12 +741,8 @@ net::SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { |
| s = net::TCPListenSocket::CreateAndBindAnyPort("127.0.0.1", &port); |
| } |
| if (s != net::kInvalidSocket) { |
| - if (nacl_browser->HasGdbDebugStubPortListener()) { |
| - nacl_browser->FireGdbDebugStubPortOpened(port); |
| - } |
| + ChangeDebugStubPort(port); |
| } |
| - // Set debug stub port on the process object. |
| - process_->SetNaClDebugStubPort(port); |
| if (s == net::kInvalidSocket) { |
| LOG(ERROR) << "failed to open socket for debug stub"; |
| return net::kInvalidSocket; |
| @@ -904,6 +910,12 @@ void NaClProcessHost::OnPpapiChannelsCreated( |
| } |
| } |
| +// This method is called when NaClProcessHostMsg_OnDebugStubPortSelected is |
|
Mark Seaborn
2014/03/26 23:34:04
It's NaClProcessHostMsg_DebugStubPortSelected. No
bradn
2014/05/05 18:46:07
Dropped comment, but the name is this way for cons
|
| +// received. |
| +void NaClProcessHost::OnDebugStubPortSelected(uint16_t debug_stub_port) { |
| + ChangeDebugStubPort(debug_stub_port); |
| +} |
| + |
| bool NaClProcessHost::StartWithLaunchedProcess() { |
| NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |