Remove use of PlatformStrategies for Gamepad API.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jun 2014 22:37:01 +0000 (22:37 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jun 2014 22:37:01 +0000 (22:37 +0000)
commitd8dbe7564e37e9a8307a9cfeb86c3c4b45a702c4
tree45a473600cce6d242c05452e724b1d58ac65e500
parentb8aae6ec6d1e3c55c80cdb9da12ebfd59dd7dab0
Remove use of PlatformStrategies for Gamepad API.
https://bugs.webkit.org/show_bug.cgi?id=134348

Source/WebCore:

Reviewed by Dean Jackson.

No new tests (Not yet a tested config)

Introduce a virtual GamepadProvider with a process-global shared provider.
The base implementation of the GamepadProvider does nothing.
* platform/GamepadProvider.cpp: Renamed from Source/WebKit/mac/WebCoreSupport/WebHIDGamepadController.h.
(WebCore::GamepadProvider::shared):
(WebCore::GamepadProvider::setSharedProvider):
(WebCore::GamepadProvider::startMonitoringGamepads):
(WebCore::GamepadProvider::stopMonitoringGamepads):
(WebCore::GamepadProvider::platformGamepads):
* platform/GamepadProvider.h: Renamed from Source/WebCore/platform/GamepadStrategy.h.
(WebCore::GamepadProvider::~GamepadProvider):

* platform/GamepadProviderClient.h: Renamed from Source/WebCore/platform/GamepadStrategyClient.h.
(WebCore::GamepadProviderClient::~GamepadProviderClient):

GamepadManager is now a GamepadProviderClient:
* Modules/gamepad/GamepadManager.cpp:
(WebCore::GamepadManager::GamepadManager):
(WebCore::GamepadManager::registerNavigator):
(WebCore::GamepadManager::unregisterNavigator):
* Modules/gamepad/GamepadManager.h:

Remove the GamepadStrategy altogether:
* platform/PlatformStrategies.h:
(WebCore::PlatformStrategies::PlatformStrategies):
(WebCore::PlatformStrategies::gamepadStrategy): Deleted.

Call to the shared GamepadProvider instead of the strategy:
* Modules/gamepad/NavigatorGamepad.cpp:
(WebCore::NavigatorGamepad::gamepads):
(WebCore::NavigatorGamepad::gamepadsBecameVisible):
(WebCore::NavigatorGamepad::gamepadConnected):

HIDGamepadListener is now a subclass of GamepadProvider that implements the HID based management.
LegacyWebKit on Mac will install the shared HIDGamepadProvider instead of the default GamepadProvider:
* platform/mac/HIDGamepadProvider.cpp: Renamed from Source/WebCore/platform/mac/HIDGamepadListener.cpp.
(WebCore::deviceMatchingDictionary):
(WebCore::deviceAddedCallback):
(WebCore::deviceRemovedCallback):
(WebCore::deviceValuesChangedCallback):
(WebCore::HIDGamepadProvider::shared):
(WebCore::HIDGamepadProvider::HIDGamepadProvider):
(WebCore::HIDGamepadProvider::indexForNewlyConnectedDevice):
(WebCore::HIDGamepadProvider::startMonitoringGamepads):
(WebCore::HIDGamepadProvider::stopMonitoringGamepads):
(WebCore::HIDGamepadProvider::deviceAdded):
(WebCore::HIDGamepadProvider::deviceRemoved):
(WebCore::HIDGamepadProvider::valuesChanged):
(WebCore::HIDGamepadProvider::removeGamepadForDevice):
* platform/mac/HIDGamepadProvider.h: Renamed from Source/WebCore/platform/mac/HIDGamepadListener.h.
(WebCore::HIDGamepadProvider::platformGamepads):
(WebCore::HIDGamepadProvider::setShouldDispatchCallbacks):

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:

* platform/mac/HIDGamepad.h: Fix incorrect comment

Source/WebKit:

Reviewed by Dean Jackson.

* WebKit.xcodeproj/project.pbxproj:

Source/WebKit/mac:

Reviewed by Dean Jackson.

Remove all the GamepadStrategy gunk:
* WebCoreSupport/WebHIDGamepadController.mm: Removed.
* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::createGamepadStrategy): Deleted.
(WebPlatformStrategies::startMonitoringGamepads): Deleted.
(WebPlatformStrategies::stopMonitoringGamepads): Deleted.
(WebPlatformStrategies::platformGamepads): Deleted.

Instead, install the HIDGamepadProvider as the shared GamepadProvider:
* WebView/WebView.mm:
(WebKitInitializeGamepadProviderIfNecessary):
(-[WebView _commonInitializationWithFrameName:groupName:]):

Source/WebKit/win:

Reviewed by Dean Jackson.

* WebCoreSupport/WebPlatformStrategies.cpp:
(WebPlatformStrategies::createGamepadStrategy): Deleted.
* WebCoreSupport/WebPlatformStrategies.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170500 268f45cc-cd09-0410-ab3c-d52691b4dbfc
28 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/gamepad/GamepadManager.cpp
Source/WebCore/Modules/gamepad/GamepadManager.h
Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/GamepadProvider.cpp [moved from Source/WebKit/mac/WebCoreSupport/WebHIDGamepadController.h with 64% similarity]
Source/WebCore/platform/GamepadProvider.h [moved from Source/WebCore/platform/GamepadStrategy.h with 75% similarity]
Source/WebCore/platform/GamepadProviderClient.h [moved from Source/WebCore/platform/GamepadStrategyClient.h with 90% similarity]
Source/WebCore/platform/PlatformStrategies.h
Source/WebCore/platform/mac/HIDGamepad.h
Source/WebCore/platform/mac/HIDGamepadProvider.cpp [moved from Source/WebCore/platform/mac/HIDGamepadListener.cpp with 80% similarity]
Source/WebCore/platform/mac/HIDGamepadProvider.h [moved from Source/WebCore/platform/mac/HIDGamepadListener.h with 76% similarity]
Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebHIDGamepadController.mm [deleted file]
Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.cpp
Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.h
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h