OLD | NEW |
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> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
11 #include "build/build_config.h" | 13 #include "build/build_config.h" |
12 #include "device/hid/hid_device_info.h" | 14 #include "device/hid/hid_device_info.h" |
13 #include "device/hid/hid_service.h" | 15 #include "device/hid/hid_service.h" |
14 | 16 |
15 namespace dbus { | 17 namespace dbus { |
16 class FileDescriptor; | 18 class FileDescriptor; |
17 } | 19 } |
(...skipping 12 matching lines...) Expand all Loading... |
30 | 32 |
31 private: | 33 private: |
32 struct ConnectParams; | 34 struct ConnectParams; |
33 class FileThreadHelper; | 35 class FileThreadHelper; |
34 | 36 |
35 // These functions implement the process of locating, requesting access to and | 37 // These functions implement the process of locating, requesting access to and |
36 // opening a device. Because this operation crosses multiple threads these | 38 // opening a device. Because this operation crosses multiple threads these |
37 // functions are static and the necessary parameters are passed as a single | 39 // functions are static and the necessary parameters are passed as a single |
38 // struct. | 40 // struct. |
39 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
40 static void OnPathOpenComplete(scoped_ptr<ConnectParams> params, | 42 static void OnPathOpenComplete(std::unique_ptr<ConnectParams> params, |
41 dbus::FileDescriptor fd); | 43 dbus::FileDescriptor fd); |
42 static void OnPathOpenError(const std::string& device_path, | 44 static void OnPathOpenError(const std::string& device_path, |
43 const ConnectCallback& callback, | 45 const ConnectCallback& callback, |
44 const std::string& error_name, | 46 const std::string& error_name, |
45 const std::string& error_message); | 47 const std::string& error_message); |
46 static void ValidateFdOnBlockingThread(scoped_ptr<ConnectParams> params, | 48 static void ValidateFdOnBlockingThread(std::unique_ptr<ConnectParams> params, |
47 dbus::FileDescriptor fd); | 49 dbus::FileDescriptor fd); |
48 #else | 50 #else |
49 static void OpenOnBlockingThread(scoped_ptr<ConnectParams> params); | 51 static void OpenOnBlockingThread(std::unique_ptr<ConnectParams> params); |
50 #endif | 52 #endif |
51 static void FinishOpen(scoped_ptr<ConnectParams> params); | 53 static void FinishOpen(std::unique_ptr<ConnectParams> params); |
52 static void CreateConnection(scoped_ptr<ConnectParams> params); | 54 static void CreateConnection(std::unique_ptr<ConnectParams> params); |
53 | 55 |
54 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 56 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
55 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 57 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
56 | 58 |
57 // The helper lives on the FILE thread and holds a weak reference back to the | 59 // The helper lives on the FILE thread and holds a weak reference back to the |
58 // service that owns it. | 60 // service that owns it. |
59 FileThreadHelper* helper_; | 61 FileThreadHelper* helper_; |
60 base::WeakPtrFactory<HidServiceLinux> weak_factory_; | 62 base::WeakPtrFactory<HidServiceLinux> weak_factory_; |
61 | 63 |
62 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux); | 64 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux); |
63 }; | 65 }; |
64 | 66 |
65 } // namespace device | 67 } // namespace device |
66 | 68 |
67 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_ | 69 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_ |
OLD | NEW |