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/usb/android_usb_socket.h" | 5 #include "chrome/browser/devtools/device/usb/android_usb_socket.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "net/base/io_buffer.h" |
12 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 const int kMaxPayload = 4096; | 17 const int kMaxPayload = 4096; |
17 | 18 |
18 } // namespace | 19 } // namespace |
19 | 20 |
20 AndroidUsbSocket::AndroidUsbSocket(scoped_refptr<AndroidUsbDevice> device, | 21 AndroidUsbSocket::AndroidUsbSocket(scoped_refptr<AndroidUsbDevice> device, |
21 uint32_t socket_id, | 22 uint32_t socket_id, |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 read_buffer_ = read_buffer_.substr(bytes_to_copy); | 258 read_buffer_ = read_buffer_.substr(bytes_to_copy); |
258 else | 259 else |
259 read_buffer_ = std::string(); | 260 read_buffer_ = std::string(); |
260 base::ResetAndReturn(&read_callback_).Run(bytes_to_copy); | 261 base::ResetAndReturn(&read_callback_).Run(bytes_to_copy); |
261 } | 262 } |
262 | 263 |
263 void AndroidUsbSocket::RespondToWriter(int result) { | 264 void AndroidUsbSocket::RespondToWriter(int result) { |
264 if (!write_callback_.is_null()) | 265 if (!write_callback_.is_null()) |
265 base::ResetAndReturn(&write_callback_).Run(result); | 266 base::ResetAndReturn(&write_callback_).Run(result); |
266 } | 267 } |
OLD | NEW |