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

Unified Diff: device/hid/hid_service_mac.h

Issue 2780393006: Open IOHIDDevices on the FILE thread (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/hid/hid_connection_mac.cc ('k') | device/hid/hid_service_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_service_mac.h
diff --git a/device/hid/hid_service_mac.h b/device/hid/hid_service_mac.h
index f3af539a25205614166df8a0ced2794ad7f3be31..2d2ac3513997948a83101ccb69c0ca1b46f4464c 100644
--- a/device/hid/hid_service_mac.h
+++ b/device/hid/hid_service_mac.h
@@ -7,6 +7,7 @@
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
+#include <IOKit/hid/IOHIDDevice.h>
#include <string>
@@ -15,6 +16,7 @@
#include "base/mac/scoped_ioobject.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "device/hid/hid_service.h"
namespace base {
@@ -32,6 +34,15 @@ class HidServiceMac : public HidService {
const ConnectCallback& connect) override;
private:
+ static void OpenOnBlockingThread(
+ scoped_refptr<HidDeviceInfo> device_info,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ base::WeakPtr<HidServiceMac> hid_service,
+ const ConnectCallback& callback);
+ void DeviceOpened(scoped_refptr<HidDeviceInfo> device_info,
+ base::ScopedCFTypeRef<IOHIDDeviceRef> hid_device,
+ const ConnectCallback& callback);
+
// IOService matching callbacks.
static void FirstMatchCallback(void* context, io_iterator_t iterator);
static void TerminatedCallback(void* context, io_iterator_t iterator);
@@ -54,6 +65,8 @@ class HidServiceMac : public HidService {
// on which slow running I/O operations can be performed.
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
+ base::WeakPtrFactory<HidServiceMac> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(HidServiceMac);
};
« no previous file with comments | « device/hid/hid_connection_mac.cc ('k') | device/hid/hid_service_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698