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

Side by Side Diff: device/hid/hid_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/hid/hid_service.cc ('k') | device/hid/hid_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 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_HID_HID_SERVICE_LINUX_H_ 5 #ifndef DEVICE_HID_HID_SERVICE_LINUX_H_
6 #define DEVICE_HID_HID_SERVICE_LINUX_H_ 6 #define DEVICE_HID_HID_SERVICE_LINUX_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/files/scoped_file.h" 11 #include "base/files/scoped_file.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "device/hid/hid_device_info.h" 15 #include "device/hid/hid_device_info.h"
16 #include "device/hid/hid_service.h" 16 #include "device/hid/hid_service.h"
17 17
18 namespace device { 18 namespace device {
19 19
20 class HidConnection; 20 class HidConnection;
21 21
22 class HidServiceLinux : public HidService { 22 class HidServiceLinux : public HidService {
23 public: 23 public:
24 HidServiceLinux(scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 24 HidServiceLinux(scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
25 ~HidServiceLinux() override; 25 ~HidServiceLinux() override;
26 26
27 // HidService:
28 void Shutdown() override;
27 void Connect(const HidDeviceId& device_id, 29 void Connect(const HidDeviceId& device_id,
28 const ConnectCallback& callback) override; 30 const ConnectCallback& callback) override;
29 31
30 private: 32 private:
31 struct ConnectParams; 33 struct ConnectParams;
32 class FileThreadHelper; 34 class FileThreadHelper;
33 35
34 // These functions implement the process of locating, requesting access to and 36 // These functions implement the process of locating, requesting access to and
35 // opening a device. Because this operation crosses multiple threads these 37 // opening a device. Because this operation crosses multiple threads these
36 // functions are static and the necessary parameters are passed as a single 38 // functions are static and the necessary parameters are passed as a single
37 // struct. 39 // struct.
38 #if defined(OS_CHROMEOS) 40 #if defined(OS_CHROMEOS)
39 static void OnPathOpenComplete(std::unique_ptr<ConnectParams> params, 41 static void OnPathOpenComplete(std::unique_ptr<ConnectParams> params,
40 base::ScopedFD fd); 42 base::ScopedFD fd);
41 static void OnPathOpenError(const std::string& device_path, 43 static void OnPathOpenError(const std::string& device_path,
42 const ConnectCallback& callback, 44 const ConnectCallback& callback,
43 const std::string& error_name, 45 const std::string& error_name,
44 const std::string& error_message); 46 const std::string& error_message);
45 #else 47 #else
46 static void OpenOnBlockingThread(std::unique_ptr<ConnectParams> params); 48 static void OpenOnBlockingThread(std::unique_ptr<ConnectParams> params);
47 #endif 49 #endif
48 static void FinishOpen(std::unique_ptr<ConnectParams> params); 50 static void FinishOpen(std::unique_ptr<ConnectParams> params);
49 static void CreateConnection(std::unique_ptr<ConnectParams> params); 51 static void CreateConnection(std::unique_ptr<ConnectParams> params);
50 52
51 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 53 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
52 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; 54 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
53 55
54 // The helper lives on the FILE thread and holds a weak reference back to the 56 // The helper lives on the FILE thread and holds a weak reference back to the
55 // service that owns it. 57 // service that owns it.
56 FileThreadHelper* helper_; 58 std::unique_ptr<FileThreadHelper> helper_;
57 base::WeakPtrFactory<HidServiceLinux> weak_factory_; 59 base::WeakPtrFactory<HidServiceLinux> weak_factory_;
58 60
59 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux); 61 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux);
60 }; 62 };
61 63
62 } // namespace device 64 } // namespace device
63 65
64 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_ 66 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_
OLDNEW
« no previous file with comments | « device/hid/hid_service.cc ('k') | device/hid/hid_service_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698