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

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

Issue 1314273002: Manage UsbService lifetime in DeviceClient implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « device/test/test_device_client.h ('k') | device/test/usb_test_gadget_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/test/test_device_client.h"
6
7 #include "device/hid/hid_service.h"
8 #include "device/usb/usb_service.h"
9
10 namespace device {
11
12 TestDeviceClient::TestDeviceClient(
13 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner)
14 : blocking_task_runner_(blocking_task_runner) {}
15
16 TestDeviceClient::~TestDeviceClient() {}
17
18 HidService* TestDeviceClient::GetHidService() {
19 #if !defined(OS_LINUX) || defined(USE_UDEV)
20 return HidService::GetInstance(blocking_task_runner_);
21 #else
22 return nullptr;
23 #endif
24 }
25
26 UsbService* TestDeviceClient::GetUsbService() {
27 #if !defined(OS_ANDROID) && !defined(OS_IOS)
28 if (!usb_service_) {
29 usb_service_ = UsbService::Create(blocking_task_runner_);
30 }
31 #endif
32 return usb_service_.get();
33 }
34
35 } // namespace device
OLDNEW
« no previous file with comments | « device/test/test_device_client.h ('k') | device/test/usb_test_gadget_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698