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 f3c91a97ea7c22ca5bd137ac29c1e7bc11e06adf..988cff3b18ccdd1fc097d4ec74fe5e3cb02bed14 100644 |
--- a/components/nacl/browser/nacl_process_host.cc |
+++ b/components/nacl/browser/nacl_process_host.cc |
@@ -646,6 +646,8 @@ bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { |
#endif |
IPC_MESSAGE_HANDLER(NaClProcessHostMsg_PpapiChannelsCreated, |
OnPpapiChannelsCreated) |
+ IPC_MESSAGE_HANDLER(NaClProcessHostMsg_DebugStubPortSelected, |
Mark Seaborn
2014/05/08 15:52:23
FYI, this needs rebasing. I changed this method y
bradn
2014/05/08 17:00:24
Done.
|
+ OnDebugStubPortSelected) |
IPC_MESSAGE_UNHANDLED(handled = false) |
IPC_END_MESSAGE_MAP() |
return handled; |
@@ -746,9 +748,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(uint16_t 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. |
@@ -760,12 +770,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; |
@@ -926,6 +932,10 @@ void NaClProcessHost::OnPpapiChannelsCreated( |
} |
} |
+void NaClProcessHost::OnDebugStubPortSelected(uint16_t debug_stub_port) { |
+ ChangeDebugStubPort(debug_stub_port); |
Mark Seaborn
2014/05/08 15:52:23
Can you add: CHECK(!uses_nonsfi_mode_) to make thi
bradn
2014/05/08 17:00:24
Done.
|
+} |
+ |
bool NaClProcessHost::StartWithLaunchedProcess() { |
NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); |