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

Unified Diff: device/usb/webusb_descriptors.cc

Issue 2849893003: Shorten USB enumeration control transfer timeouts to 2 seconds (Closed)
Patch Set: Add units to the constant name Created 3 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
« no previous file with comments | « device/usb/usb_descriptors.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/webusb_descriptors.cc
diff --git a/device/usb/webusb_descriptors.cc b/device/usb/webusb_descriptors.cc
index e2ebc1497ded395e4e88d869467484514c61501f..3df67eb8b707719d273e6b6ee948a0f9bc72cbc2 100644
--- a/device/usb/webusb_descriptors.cc
+++ b/device/usb/webusb_descriptors.cc
@@ -45,7 +45,7 @@ const uint8_t kWebUsbCapabilityUUID[16] = {
0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47,
0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65};
-const int kControlTransferTimeout = 60000; // 1 minute
+const int kControlTransferTimeoutMs = 2000; // 2 seconds
using ReadWebUsbDescriptorsCallback =
base::Callback<void(std::unique_ptr<WebUsbAllowedOrigins> allowed_origins,
@@ -218,7 +218,7 @@ void ReadUrlDescriptor(scoped_refptr<UsbDeviceHandle> device_handle,
device_handle->ControlTransfer(
UsbTransferDirection::INBOUND, UsbControlTransferType::VENDOR,
UsbControlTransferRecipient::DEVICE, vendor_code, index, kGetUrlRequest,
- buffer, buffer->size(), kControlTransferTimeout,
+ buffer, buffer->size(), kControlTransferTimeoutMs,
base::Bind(&OnReadUrlDescriptor, url_map, index, callback));
}
@@ -301,7 +301,7 @@ void OnReadWebUsbAllowedOriginsHeader(
UsbTransferDirection::INBOUND, UsbControlTransferType::VENDOR,
UsbControlTransferRecipient::DEVICE, vendor_code, 0,
kGetAllowedOriginsRequest, new_buffer, new_buffer->size(),
- kControlTransferTimeout,
+ kControlTransferTimeoutMs,
base::Bind(&OnReadWebUsbAllowedOrigins, callback));
}
@@ -314,7 +314,7 @@ void ReadWebUsbAllowedOrigins(
UsbTransferDirection::INBOUND, UsbControlTransferType::VENDOR,
UsbControlTransferRecipient::DEVICE, vendor_code, 0,
kGetAllowedOriginsRequest, buffer, buffer->size(),
- kControlTransferTimeout,
+ kControlTransferTimeoutMs,
base::Bind(&OnReadWebUsbAllowedOriginsHeader, device_handle, callback,
vendor_code));
}
@@ -361,7 +361,7 @@ void OnReadBosDescriptorHeader(scoped_refptr<UsbDeviceHandle> device_handle,
UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD,
UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest,
kBosDescriptorType << 8, 0, new_buffer, new_buffer->size(),
- kControlTransferTimeout,
+ kControlTransferTimeoutMs,
base::Bind(&OnReadBosDescriptor, device_handle, callback));
}
@@ -574,7 +574,7 @@ void ReadWebUsbDescriptors(scoped_refptr<UsbDeviceHandle> device_handle,
UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD,
UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest,
kBosDescriptorType << 8, 0, buffer, buffer->size(),
- kControlTransferTimeout,
+ kControlTransferTimeoutMs,
base::Bind(&OnReadBosDescriptorHeader, device_handle, callback));
}
« no previous file with comments | « device/usb/usb_descriptors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698