OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/device/port_forwarding_controller.h" | 5 #include "chrome/browser/devtools/device/port_forwarding_controller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (result != net::ERR_IO_PENDING) | 76 if (result != net::ERR_IO_PENDING) |
77 OnResolved(result); | 77 OnResolved(result); |
78 } | 78 } |
79 | 79 |
80 void OnResolved(int result) { | 80 void OnResolved(int result) { |
81 if (result < 0) { | 81 if (result < 0) { |
82 SelfDestruct(); | 82 SelfDestruct(); |
83 return; | 83 return; |
84 } | 84 } |
85 | 85 |
86 host_socket_.reset(new net::TCPClientSocket(address_list_, nullptr, | 86 host_socket_.reset(new net::TCPClientSocket(address_list_, nullptr, nullptr, |
87 net::NetLog::Source())); | 87 net::NetLog::Source())); |
88 result = host_socket_->Connect(base::Bind(&SocketTunnel::OnConnected, | 88 result = host_socket_->Connect(base::Bind(&SocketTunnel::OnConnected, |
89 base::Unretained(this))); | 89 base::Unretained(this))); |
90 if (result != net::ERR_IO_PENDING) | 90 if (result != net::ERR_IO_PENDING) |
91 OnConnected(result); | 91 OnConnected(result); |
92 } | 92 } |
93 | 93 |
94 void OnConnected(int result) { | 94 void OnConnected(int result) { |
95 if (result < 0) { | 95 if (result < 0) { |
96 SelfDestruct(); | 96 SelfDestruct(); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 registry_copy.push_back(it->second); | 492 registry_copy.push_back(it->second); |
493 } | 493 } |
494 STLDeleteElements(®istry_copy); | 494 STLDeleteElements(®istry_copy); |
495 } | 495 } |
496 } | 496 } |
497 | 497 |
498 void PortForwardingController::UpdateConnections() { | 498 void PortForwardingController::UpdateConnections() { |
499 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it) | 499 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it) |
500 it->second->UpdateForwardingMap(forwarding_map_); | 500 it->second->UpdateForwardingMap(forwarding_map_); |
501 } | 501 } |
OLD | NEW |