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/adb/adb_client_socket.h" | 5 #include "chrome/browser/devtools/device/adb/adb_client_socket.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 | 174 |
175 void AdbClientSocket::Connect(const net::CompletionCallback& callback) { | 175 void AdbClientSocket::Connect(const net::CompletionCallback& callback) { |
176 net::IPAddressNumber ip_number; | 176 net::IPAddressNumber ip_number; |
177 if (!net::ParseIPLiteralToNumber(host_, &ip_number)) { | 177 if (!net::ParseIPLiteralToNumber(host_, &ip_number)) { |
178 callback.Run(net::ERR_FAILED); | 178 callback.Run(net::ERR_FAILED); |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 net::AddressList address_list = | 182 net::AddressList address_list = |
183 net::AddressList::CreateFromIPAddress(ip_number, port_); | 183 net::AddressList::CreateFromIPAddress(ip_number, port_); |
184 socket_.reset(new net::TCPClientSocket(address_list, NULL, | 184 socket_.reset(new net::TCPClientSocket(address_list, NULL, NULL, |
bengr
2016/02/08 18:51:14
There aren't a lot of uses of NULL in this file so
tbansal1
2016/02/08 21:33:26
This CL is already huge :(. So, I would prefer not
bengr
2016/02/08 23:42:06
Acknowledged.
| |
185 net::NetLog::Source())); | 185 net::NetLog::Source())); |
bengr
2016/02/08 18:51:14
Also, /* inline comments */ would be helpful next
tbansal1
2016/02/08 21:33:26
I think inline comments are discouraged in Chromiu
bengr
2016/02/08 23:42:06
I've seen it both ways in Chromium, but I'll defer
tbansal1
2016/02/09 17:11:22
Acknowledged.
| |
186 int result = socket_->Connect(callback); | 186 int result = socket_->Connect(callback); |
187 if (result != net::ERR_IO_PENDING) | 187 if (result != net::ERR_IO_PENDING) |
188 callback.Run(result); | 188 callback.Run(result); |
189 } | 189 } |
190 | 190 |
191 void AdbClientSocket::SendCommand(const std::string& command, | 191 void AdbClientSocket::SendCommand(const std::string& command, |
192 bool is_void, | 192 bool is_void, |
193 const CommandCallback& callback) { | 193 const CommandCallback& callback) { |
194 scoped_refptr<net::StringIOBuffer> request_buffer = | 194 scoped_refptr<net::StringIOBuffer> request_buffer = |
195 new net::StringIOBuffer(EncodeMessage(command)); | 195 new net::StringIOBuffer(EncodeMessage(command)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 base::Unretained(this), | 292 base::Unretained(this), |
293 callback, | 293 callback, |
294 new_response, | 294 new_response, |
295 response_buffer, | 295 response_buffer, |
296 bytes_left)); | 296 bytes_left)); |
297 if (result > 0) | 297 if (result > 0) |
298 OnResponseData(callback, new_response, response_buffer, bytes_left, result); | 298 OnResponseData(callback, new_response, response_buffer, bytes_left, result); |
299 else if (result != net::ERR_IO_PENDING) | 299 else if (result != net::ERR_IO_PENDING) |
300 callback.Run(net::OK, new_response); | 300 callback.Run(net::OK, new_response); |
301 } | 301 } |
OLD | NEW |