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

Side by Side Diff: device/test/test_device_client.cc

Issue 2885143002: Use the task scheduler in the new Windows USB backend (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/test/test_device_client.h" 5 #include "device/test/test_device_client.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 // This file unconditionally includes these headers despite conditionally 10 // This file unconditionally includes these headers despite conditionally
11 // depending on the corresponding targets. The code below needs the destructors 11 // depending on the corresponding targets. The code below needs the destructors
12 // of the classes defined even when the classes are never instantiated. 12 // of the classes defined even when the classes are never instantiated.
13 // TODO: This should probably be done more explicitly to avoid ambiguity. 13 // TODO: This should probably be done more explicitly to avoid ambiguity.
14 #include "device/hid/hid_service.h" // nogncheck 14 #include "device/hid/hid_service.h" // nogncheck
15 #include "device/usb/usb_service.h" // nogncheck 15 #include "device/usb/usb_service.h" // nogncheck
16 16
17 namespace device { 17 namespace device {
18 18
19 TestDeviceClient::TestDeviceClient( 19 TestDeviceClient::TestDeviceClient() = default;
20 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner)
21 : blocking_task_runner_(blocking_task_runner) {}
22 20
23 TestDeviceClient::~TestDeviceClient() { 21 TestDeviceClient::~TestDeviceClient() {
24 if (hid_service_) 22 if (hid_service_)
25 hid_service_->Shutdown(); 23 hid_service_->Shutdown();
26 if (usb_service_) 24 if (usb_service_)
27 usb_service_->Shutdown(); 25 usb_service_->Shutdown();
28 } 26 }
29 27
30 HidService* TestDeviceClient::GetHidService() { 28 HidService* TestDeviceClient::GetHidService() {
31 #if !defined(OS_ANDROID) && !defined(OS_IOS) && \ 29 #if !defined(OS_ANDROID) && !defined(OS_IOS) && \
32 !(defined(OS_LINUX) && !defined(USE_UDEV)) 30 !(defined(OS_LINUX) && !defined(USE_UDEV))
33 if (!hid_service_) 31 if (!hid_service_)
34 hid_service_ = HidService::Create(); 32 hid_service_ = HidService::Create();
35 #endif 33 #endif
36 return hid_service_.get(); 34 return hid_service_.get();
37 } 35 }
38 36
39 UsbService* TestDeviceClient::GetUsbService() { 37 UsbService* TestDeviceClient::GetUsbService() {
40 #if !defined(OS_ANDROID) && !defined(OS_IOS) 38 #if !defined(OS_ANDROID) && !defined(OS_IOS)
41 if (!usb_service_) { 39 if (!usb_service_)
42 usb_service_ = UsbService::Create(blocking_task_runner_); 40 usb_service_ = UsbService::Create();
43 }
44 #endif 41 #endif
45 return usb_service_.get(); 42 return usb_service_.get();
46 } 43 }
47 44
48 } // namespace device 45 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698