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

Unified Diff: chrome/browser/usb/web_usb_detector.cc

Issue 2734933003: Enable WebUSB device detection when using the new Windows USB backend. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/usb/web_usb_detector.cc
diff --git a/chrome/browser/usb/web_usb_detector.cc b/chrome/browser/usb/web_usb_detector.cc
index 8bf90ddead499be814047d2624da60a87a312d80..8069062408a9ba244145bf694bf0c8988a0785f9 100644
--- a/chrome/browser/usb/web_usb_detector.cc
+++ b/chrome/browser/usb/web_usb_detector.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/feature_list.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
@@ -17,6 +18,7 @@
#include "chrome/grit/theme_resources.h"
#include "content/public/common/origin_util.h"
#include "device/base/device_client.h"
+#include "device/base/features.h"
#include "device/usb/usb_device.h"
#include "device/usb/usb_ids.h"
#include "ui/base/l10n/l10n_util.h"
@@ -118,9 +120,14 @@ WebUsbDetector::WebUsbDetector() : observer_(this) {}
WebUsbDetector::~WebUsbDetector() {}
void WebUsbDetector::Initialize() {
-// Disabled on Windows due to jank and hangs caused by enumerating devices.
-// https://crbug.com/656702
-#if !defined(OS_WIN)
+#if defined(OS_WIN)
+ // The WebUSB device detector is disabled on Windows due to jank and hangs
+ // caused by enumerating devices. The new USB backend is designed to resolve
+ // these issues so enable it for testing. https://crbug.com/656702
+ if (!base::FeatureList::IsEnabled(device::kNewUsbBackend))
+ return;
+#endif // defined(OS_WIN)
+
SCOPED_UMA_HISTOGRAM_TIMER("WebUsb.DetectorInitialization");
device::UsbService* usb_service =
device::DeviceClient::Get()->GetUsbService();
@@ -128,7 +135,6 @@ void WebUsbDetector::Initialize() {
return;
observer_.Add(usb_service);
-#endif
}
void WebUsbDetector::OnDeviceAdded(scoped_refptr<device::UsbDevice> device) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698