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

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: rebase Created 8 years, 2 months 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
Index: chrome/browser/nacl_host/nacl_process_host.cc
===================================================================
--- chrome/browser/nacl_host/nacl_process_host.cc (revision 163266)
+++ chrome/browser/nacl_host/nacl_process_host.cc (working copy)
@@ -656,10 +656,26 @@
#if defined(OS_POSIX)
SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() {
- SocketDescriptor s = net::TCPListenSocket::CreateAndBind("127.0.0.1",
- kDebugStubPort);
+ NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
Mark Seaborn 2012/10/23 01:14:50 Instead of adding HasDebugStubPortListener() etc.,
halyavin 2012/10/23 11:59:29 Test lives in an object. A function can't call an
Mark Seaborn 2012/12/04 21:46:42 NaClBrowser::GetInstance() returns a global single
+ SocketDescriptor s;
+ LOG(INFO) << "Create debug stub socket";
+ if (nacl_browser->HasDebugStubPortListener()) {
+ LOG(INFO) << "allocate ephemeral port";
Mark Seaborn 2012/10/23 01:14:50 These are too many LOG(INFO)s to commit.
halyavin 2012/10/23 11:59:29 I inserted them for debugging and forgot to remove
+ s = net::TCPListenSocket::CreateAndBind("127.0.0.1", 0);
+ int port = net::TCPListenSocket::GetBindedPort(s);
+ LOG(INFO) << "port number=" << port;
+ if (port < 0) {
+ LOG(ERROR) << "failed to open ephemeral server port for debug stub";
+ close(s);
+ return net::TCPListenSocket::kInvalidSocket;
+ }
+ nacl_browser->DebugStubNewPortAllocated(port);
+ } else {
+ s = net::TCPListenSocket::CreateAndBind("127.0.0.1", kDebugStubPort);
+ }
if (listen(s, 1)) {
LOG(ERROR) << "listen() failed on debug stub socket";
+ close(s);
Mark Seaborn 2012/10/23 01:14:50 This is fixing an existing leak, right? A separat
halyavin 2012/10/23 11:59:29 Done.
return net::TCPListenSocket::kInvalidSocket;
}
return s;

Powered by Google App Engine
This is Rietveld 408576698