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

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

Issue 11236025: Test that debug stub works with browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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
« no previous file with comments | « chrome/browser/nacl_host/nacl_browser.cc ('k') | chrome/browser/nacl_host/test/debug_stub_browser_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,27 @@
#if defined(OS_POSIX)
SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() {
- SocketDescriptor s = net::TCPListenSocket::CreateAndBind("127.0.0.1",
- kDebugStubPort);
+ NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
+ SocketDescriptor s;
+ // We allocate currently unused TCP port for debug stub tests. The port
+ // number is passed to the test via debug stub port listener.
+ if (nacl_browser->HasGdbDebugStubPortListener()) {
+ int port;
+ s = net::TCPListenSocket::CreateAndBindAnyPort("127.0.0.1", &port);
+ if (s != net::TCPListenSocket::kInvalidSocket) {
+ nacl_browser->FireGdbDebugStubPortOpened(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";
+ if (HANDLE_EINTR(close(s)) < 0)
+ PLOG(ERROR) << "failed to close debug stub socket";
return net::TCPListenSocket::kInvalidSocket;
}
return s;
« no previous file with comments | « chrome/browser/nacl_host/nacl_browser.cc ('k') | chrome/browser/nacl_host/test/debug_stub_browser_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698