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

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

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 unified diff | Download patch
« no previous file with comments | « device/usb/mock_usb_service.cc ('k') | device/usb/usb_service.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef DEVICE_USB_USB_SERVICE_H_ 5 #ifndef DEVICE_USB_USB_SERVICE_H_
6 #define DEVICE_USB_USB_SERVICE_H_ 6 #define DEVICE_USB_USB_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void AddObserver(Observer* observer); 69 void AddObserver(Observer* observer);
70 void RemoveObserver(Observer* observer); 70 void RemoveObserver(Observer* observer);
71 71
72 // Methods to add and remove devices for testing purposes. Only a device added 72 // Methods to add and remove devices for testing purposes. Only a device added
73 // by this method can be removed by RemoveDeviceForTesting(). 73 // by this method can be removed by RemoveDeviceForTesting().
74 void AddDeviceForTesting(scoped_refptr<UsbDevice> device); 74 void AddDeviceForTesting(scoped_refptr<UsbDevice> device);
75 void RemoveDeviceForTesting(const std::string& device_guid); 75 void RemoveDeviceForTesting(const std::string& device_guid);
76 void GetTestDevices(std::vector<scoped_refptr<UsbDevice>>* devices); 76 void GetTestDevices(std::vector<scoped_refptr<UsbDevice>>* devices);
77 77
78 protected: 78 protected:
79 UsbService(scoped_refptr<base::SingleThreadTaskRunner> task_runner, 79 UsbService(scoped_refptr<base::SequencedTaskRunner> blocking_task_runner);
80 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner);
81 80
82 void NotifyDeviceAdded(scoped_refptr<UsbDevice> device); 81 void NotifyDeviceAdded(scoped_refptr<UsbDevice> device);
83 void NotifyDeviceRemoved(scoped_refptr<UsbDevice> device); 82 void NotifyDeviceRemoved(scoped_refptr<UsbDevice> device);
84 83
85 scoped_refptr<base::SingleThreadTaskRunner> task_runner() { 84 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner() const {
86 return task_runner_; 85 return task_runner_;
87 } 86 }
88 87
89 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner() { 88 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner() const {
90 return blocking_task_runner_; 89 return blocking_task_runner_;
91 } 90 }
92 91
93 std::unordered_map<std::string, scoped_refptr<UsbDevice>>& devices() { 92 std::unordered_map<std::string, scoped_refptr<UsbDevice>>& devices() {
94 return devices_; 93 return devices_;
95 } 94 }
96 95
97 private: 96 private:
98 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 97 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
99 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 98 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
100 std::unordered_map<std::string, scoped_refptr<UsbDevice>> devices_; 99 std::unordered_map<std::string, scoped_refptr<UsbDevice>> devices_;
101 std::unordered_set<std::string> testing_devices_; 100 std::unordered_set<std::string> testing_devices_;
102 base::ObserverList<Observer, true> observer_list_; 101 base::ObserverList<Observer, true> observer_list_;
103 102
104 #if DCHECK_IS_ON() 103 #if DCHECK_IS_ON()
105 bool did_shutdown_ = false; 104 bool did_shutdown_ = false;
106 #endif 105 #endif
107 106
108 DISALLOW_COPY_AND_ASSIGN(UsbService); 107 DISALLOW_COPY_AND_ASSIGN(UsbService);
109 }; 108 };
110 109
111 } // namespace device 110 } // namespace device
112 111
113 #endif // DEVICE_USB_USB_SERVICE_H_ 112 #endif // DEVICE_USB_USB_SERVICE_H_
OLDNEW
« no previous file with comments | « device/usb/mock_usb_service.cc ('k') | device/usb/usb_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698