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

Unified Diff: device/hid/hid_service_win.h

Issue 936603003: Enumerate HID devices asynchronously on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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_service.cc ('k') | device/hid/hid_service_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_service_win.h
diff --git a/device/hid/hid_service_win.h b/device/hid/hid_service_win.h
index 902d431fe2cb345ccdd4b0e271f0718c42faa305..55866ee327c78a1748440b7d87df866354b13254 100644
--- a/device/hid/hid_service_win.h
+++ b/device/hid/hid_service_win.h
@@ -14,6 +14,7 @@ extern "C" {
}
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "base/win/scoped_handle.h"
#include "device/core/device_monitor_win.h"
@@ -30,7 +31,7 @@ namespace device {
class HidServiceWin : public HidService, public DeviceMonitorWin::Observer {
public:
- HidServiceWin();
+ HidServiceWin(scoped_refptr<base::SingleThreadTaskRunner> file_task_runner);
virtual void Connect(const HidDeviceId& device_id,
const ConnectCallback& callback) override;
@@ -38,7 +39,9 @@ class HidServiceWin : public HidService, public DeviceMonitorWin::Observer {
private:
virtual ~HidServiceWin();
- void DoInitialEnumeration();
+ static void InitialEnumerationFileThread(
Ken Rockot(use gerrit already) 2015/02/18 20:40:23 nit: Judging from its ubiquity across the codebase
+ base::WeakPtr<HidServiceWin> service,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
static void CollectInfoFromButtonCaps(PHIDP_PREPARSED_DATA preparsed_data,
HIDP_REPORT_TYPE report_type,
USHORT button_caps_length,
@@ -47,16 +50,22 @@ class HidServiceWin : public HidService, public DeviceMonitorWin::Observer {
HIDP_REPORT_TYPE report_type,
USHORT value_caps_length,
HidCollectionInfo* collection_info);
+ static void AddDeviceFileThread(
+ base::WeakPtr<HidServiceWin> service,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ const std::string& device_path);
// DeviceMonitorWin::Observer implementation:
void OnDeviceAdded(const std::string& device_path) override;
void OnDeviceRemoved(const std::string& device_path) override;
// Tries to open the device read-write and falls back to read-only.
- base::win::ScopedHandle OpenDevice(const std::string& device_path);
+ static base::win::ScopedHandle OpenDevice(const std::string& device_path);
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_;
+ base::WeakPtrFactory<HidServiceWin> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(HidServiceWin);
};
« no previous file with comments | « device/hid/hid_service.cc ('k') | device/hid/hid_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698