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

Unified Diff: content/browser/gamepad/raw_input_data_fetcher_win.h

Issue 1586663006: Refactoring gamepad polling to support dynamically added sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid crash on Android content_unittests Created 4 years, 11 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
Index: content/browser/gamepad/raw_input_data_fetcher_win.h
diff --git a/content/browser/gamepad/raw_input_data_fetcher_win.h b/content/browser/gamepad/raw_input_data_fetcher_win.h
index 69b780d5793ac67e13e95985bd378fbd19c9ac8e..e8e742d519e43c9353a0f9d626491fb8f1e09002 100644
--- a/content/browser/gamepad/raw_input_data_fetcher_win.h
+++ b/content/browser/gamepad/raw_input_data_fetcher_win.h
@@ -40,6 +40,8 @@ struct RawGamepadInfo {
RawGamepadInfo();
~RawGamepadInfo();
+ int source_id;
+ int enumeration_id;
HANDLE handle;
scoped_ptr<uint8_t[]> ppd_buffer;
PHIDP_PREPARSED_DATA preparsed_data;
@@ -58,7 +60,8 @@ struct RawGamepadInfo {
};
class RawInputDataFetcher
- : public base::SupportsWeakPtr<RawInputDataFetcher>,
+ : public GamepadDataFetcher,
+ public base::SupportsWeakPtr<RawInputDataFetcher>,
public base::MessageLoop::DestructionObserver {
public:
explicit RawInputDataFetcher();
@@ -67,14 +70,15 @@ class RawInputDataFetcher
// DestructionObserver overrides.
void WillDestroyCurrentMessageLoop() override;
- bool Available() { return rawinput_available_; }
- void StartMonitor();
- void StopMonitor();
-
- std::vector<RawGamepadInfo*> EnumerateDevices();
- RawGamepadInfo* GetGamepadInfo(HANDLE handle);
+ void GetGamepadData(bool devices_changed_hint) override;
+ void PauseHint(bool paused) override;
private:
+ void OnAddedToProvider() override;
+
+ void StartMonitor();
+ void StopMonitor();
+ void EnumerateDevices();
RawGamepadInfo* ParseGamepadInfo(HANDLE hDevice);
void UpdateGamepad(RAWINPUT* input, RawGamepadInfo* gamepad_info);
// Handles WM_INPUT messages.
@@ -124,8 +128,11 @@ class RawInputDataFetcher
bool rawinput_available_;
bool filter_xinput_;
bool events_monitored_;
+ int last_source_id_;
+ int last_enumeration_id_;
- std::map<HANDLE, RawGamepadInfo*> controllers_;
+ typedef std::map<HANDLE, RawGamepadInfo*> ControllerMap;
+ ControllerMap controllers_;
// Function pointers to HID functionality, retrieved in
// |GetHidDllFunctions|.
« no previous file with comments | « content/browser/gamepad/gamepad_test_helpers.cc ('k') | content/browser/gamepad/raw_input_data_fetcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698