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.cc | |
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.cc')
-rw-r--r-- | device/hid/hid_connection_win.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/device/hid/hid_connection_win.cc b/device/hid/hid_connection_win.cc index 4f39c7c..a8414da 100644 --- a/device/hid/hid_connection_win.cc +++ b/device/hid/hid_connection_win.cc @@ -125,6 +125,9 @@ HidConnectionWin::HidConnectionWin(const HidDeviceInfo& device_info) } HidConnectionWin::~HidConnectionWin() { +} + +void HidConnectionWin::PlatformClose() { CancelIo(file_.Get()); } |