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

Side by Side Diff: device/hid/hid_service_linux.h

Issue 1874313002: Convert device to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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/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>
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
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_
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