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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/nacl_host/nacl_process_host.h" 5 #include "chrome/browser/nacl_host/nacl_process_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 reply_msg_ = NULL; 649 reply_msg_ = NULL;
650 internal_->sockets_for_renderer.clear(); 650 internal_->sockets_for_renderer.clear();
651 return true; 651 return true;
652 } 652 }
653 653
654 // TCP port we chose for NaCl debug stub. It can be any other number. 654 // TCP port we chose for NaCl debug stub. It can be any other number.
655 static const int kDebugStubPort = 4014; 655 static const int kDebugStubPort = 4014;
656 656
657 #if defined(OS_POSIX) 657 #if defined(OS_POSIX)
658 SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { 658 SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() {
659 SocketDescriptor s = net::TCPListenSocket::CreateAndBind("127.0.0.1", 659 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
660 kDebugStubPort); 660 SocketDescriptor s;
661 LOG(INFO) << "Create debug stub socket";
662 if (nacl_browser->HasDebugStubPortListener()) {
663 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
664 s = net::TCPListenSocket::CreateAndBind("127.0.0.1", 0);
665 int port = net::TCPListenSocket::GetBindedPort(s);
666 LOG(INFO) << "port number=" << port;
667 if (port < 0) {
668 LOG(ERROR) << "failed to open ephemeral server port for debug stub";
669 close(s);
670 return net::TCPListenSocket::kInvalidSocket;
671 }
672 nacl_browser->DebugStubNewPortAllocated(port);
673 } else {
674 s = net::TCPListenSocket::CreateAndBind("127.0.0.1", kDebugStubPort);
675 }
661 if (listen(s, 1)) { 676 if (listen(s, 1)) {
662 LOG(ERROR) << "listen() failed on debug stub socket"; 677 LOG(ERROR) << "listen() failed on debug stub socket";
678 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.
663 return net::TCPListenSocket::kInvalidSocket; 679 return net::TCPListenSocket::kInvalidSocket;
664 } 680 }
665 return s; 681 return s;
666 } 682 }
667 #endif 683 #endif
668 684
669 bool NaClProcessHost::StartNaClExecution() { 685 bool NaClProcessHost::StartNaClExecution() {
670 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); 686 NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
671 687
672 nacl::NaClStartParams params; 688 nacl::NaClStartParams params;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 } else { 903 } else {
888 NaClStartDebugExceptionHandlerThread( 904 NaClStartDebugExceptionHandlerThread(
889 process_handle.Take(), info, 905 process_handle.Take(), info,
890 base::MessageLoopProxy::current(), 906 base::MessageLoopProxy::current(),
891 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 907 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
892 weak_factory_.GetWeakPtr())); 908 weak_factory_.GetWeakPtr()));
893 return true; 909 return true;
894 } 910 }
895 } 911 }
896 #endif 912 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698