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

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

Issue 2849953003: Use the task scheduler for blocking tasks in the USB service on Linux (Closed)
Patch Set: Remove more passing of the SequencedTaskRunner 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_device_handle_unittest.cc ('k') | device/usb/usb_device_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 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_DEVICE_IMPL_H_ 5 #ifndef DEVICE_USB_USB_DEVICE_IMPL_H_
6 #define DEVICE_USB_USB_DEVICE_IMPL_H_ 6 #define DEVICE_USB_USB_DEVICE_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/files/scoped_file.h" 13 #include "base/files/scoped_file.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/sequence_checker.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "device/usb/usb_device.h" 17 #include "device/usb/usb_device.h"
18 #include "device/usb/webusb_descriptors.h" 18 #include "device/usb/webusb_descriptors.h"
19 19
20 namespace base { 20 namespace base {
21 class SequencedTaskRunner; 21 class SequencedTaskRunner;
22 } 22 }
23 23
24 namespace device { 24 namespace device {
25 25
(...skipping 19 matching lines...) Expand all
45 45
46 protected: 46 protected:
47 friend class UsbServiceLinux; 47 friend class UsbServiceLinux;
48 48
49 // Called by UsbServiceLinux only. 49 // Called by UsbServiceLinux only.
50 UsbDeviceLinux(const std::string& device_path, 50 UsbDeviceLinux(const std::string& device_path,
51 const UsbDeviceDescriptor& descriptor, 51 const UsbDeviceDescriptor& descriptor,
52 const std::string& manufacturer_string, 52 const std::string& manufacturer_string,
53 const std::string& product_string, 53 const std::string& product_string,
54 const std::string& serial_number, 54 const std::string& serial_number,
55 uint8_t active_configuration, 55 uint8_t active_configuration);
56 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner);
57 56
58 ~UsbDeviceLinux() override; 57 ~UsbDeviceLinux() override;
59 58
60 private: 59 private:
61 #if defined(OS_CHROMEOS) 60 #if defined(OS_CHROMEOS)
62 void OnOpenRequestComplete(const OpenCallback& callback, base::ScopedFD fd); 61 void OnOpenRequestComplete(const OpenCallback& callback, base::ScopedFD fd);
63 void OnOpenRequestError(const OpenCallback& callback, 62 void OnOpenRequestError(const OpenCallback& callback,
64 const std::string& error_name, 63 const std::string& error_name,
65 const std::string& error_message); 64 const std::string& error_message);
66 #else 65 #else
67 void OpenOnBlockingThread(const OpenCallback& callback); 66 void OpenOnBlockingThread(
67 const OpenCallback& callback,
68 scoped_refptr<base::SequencedTaskRunner> task_runner,
69 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner);
68 #endif // defined(OS_CHROMEOS) 70 #endif // defined(OS_CHROMEOS)
69 void Opened(base::ScopedFD fd, const OpenCallback& callback); 71 void Opened(base::ScopedFD fd,
72 const OpenCallback& callback,
73 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner);
70 74
71 base::ThreadChecker thread_checker_; 75 base::SequenceChecker sequence_checker_;
72 76
73 const std::string device_path_; 77 const std::string device_path_;
74 78
75 scoped_refptr<base::SequencedTaskRunner> task_runner_;
76 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
77
78 DISALLOW_COPY_AND_ASSIGN(UsbDeviceLinux); 79 DISALLOW_COPY_AND_ASSIGN(UsbDeviceLinux);
79 }; 80 };
80 81
81 } // namespace device 82 } // namespace device
82 83
83 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ 84 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_
OLDNEW
« no previous file with comments | « device/usb/usb_device_handle_unittest.cc ('k') | device/usb/usb_device_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698