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

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

Issue 2482463002: Remove DeviceMonitorLinux::WillDestroyCurrentMessageLoop(). (Closed)
Patch Set: CR achuithb #24 Created 4 years, 1 month 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_linux.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <list> 5 #include <list>
6 #include <memory>
6 #include <unordered_map> 7 #include <unordered_map>
7 8
8 #include "base/macros.h" 9 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
10 #include "device/usb/usb_service.h" 11 #include "device/usb/usb_service.h"
11 12
12 namespace base { 13 namespace base {
13 class SequencedTaskRunner; 14 class SequencedTaskRunner;
14 class SingleThreadTaskRunner; 15 class SingleThreadTaskRunner;
15 } 16 }
16 17
17 namespace device { 18 namespace device {
18 19
19 struct UsbDeviceDescriptor; 20 struct UsbDeviceDescriptor;
20 class UsbDeviceLinux; 21 class UsbDeviceLinux;
21 22
22 class UsbServiceLinux : public UsbService { 23 class UsbServiceLinux : public UsbService {
23 public: 24 public:
24 explicit UsbServiceLinux( 25 explicit UsbServiceLinux(
25 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); 26 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_in);
26 ~UsbServiceLinux() override; 27 ~UsbServiceLinux() override;
27 28
28 // device::UsbService implementation 29 // device::UsbService implementation
30 void Shutdown() override;
29 void GetDevices(const GetDevicesCallback& callback) override; 31 void GetDevices(const GetDevicesCallback& callback) override;
30 32
31 private: 33 private:
32 using DeviceMap = 34 using DeviceMap =
33 std::unordered_map<std::string, scoped_refptr<UsbDeviceLinux>>; 35 std::unordered_map<std::string, scoped_refptr<UsbDeviceLinux>>;
34 36
35 class FileThreadHelper; 37 class FileThreadHelper;
36 38
37 void OnDeviceAdded(const std::string& device_path, 39 void OnDeviceAdded(const std::string& device_path,
38 const UsbDeviceDescriptor& descriptor, 40 const UsbDeviceDescriptor& descriptor,
(...skipping 11 matching lines...) Expand all
50 52
51 // |helper_started_| is set once OnDeviceAdded has been called for all devices 53 // |helper_started_| is set once OnDeviceAdded has been called for all devices
52 // initially found on the system. |first_enumeration_countdown_| is then 54 // initially found on the system. |first_enumeration_countdown_| is then
53 // decremented as DeviceReady is called for these devices. 55 // decremented as DeviceReady is called for these devices.
54 // |enumeration_callbacks_| holds the callbacks passed to GetDevices before 56 // |enumeration_callbacks_| holds the callbacks passed to GetDevices before
55 // this process completes and the device list is ready. 57 // this process completes and the device list is ready.
56 bool helper_started_ = false; 58 bool helper_started_ = false;
57 uint32_t first_enumeration_countdown_ = 0; 59 uint32_t first_enumeration_countdown_ = 0;
58 std::list<GetDevicesCallback> enumeration_callbacks_; 60 std::list<GetDevicesCallback> enumeration_callbacks_;
59 61
60 FileThreadHelper* helper_; 62 std::unique_ptr<FileThreadHelper> helper_;
61 DeviceMap devices_by_path_; 63 DeviceMap devices_by_path_;
62 64
63 base::WeakPtrFactory<UsbServiceLinux> weak_factory_; 65 base::WeakPtrFactory<UsbServiceLinux> weak_factory_;
64 66
65 DISALLOW_COPY_AND_ASSIGN(UsbServiceLinux); 67 DISALLOW_COPY_AND_ASSIGN(UsbServiceLinux);
66 }; 68 };
67 69
68 } // namespace device 70 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_service.cc ('k') | device/usb/usb_service_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698