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

Unified Diff: device/gamepad/gamepad_data_fetcher_manager.h

Issue 2129003002: Refactored gamepad polling to support dynamic sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test issue and Mac XBoxDataFetcher constructor Created 4 years, 5 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: device/gamepad/gamepad_data_fetcher_manager.h
diff --git a/device/gamepad/gamepad_data_fetcher_manager.h b/device/gamepad/gamepad_data_fetcher_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..dc2d68c03a795870500edf2cd9e53cb6eb9ba6c4
--- /dev/null
+++ b/device/gamepad/gamepad_data_fetcher_manager.h
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_GAMEPAD_GAMEPAD_DATA_FETCHER_MANAGER_H_
+#define DEVICE_GAMEPAD_GAMEPAD_DATA_FETCHER_MANAGER_H_
+
+#include <memory>
+#include <utility>
+#include <vector>
+
+#include "device/gamepad/gamepad_export.h"
+#include "device/gamepad/gamepad_provider.h"
+
+namespace device {
+
+class GamepadDataFetcherFactory;
+
+class DEVICE_GAMEPAD_EXPORT GamepadDataFetcherManager {
+ public:
+ ~GamepadDataFetcherManager();
+
+ // Returns the GamepadDataFetcherManager singleton.
+ static GamepadDataFetcherManager* GetInstance();
+
+ void AddFactory(GamepadDataFetcherFactory* factory);
+ void RemoveSourceFactory(GamepadSource source);
+
+ // Must be called on the providers polling thread
+ void InitializeProvider(GamepadProvider* provider);
+ void ClearProvider();
+
+ private:
+ GamepadDataFetcherManager();
+
+ void CreateDataFetcherFromFactory(GamepadDataFetcherFactory* factory);
+ void RemoveSourceDataFetcher(GamepadSource* source);
+
+ typedef std::vector<GamepadDataFetcherFactory*> FactoryVector;
+ FactoryVector factories_;
+
+ GamepadProvider* provider_;
+};
+
+} // namespace device
+
+#endif // DEVICE_GAMEPAD_GAMEPAD_DATA_FETCHER_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698