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

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 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 reply_msg_ = NULL; 655 reply_msg_ = NULL;
656 internal_->sockets_for_renderer.clear(); 656 internal_->sockets_for_renderer.clear();
657 return true; 657 return true;
658 } 658 }
659 659
660 // TCP port we chose for NaCl debug stub. It can be any other number. 660 // TCP port we chose for NaCl debug stub. It can be any other number.
661 static const int kDebugStubPort = 4014; 661 static const int kDebugStubPort = 4014;
662 662
663 #if defined(OS_POSIX) 663 #if defined(OS_POSIX)
664 SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { 664 SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() {
665 SocketDescriptor s = net::TCPListenSocket::CreateAndBind("127.0.0.1", 665 NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
666 kDebugStubPort); 666 SocketDescriptor s;
667 if (nacl_browser->HasDebugStubPortListener()) {
Mark Seaborn 2012/12/04 21:46:42 Please add a comment to explain that this code pat
halyavin 2012/12/05 10:05:57 Done.
668 int port;
669 s = net::TCPListenSocket::CreateAndBindAnyPort("127.0.0.1", &port);
670 if (s != net::TCPListenSocket::kInvalidSocket) {
671 nacl_browser->DebugStubNewPortAllocated(port);
672 }
673 } else {
674 s = net::TCPListenSocket::CreateAndBind("127.0.0.1", kDebugStubPort);
675 }
676 if (s == net::TCPListenSocket::kInvalidSocket) {
677 LOG(ERROR) << "failed to open socket for debug stub";
678 return net::TCPListenSocket::kInvalidSocket;
679 }
667 if (listen(s, 1)) { 680 if (listen(s, 1)) {
668 LOG(ERROR) << "listen() failed on debug stub socket"; 681 LOG(ERROR) << "listen() failed on debug stub socket";
682 close(s);
Mark Seaborn 2012/12/04 21:46:42 Please CHECK that close() doesn't return an error
halyavin 2012/12/05 10:05:57 I don't think we should kill release browser for t
Mark Seaborn 2012/12/05 18:00:47 I disagree. EBADF from close() indicates a progra
669 return net::TCPListenSocket::kInvalidSocket; 683 return net::TCPListenSocket::kInvalidSocket;
670 } 684 }
671 return s; 685 return s;
672 } 686 }
673 #endif 687 #endif
674 688
675 bool NaClProcessHost::StartNaClExecution() { 689 bool NaClProcessHost::StartNaClExecution() {
676 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); 690 NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
677 691
678 nacl::NaClStartParams params; 692 nacl::NaClStartParams params;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } else { 913 } else {
900 NaClStartDebugExceptionHandlerThread( 914 NaClStartDebugExceptionHandlerThread(
901 process_handle.Take(), info, 915 process_handle.Take(), info,
902 base::MessageLoopProxy::current(), 916 base::MessageLoopProxy::current(),
903 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 917 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
904 weak_factory_.GetWeakPtr())); 918 weak_factory_.GetWeakPtr()));
905 return true; 919 return true;
906 } 920 }
907 } 921 }
908 #endif 922 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698