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

Side by Side Diff: components/nacl/browser/nacl_process_host.cc

Issue 655063002: Use uint16 for port numbers more pervasively. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert bad change Created 6 years, 1 month 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
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 "components/nacl/browser/nacl_process_host.h" 5 #include "components/nacl/browser/nacl_process_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 } 750 }
751 } 751 }
752 752
753 void NaClProcessHost::SetDebugStubPort(int port) { 753 void NaClProcessHost::SetDebugStubPort(int port) {
754 NaClBrowser* nacl_browser = NaClBrowser::GetInstance(); 754 NaClBrowser* nacl_browser = NaClBrowser::GetInstance();
755 nacl_browser->SetProcessGdbDebugStubPort(process_->GetData().id, port); 755 nacl_browser->SetProcessGdbDebugStubPort(process_->GetData().id, port);
756 } 756 }
757 757
758 #if defined(OS_POSIX) 758 #if defined(OS_POSIX)
759 // TCP port we chose for NaCl debug stub. It can be any other number. 759 // TCP port we chose for NaCl debug stub. It can be any other number.
760 static const int kInitialDebugStubPort = 4014; 760 static const uint16_t kInitialDebugStubPort = 4014;
761 761
762 net::SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() { 762 net::SocketDescriptor NaClProcessHost::GetDebugStubSocketHandle() {
763 net::SocketDescriptor s = net::kInvalidSocket; 763 net::SocketDescriptor s = net::kInvalidSocket;
764 // We always try to allocate the default port first. If this fails, we then 764 // We always try to allocate the default port first. If this fails, we then
765 // allocate any available port. 765 // allocate any available port.
766 // On success, if the test system has register a handler 766 // On success, if the test system has register a handler
767 // (GdbDebugStubPortListener), we fire a notification. 767 // (GdbDebugStubPortListener), we fire a notification.
768 int port = kInitialDebugStubPort; 768 uint16 port = kInitialDebugStubPort;
769 s = net::TCPListenSocket::CreateAndBind("127.0.0.1", port); 769 s = net::TCPListenSocket::CreateAndBind("127.0.0.1", port);
770 if (s == net::kInvalidSocket) { 770 if (s == net::kInvalidSocket) {
771 s = net::TCPListenSocket::CreateAndBindAnyPort("127.0.0.1", &port); 771 s = net::TCPListenSocket::CreateAndBindAnyPort("127.0.0.1", &port);
772 } 772 }
773 if (s != net::kInvalidSocket) { 773 if (s != net::kInvalidSocket) {
774 SetDebugStubPort(port); 774 SetDebugStubPort(port);
775 } 775 }
776 if (s == net::kInvalidSocket) { 776 if (s == net::kInvalidSocket) {
777 LOG(ERROR) << "failed to open socket for debug stub"; 777 LOG(ERROR) << "failed to open socket for debug stub";
778 return net::kInvalidSocket; 778 return net::kInvalidSocket;
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 process_handle.Take(), info, 1186 process_handle.Take(), info,
1187 base::MessageLoopProxy::current(), 1187 base::MessageLoopProxy::current(),
1188 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1188 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1189 weak_factory_.GetWeakPtr())); 1189 weak_factory_.GetWeakPtr()));
1190 return true; 1190 return true;
1191 } 1191 }
1192 } 1192 }
1193 #endif 1193 #endif
1194 1194
1195 } // namespace nacl 1195 } // namespace nacl
OLDNEW
« no previous file with comments | « chromecast/browser/devtools/remote_debugging_server.cc ('k') | content/browser/devtools/devtools_http_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698