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/tcp_device_provider.h" | 5 #include "chrome/browser/devtools/device/tcp_device_provider.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 public: | 33 public: |
34 ResolveHostAndOpenSocket(const net::HostPortPair& address, | 34 ResolveHostAndOpenSocket(const net::HostPortPair& address, |
35 const AdbClientSocket::SocketCallback& callback) | 35 const AdbClientSocket::SocketCallback& callback) |
36 : callback_(callback) { | 36 : callback_(callback) { |
37 host_resolver_ = net::HostResolver::CreateDefaultResolver(nullptr); | 37 host_resolver_ = net::HostResolver::CreateDefaultResolver(nullptr); |
38 net::HostResolver::RequestInfo request_info(address); | 38 net::HostResolver::RequestInfo request_info(address); |
39 int result = host_resolver_->Resolve( | 39 int result = host_resolver_->Resolve( |
40 request_info, net::DEFAULT_PRIORITY, &address_list_, | 40 request_info, net::DEFAULT_PRIORITY, &address_list_, |
41 base::Bind(&ResolveHostAndOpenSocket::OnResolved, | 41 base::Bind(&ResolveHostAndOpenSocket::OnResolved, |
42 base::Unretained(this)), | 42 base::Unretained(this)), |
43 &request_, net::BoundNetLog()); | 43 &request_, net::NetLogWithSource()); |
44 if (result != net::ERR_IO_PENDING) | 44 if (result != net::ERR_IO_PENDING) |
45 OnResolved(result); | 45 OnResolved(result); |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 void OnResolved(int result) { | 49 void OnResolved(int result) { |
50 if (result < 0) { | 50 if (result < 0) { |
51 RunSocketCallback(callback_, nullptr, result); | 51 RunSocketCallback(callback_, nullptr, result); |
52 delete this; | 52 delete this; |
53 return; | 53 return; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 release_callback_.Run(); | 126 release_callback_.Run(); |
127 } | 127 } |
128 | 128 |
129 void TCPDeviceProvider::set_release_callback_for_test( | 129 void TCPDeviceProvider::set_release_callback_for_test( |
130 const base::Closure& callback) { | 130 const base::Closure& callback) { |
131 release_callback_ = callback; | 131 release_callback_ = callback; |
132 } | 132 } |
133 | 133 |
134 TCPDeviceProvider::~TCPDeviceProvider() { | 134 TCPDeviceProvider::~TCPDeviceProvider() { |
135 } | 135 } |
OLD | NEW |