diff options
author | reillyg <reillyg@chromium.org> | 2014-10-06 22:40:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-07 05:40:40 +0000 |
commit | b321e4f568022a539f87b57dec817d6e23825d9f (patch) | |
tree | 337b78a74e3f8ab10c93b03b577cc500c9dd5ea1 /device/hid/hid_connection_win.h | |
parent | 875dc1fdfcf23ff64f959f423117fc25fd05b4e4 (diff) | |
download | chromium_src-b321e4f568022a539f87b57dec817d6e23825d9f.zip chromium_src-b321e4f568022a539f87b57dec817d6e23825d9f.tar.gz chromium_src-b321e4f568022a539f87b57dec817d6e23825d9f.tar.bz2 |
Add HidConnection::Close and register OS X callbacks on the UI thread.
The platform implementation of a HID connection may need to cancel I/O
operations when the connection is closed. If this is done during the
object destructor then any pointers held by those pending operations are
immediately invalid. A separate Close method allows the cleanup to
happen while the object is still available to handle asynchronous
cancellation events.
The OS X implementation will take advantage of this immediately to
register and unregister its input report callback from the UI thread to
avoid a race between event delivery and object cleanup. I've added
comments explaining why not all operations on the IOHIDDevice object
could be moved to the UI thread.
BUG=418207
Review URL: https://codereview.chromium.org/615633008
Cr-Commit-Position: refs/heads/master@{#298384}
Diffstat (limited to 'device/hid/hid_connection_win.h')
-rw-r--r-- | device/hid/hid_connection_win.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/device/hid/hid_connection_win.h b/device/hid/hid_connection_win.h index 25e5d7b..b3e3ce4 100644 --- a/device/hid/hid_connection_win.h +++ b/device/hid/hid_connection_win.h @@ -27,6 +27,7 @@ class HidConnectionWin : public HidConnection { ~HidConnectionWin(); // HidConnection implementation. + virtual void PlatformClose() override; virtual void PlatformRead(const ReadCallback& callback) override; virtual void PlatformWrite(scoped_refptr<net::IOBuffer> buffer, size_t size, |