diff options
author | reillyg <reillyg@chromium.org> | 2014-10-08 21:53:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-09 04:53:47 +0000 |
commit | e8fa00efd0965a7eb5816a1ef05c41e017029880 (patch) | |
tree | 3b949bfd6d09e24d3ad157850b351f13002a62b5 /device/hid/hid_connection_mac.h | |
parent | efe9bba6f2d35045b588cdf05d211d246dffa46d (diff) | |
download | chromium_src-e8fa00efd0965a7eb5816a1ef05c41e017029880.zip chromium_src-e8fa00efd0965a7eb5816a1ef05c41e017029880.tar.gz chromium_src-e8fa00efd0965a7eb5816a1ef05c41e017029880.tar.bz2 |
Use IOService enumeration instead of IOHIDManager in HidServiceMac.
Using the IOServiceAddMatchingNotification API to monitor devices
connected to the system is preferable to IOHIDManager because it is
lighter weight. IOHIDManager forces its own lifetime expectations on
the IOHIDDevice objects that it creates and opens all devices it sees
for I/O whether or not there is a Chrome app that is using them.
As a necessary step to simplify this transition the device/hid API now
lives on the browser UI thread when running on OS X. This change will
soon be made for Linux and Windows as well. This change should also
reduce the risk of race conditions as observed in bug 418207 which is
why it is being made independently of the other platforms.
BUG=418207,413978
R=rockot@chromium.org,rpaquay@chromium.org
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/637863003
Cr-Commit-Position: refs/heads/master@{#298793}
Diffstat (limited to 'device/hid/hid_connection_mac.h')
-rw-r--r-- | device/hid/hid_connection_mac.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/device/hid/hid_connection_mac.h b/device/hid/hid_connection_mac.h index aa23fc9..2da606d 100644 --- a/device/hid/hid_connection_mac.h +++ b/device/hid/hid_connection_mac.h @@ -27,8 +27,9 @@ namespace device { class HidConnectionMac : public HidConnection { public: explicit HidConnectionMac( + IOHIDDeviceRef device, HidDeviceInfo device_info, - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); private: virtual ~HidConnectionMac(); @@ -46,8 +47,6 @@ class HidConnectionMac : public HidConnection { size_t size, const WriteCallback& callback) override; - void StartInputReportCallbacks(); - void StopInputReportCallbacks(); static void InputReportCallback(void* context, IOReturn result, void* sender, @@ -57,15 +56,16 @@ class HidConnectionMac : public HidConnection { CFIndex report_length); void ProcessInputReport(scoped_refptr<net::IOBufferWithSize> buffer); void ProcessReadQueue(); - - void WriteReport(IOHIDReportType report_type, - scoped_refptr<net::IOBuffer> buffer, - size_t size, - const WriteCallback& callback); + void GetFeatureReportAsync(uint8_t report_id, const ReadCallback& callback); + void SetReportAsync(IOHIDReportType report_type, + scoped_refptr<net::IOBuffer> buffer, + size_t size, + const WriteCallback& callback); + void ReturnAsyncResult(const base::Closure& callback); base::ScopedCFTypeRef<IOHIDDeviceRef> device_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; + scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; std::vector<uint8_t> inbound_buffer_; std::queue<PendingHidReport> pending_reports_; |