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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 if (result != net::ERR_IO_PENDING) | 77 if (result != net::ERR_IO_PENDING) |
78 OnResolved(result); | 78 OnResolved(result); |
79 } | 79 } |
80 | 80 |
81 void OnResolved(int result) { | 81 void OnResolved(int result) { |
82 if (result < 0) { | 82 if (result < 0) { |
83 SelfDestruct(); | 83 SelfDestruct(); |
84 return; | 84 return; |
85 } | 85 } |
86 | 86 |
87 host_socket_.reset(new net::TCPClientSocket(address_list_, nullptr, | 87 host_socket_.reset(new net::TCPClientSocket(address_list_, nullptr, nullptr, |
88 net::NetLog::Source())); | 88 net::NetLog::Source())); |
89 result = host_socket_->Connect(base::Bind(&SocketTunnel::OnConnected, | 89 result = host_socket_->Connect(base::Bind(&SocketTunnel::OnConnected, |
90 base::Unretained(this))); | 90 base::Unretained(this))); |
91 if (result != net::ERR_IO_PENDING) | 91 if (result != net::ERR_IO_PENDING) |
92 OnConnected(result); | 92 OnConnected(result); |
93 } | 93 } |
94 | 94 |
95 void OnConnected(int result) { | 95 void OnConnected(int result) { |
96 if (result < 0) { | 96 if (result < 0) { |
97 SelfDestruct(); | 97 SelfDestruct(); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 registry_copy.push_back(it->second); | 493 registry_copy.push_back(it->second); |
494 } | 494 } |
495 STLDeleteElements(®istry_copy); | 495 STLDeleteElements(®istry_copy); |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 void PortForwardingController::UpdateConnections() { | 499 void PortForwardingController::UpdateConnections() { |
500 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it) | 500 for (Registry::iterator it = registry_.begin(); it != registry_.end(); ++it) |
501 it->second->UpdateForwardingMap(forwarding_map_); | 501 it->second->UpdateForwardingMap(forwarding_map_); |
502 } | 502 } |
OLD | NEW |