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

Unified Diff: chrome/browser/extensions/api/usb/usb_api.cc

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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/extensions/api/tabs/tabs_api.cc ('k') | chrome/browser/extensions/api/usb/usb_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/usb/usb_api.cc
diff --git a/chrome/browser/extensions/api/usb/usb_api.cc b/chrome/browser/extensions/api/usb/usb_api.cc
index a1da7ba987c7b79fe92311995c715764442fb8b8..453f8940205f2e2456eb2c736e4b67e0f5996ac5 100644
--- a/chrome/browser/extensions/api/usb/usb_api.cc
+++ b/chrome/browser/extensions/api/usb/usb_api.cc
@@ -450,9 +450,9 @@ void UsbFindDevicesFunction::AsyncWorkStart() {
void UsbFindDevicesFunction::OnCompleted() {
for (size_t i = 0; i < devices_.size(); ++i) {
- UsbDevice* const device = devices_[i];
- UsbDeviceResource* const resource = new UsbDeviceResource(
- extension_->id(), device);
+ UsbDevice* const device = devices_[i].get();
+ UsbDeviceResource* const resource =
+ new UsbDeviceResource(extension_->id(), device);
Device js_device;
result_->Append(PopulateDevice(manager_->Add(resource),
@@ -483,8 +483,8 @@ void UsbListInterfacesFunction::AsyncWorkStart() {
}
config_ = new UsbConfigDescriptor();
- resource->device()->ListInterfaces(config_, base::Bind(
- &UsbListInterfacesFunction::OnCompleted, this));
+ resource->device()->ListInterfaces(
+ config_.get(), base::Bind(&UsbListInterfacesFunction::OnCompleted, this));
}
void UsbListInterfacesFunction::OnCompleted(bool success) {
@@ -743,13 +743,21 @@ void UsbControlTransferFunction::AsyncWorkStart() {
scoped_refptr<net::IOBuffer> buffer = CreateBufferForTransfer(
transfer, direction, size);
- if (!buffer) {
+ if (!buffer.get()) {
CompleteWithError(kErrorMalformedParameters);
return;
}
- resource->device()->ControlTransfer(direction, request_type, recipient,
- transfer.request, transfer.value, transfer.index, buffer, size, 0,
+ resource->device()->ControlTransfer(
+ direction,
+ request_type,
+ recipient,
+ transfer.request,
+ transfer.value,
+ transfer.index,
+ buffer.get(),
+ size,
+ 0,
base::Bind(&UsbControlTransferFunction::OnCompleted, this));
}
@@ -788,13 +796,18 @@ void UsbBulkTransferFunction::AsyncWorkStart() {
scoped_refptr<net::IOBuffer> buffer = CreateBufferForTransfer(
transfer, direction, size);
- if (!buffer) {
+ if (!buffer.get()) {
CompleteWithError(kErrorMalformedParameters);
return;
}
- resource->device()->BulkTransfer(direction, transfer.endpoint,
- buffer, size, 0, base::Bind(&UsbBulkTransferFunction::OnCompleted, this));
+ resource->device()
+ ->BulkTransfer(direction,
+ transfer.endpoint,
+ buffer.get(),
+ size,
+ 0,
+ base::Bind(&UsbBulkTransferFunction::OnCompleted, this));
}
UsbInterruptTransferFunction::UsbInterruptTransferFunction() {}
@@ -832,13 +845,18 @@ void UsbInterruptTransferFunction::AsyncWorkStart() {
scoped_refptr<net::IOBuffer> buffer = CreateBufferForTransfer(
transfer, direction, size);
- if (!buffer) {
+ if (!buffer.get()) {
CompleteWithError(kErrorMalformedParameters);
return;
}
- resource->device()->InterruptTransfer(direction, transfer.endpoint, buffer,
- size, 0, base::Bind(&UsbInterruptTransferFunction::OnCompleted, this));
+ resource->device()->InterruptTransfer(
+ direction,
+ transfer.endpoint,
+ buffer.get(),
+ size,
+ 0,
+ base::Bind(&UsbInterruptTransferFunction::OnCompleted, this));
}
UsbIsochronousTransferFunction::UsbIsochronousTransferFunction() {}
@@ -892,14 +910,20 @@ void UsbIsochronousTransferFunction::AsyncWorkStart() {
scoped_refptr<net::IOBuffer> buffer = CreateBufferForTransfer(
generic_transfer, direction, size);
- if (!buffer) {
+ if (!buffer.get()) {
CompleteWithError(kErrorMalformedParameters);
return;
}
- resource->device()->IsochronousTransfer(direction, generic_transfer.endpoint,
- buffer, size, packets, packet_length, 0, base::Bind(
- &UsbIsochronousTransferFunction::OnCompleted, this));
+ resource->device()->IsochronousTransfer(
+ direction,
+ generic_transfer.endpoint,
+ buffer.get(),
+ size,
+ packets,
+ packet_length,
+ 0,
+ base::Bind(&UsbIsochronousTransferFunction::OnCompleted, this));
}
UsbResetDeviceFunction::UsbResetDeviceFunction() {}
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs_api.cc ('k') | chrome/browser/extensions/api/usb/usb_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698