Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(916)

Unified Diff: chrome/browser/devtools/device/usb/android_usb_device.cc

Issue 297853003: Use IOBufferWithSize instead of storing IOBuffer and size separately. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/devtools/device/usb/android_usb_device.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/device/usb/android_usb_device.cc
diff --git a/chrome/browser/devtools/device/usb/android_usb_device.cc b/chrome/browser/devtools/device/usb/android_usb_device.cc
index 0d6c2bdb84c9d46d0e5b338050b3e5d1dd358cfc..fd40fadec07c42c22ec33f83f23d62f1a2c467c0 100644
--- a/chrome/browser/devtools/device/usb/android_usb_device.cc
+++ b/chrome/browser/devtools/device/usb/android_usb_device.cc
@@ -400,20 +400,22 @@ void AndroidUsbDevice::Queue(scoped_refptr<AdbMessage> message) {
header.push_back(body_length);
header.push_back(Checksum(message->body));
header.push_back(message->command ^ 0xffffffff);
- scoped_refptr<net::IOBuffer> header_buffer = new net::IOBuffer(kHeaderSize);
+ scoped_refptr<net::IOBufferWithSize> header_buffer =
+ new net::IOBufferWithSize(kHeaderSize);
memcpy(header_buffer.get()->data(), &header[0], kHeaderSize);
- outgoing_queue_.push(std::make_pair(header_buffer, kHeaderSize));
+ outgoing_queue_.push(header_buffer);
// Queue body.
if (!message->body.empty()) {
- scoped_refptr<net::IOBuffer> body_buffer = new net::IOBuffer(body_length);
+ scoped_refptr<net::IOBufferWithSize> body_buffer =
+ new net::IOBufferWithSize(body_length);
memcpy(body_buffer->data(), message->body.data(), message->body.length());
if (append_zero)
body_buffer->data()[body_length - 1] = 0;
- outgoing_queue_.push(std::make_pair(body_buffer, body_length));
+ outgoing_queue_.push(body_buffer);
if (zero_mask_ && (body_length & zero_mask_) == 0) {
// Send a zero length packet.
- outgoing_queue_.push(std::make_pair(body_buffer, 0));
+ outgoing_queue_.push(new net::IOBufferWithSize(0));
}
}
ProcessOutgoing();
@@ -427,10 +429,10 @@ void AndroidUsbDevice::ProcessOutgoing() {
BulkMessage message = outgoing_queue_.front();
outgoing_queue_.pop();
- DumpMessage(true, message.first->data(), message.second);
+ DumpMessage(true, message->data(), message->size());
usb_handle_->BulkTransfer(
usb_service::USB_DIRECTION_OUTBOUND, outbound_address_,
- message.first, message.second, kUsbTimeout,
+ message, message->size(), kUsbTimeout,
base::Bind(&AndroidUsbDevice::OutgoingMessageSent,
weak_factory_.GetWeakPtr()));
}
« no previous file with comments | « chrome/browser/devtools/device/usb/android_usb_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698