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

Unified Diff: device/usb/usb_device_handle.h

Issue 980023002: Move device/usb classes from the FILE thread to UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
Index: device/usb/usb_device_handle.h
diff --git a/device/usb/usb_device_handle.h b/device/usb/usb_device_handle.h
index 7098d6809ee8a1eb47845b23432c7e901c9e413b..a4ef90465709d6c26d0748566e61045af7b763eb 100644
--- a/device/usb/usb_device_handle.h
+++ b/device/usb/usb_device_handle.h
@@ -30,6 +30,7 @@ enum UsbTransferStatus {
USB_TRANSFER_LENGTH_SHORT,
};
+typedef base::Callback<void(bool)> UsbSuccessCallback;
Ken Rockot(use gerrit already) 2015/04/07 22:09:43 name nit: Maybe UsbResultCallback? SuccessCallback
Reilly Grant (use Gerrit) 2015/04/08 21:39:03 Done.
typedef base::Callback<
void(UsbTransferStatus, scoped_refptr<net::IOBuffer>, size_t)>
UsbTransferCallback;
@@ -49,20 +50,18 @@ class UsbDeviceHandle : public base::RefCountedThreadSafe<UsbDeviceHandle> {
// The platform device handle will be closed when UsbDeviceHandle destructs.
virtual void Close() = 0;
- // Device manipulation operations. These methods are blocking and must be
- // called on FILE thread.
- virtual bool SetConfiguration(int configuration_value) = 0;
- virtual bool ClaimInterface(int interface_number) = 0;
+ // Device manipulation operations.
+ virtual void SetConfiguration(int configuration_value,
+ const UsbSuccessCallback& callback) = 0;
+ virtual void ClaimInterface(int interface_number,
+ const UsbSuccessCallback& callback) = 0;
virtual bool ReleaseInterface(int interface_number) = 0;
- virtual bool SetInterfaceAlternateSetting(int interface_number,
- int alternate_setting) = 0;
- virtual bool ResetDevice() = 0;
+ virtual void SetInterfaceAlternateSetting(
+ int interface_number,
+ int alternate_setting,
+ const UsbSuccessCallback& callback) = 0;
+ virtual void ResetDevice(const UsbSuccessCallback& callback) = 0;
- // Gets the string descriptor with the given index from the device, or returns
- // false. This method is blocking and must be called on the FILE thread.
- virtual bool GetStringDescriptor(uint8 string_id, base::string16* string) = 0;
-
- // Async IO. Can be called on any thread.
virtual void ControlTransfer(UsbEndpointDirection direction,
TransferRequestType request_type,
TransferRecipient recipient,

Powered by Google App Engine
This is Rietveld 408576698