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

Side by Side Diff: device/usb/usb_service_impl.h

Issue 2857473002: Use the task scheduler in the USB service on macOS and Windows (Closed)
Patch Set: Add AssertIOAllowed 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
« no previous file with comments | « device/usb/usb_service.cc ('k') | device/usb/usb_service_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
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/usb/usb_service.h" 5 #include "device/usb/usb_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
11 #include <set> 11 #include <set>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "device/usb/usb_context.h" 16 #include "device/usb/usb_context.h"
17 #include "device/usb/usb_device_impl.h" 17 #include "device/usb/usb_device_impl.h"
18 #include "third_party/libusb/src/libusb/libusb.h" 18 #include "third_party/libusb/src/libusb/libusb.h"
19 19
20 #if defined(OS_WIN) 20 #if defined(OS_WIN)
21 #include "base/scoped_observer.h" 21 #include "base/scoped_observer.h"
22 #include "device/base/device_monitor_win.h" 22 #include "device/base/device_monitor_win.h"
23 #endif // OS_WIN 23 #endif // OS_WIN
24 24
25 struct libusb_device; 25 struct libusb_device;
26 struct libusb_context; 26 struct libusb_context;
27 27
28 namespace base {
29 class SequencedTaskRunner;
30 }
31
32 namespace device { 28 namespace device {
33 29
34 typedef struct libusb_device* PlatformUsbDevice; 30 typedef struct libusb_device* PlatformUsbDevice;
35 typedef struct libusb_context* PlatformUsbContext; 31 typedef struct libusb_context* PlatformUsbContext;
36 32
37 class UsbDeviceImpl; 33 class UsbDeviceImpl;
38 34
39 class UsbServiceImpl : 35 class UsbServiceImpl :
40 #if defined(OS_WIN) 36 #if defined(OS_WIN)
41 public DeviceMonitorWin::Observer, 37 public DeviceMonitorWin::Observer,
42 #endif // OS_WIN 38 #endif // OS_WIN
43 public UsbService { 39 public UsbService {
44 public: 40 public:
45 explicit UsbServiceImpl( 41 UsbServiceImpl();
46 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner);
47 ~UsbServiceImpl() override; 42 ~UsbServiceImpl() override;
48 43
49 private: 44 private:
50 // device::UsbService implementation 45 // device::UsbService implementation
51 void GetDevices(const GetDevicesCallback& callback) override; 46 void GetDevices(const GetDevicesCallback& callback) override;
52 47
53 #if defined(OS_WIN) 48 #if defined(OS_WIN)
54 // device::DeviceMonitorWin::Observer implementation 49 // device::DeviceMonitorWin::Observer implementation
55 void OnDeviceAdded(const GUID& class_guid, 50 void OnDeviceAdded(const GUID& class_guid,
56 const std::string& device_path) override; 51 const std::string& device_path) override;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 #if defined(OS_WIN) 113 #if defined(OS_WIN)
119 ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_; 114 ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_;
120 #endif // OS_WIN 115 #endif // OS_WIN
121 116
122 base::WeakPtrFactory<UsbServiceImpl> weak_factory_; 117 base::WeakPtrFactory<UsbServiceImpl> weak_factory_;
123 118
124 DISALLOW_COPY_AND_ASSIGN(UsbServiceImpl); 119 DISALLOW_COPY_AND_ASSIGN(UsbServiceImpl);
125 }; 120 };
126 121
127 } // namespace device 122 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_service.cc ('k') | device/usb/usb_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698