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

Unified Diff: device/usb/usb_service.cc

Issue 2688303002: Add a feature flag for the new Windows USB backend. (Closed)
Patch Set: Update histograms. Created 3 years, 10 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_service.h ('k') | device/usb/usb_service_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_service.cc
diff --git a/device/usb/usb_service.cc b/device/usb/usb_service.cc
index 223a5239ecaa57ac5a017043376699312370a622..80873c0e6e94b3160f968a987510e36e6b238370 100644
--- a/device/usb/usb_service.cc
+++ b/device/usb/usb_service.cc
@@ -5,11 +5,13 @@
#include "device/usb/usb_service.h"
#include "base/bind.h"
+#include "base/feature_list.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "components/device_event_log/device_event_log.h"
+#include "device/base/features.h"
#include "device/usb/usb_device.h"
#if defined(OS_ANDROID)
@@ -17,6 +19,9 @@
#elif defined(USE_UDEV)
#include "device/usb/usb_service_linux.h"
#else
+#if defined(OS_WIN)
+#include "device/usb/usb_service_win.h"
+#endif
#include "device/usb/usb_service_impl.h"
#endif
@@ -43,7 +48,12 @@ std::unique_ptr<UsbService> UsbService::Create(
return base::WrapUnique(new UsbServiceAndroid(blocking_task_runner));
#elif defined(USE_UDEV)
return base::WrapUnique(new UsbServiceLinux(blocking_task_runner));
-#elif defined(OS_WIN) || defined(OS_MACOSX)
+#elif defined(OS_WIN)
+ if (base::FeatureList::IsEnabled(kNewUsbBackend))
+ return base::WrapUnique(new UsbServiceWin(blocking_task_runner));
+ else
+ return base::WrapUnique(new UsbServiceImpl(blocking_task_runner));
+#elif defined(OS_MACOSX)
return base::WrapUnique(new UsbServiceImpl(blocking_task_runner));
#else
return nullptr;
@@ -61,9 +71,11 @@ UsbService::~UsbService() {
}
UsbService::UsbService(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner)
- : task_runner_(task_runner), blocking_task_runner_(blocking_task_runner) {}
+ : blocking_task_runner_(std::move(blocking_task_runner)) {
+ if (base::ThreadTaskRunnerHandle::IsSet())
+ task_runner_ = base::ThreadTaskRunnerHandle::Get();
+}
scoped_refptr<UsbDevice> UsbService::GetDevice(const std::string& guid) {
DCHECK(CalledOnValidThread());
« no previous file with comments | « device/usb/usb_service.h ('k') | device/usb/usb_service_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698