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

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

Issue 660573007: Open HID connections asynchronously. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_linux.cc ('k') | device/hid/hid_service_mac.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_MAC_H_ 5 #ifndef DEVICE_HID_HID_SERVICE_MAC_H_
6 #define DEVICE_HID_HID_SERVICE_MAC_H_ 6 #define DEVICE_HID_HID_SERVICE_MAC_H_
7 7
8 #include <CoreFoundation/CoreFoundation.h> 8 #include <CoreFoundation/CoreFoundation.h>
9 #include <IOKit/IOKitLib.h> 9 #include <IOKit/IOKitLib.h>
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/mac/foundation_util.h" 13 #include "base/mac/foundation_util.h"
14 #include "base/mac/scoped_ioobject.h" 14 #include "base/mac/scoped_ioobject.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "device/hid/hid_service.h" 16 #include "device/hid/hid_service.h"
17 17
18 namespace base { 18 namespace base {
19 class SingleThreadTaskRunner; 19 class SingleThreadTaskRunner;
20 } 20 }
21 21
22 namespace device { 22 namespace device {
23 23
24 class HidConnection; 24 class HidConnection;
25 25
26 class HidServiceMac : public HidService { 26 class HidServiceMac : public HidService {
27 public: 27 public:
28 HidServiceMac(scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 28 HidServiceMac(scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
29 29
30 virtual scoped_refptr<HidConnection> Connect(const HidDeviceId& device_id) 30 virtual void Connect(const HidDeviceId& device_id,
31 override; 31 const ConnectCallback& connect) override;
32 32
33 private: 33 private:
34 virtual ~HidServiceMac(); 34 virtual ~HidServiceMac();
35 35
36 // IOService matching callbacks. 36 // IOService matching callbacks.
37 static void FirstMatchCallback(void* context, io_iterator_t iterator); 37 static void FirstMatchCallback(void* context, io_iterator_t iterator);
38 static void TerminatedCallback(void* context, io_iterator_t iterator); 38 static void TerminatedCallback(void* context, io_iterator_t iterator);
39 39
40 void AddDevices(); 40 void AddDevices();
41 void RemoveDevices(); 41 void RemoveDevices();
42 42
43 // Platform notification port. 43 // Platform notification port.
44 IONotificationPortRef notify_port_; 44 IONotificationPortRef notify_port_;
45 base::mac::ScopedIOObject<io_iterator_t> devices_added_iterator_; 45 base::mac::ScopedIOObject<io_iterator_t> devices_added_iterator_;
46 base::mac::ScopedIOObject<io_iterator_t> devices_removed_iterator_; 46 base::mac::ScopedIOObject<io_iterator_t> devices_removed_iterator_;
47 47
48 // The task runner for the thread on which this service was created. 48 // The task runner for the thread on which this service was created.
49 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 49 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
50 50
51 // The task runner for the FILE thread of the application using this service 51 // The task runner for the FILE thread of the application using this service
52 // on which slow running I/O operations can be performed. 52 // on which slow running I/O operations can be performed.
53 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; 53 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(HidServiceMac); 55 DISALLOW_COPY_AND_ASSIGN(HidServiceMac);
56 }; 56 };
57 57
58 } // namespace device 58 } // namespace device
59 59
60 #endif // DEVICE_HID_HID_SERVICE_MAC_H_ 60 #endif // DEVICE_HID_HID_SERVICE_MAC_H_
OLDNEW
« no previous file with comments | « device/hid/hid_service_linux.cc ('k') | device/hid/hid_service_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698