Cleanup WK2 platform gamepad handling.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2016 21:44:25 +0000 (21:44 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2016 21:44:25 +0000 (21:44 +0000)
commitc726a7ec8a76f703494510368d322e83c03348b7
tree243d7d9ff05a7465e948b2c2949402e28bcb5ea2
parent7ec7140295057c84824a5776cdaa77a3cc03b934
Cleanup WK2 platform gamepad handling.
https://bugs.webkit.org/show_bug.cgi?id=160871

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (No currently testable change in behavior).

This patch does a few things:
1 - Separates the concepts of "monitoring gamepads" and "monitoring gamepad inputs"
2 - Uses this new concept to much more cleanly handle the case where we are not currently
    monitoring gamepad inputs because an interested WKWebView is not front and center.
3 - Pre-populates the "initial set of gamepads" in WebProcesses that start listening for gamepads.

* platform/gamepad/GamepadProviderClient.h:
(WebCore::GamepadProviderClient::setInitialConnectedGamepads):

* platform/gamepad/mac/HIDGamepadProvider.cpp:
(WebCore::HIDGamepadProvider::HIDGamepadProvider):
(WebCore::HIDGamepadProvider::stopMonitoringInput):
(WebCore::HIDGamepadProvider::startMonitoringInput):
(WebCore::HIDGamepadProvider::connectionDelayTimerFired):
* platform/gamepad/mac/HIDGamepadProvider.h:

Source/WebKit2:

This patch does a few things:
1 - Separates the concepts of "monitoring gamepads" and "monitoring gamepad inputs"
2 - Uses this new concept to much more cleanly handle the case where we are not currently
    monitoring gamepad inputs because an interested WKWebView is not front and center.
3 - Pre-populates the "initial set of gamepads" in WebProcesses that start listening for gamepads.

* Platform/Logging.h:

* UIProcess/Gamepad/UIGamepadProvider.cpp:
(WebKit::UIGamepadProvider::gamepadSyncTimerFired):
(WebKit::UIGamepadProvider::setInitialConnectedGamepads):
(WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
(WebKit::UIGamepadProvider::viewBecameActive):
(WebKit::UIGamepadProvider::viewBecameInactive):
(WebKit::UIGamepadProvider::stopMonitoringGamepads):
(WebKit::UIGamepadProvider::snapshotGamepads):
(WebKit::UIGamepadProvider::platformStopMonitoringInput):
(WebKit::UIGamepadProvider::platformStartMonitoringInput):
(WebKit::UIGamepadProvider::UIGamepadProvider): Deleted.
(WebKit::UIGamepadProvider::scheduleDisableGamepadMonitoring): Deleted.
(WebKit::UIGamepadProvider::disableMonitoringTimerFired): Deleted.
* UIProcess/Gamepad/UIGamepadProvider.h:

* UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp:
(WebKit::UIGamepadProvider::platformStopMonitoringInput):
(WebKit::UIGamepadProvider::platformStartMonitoringInput):

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setInitialConnectedGamepads):
* UIProcess/WebProcessPool.h:

* WebProcess/Gamepad/WebGamepadProvider.cpp:
(WebKit::WebGamepadProvider::setInitialGamepads):
* WebProcess/Gamepad/WebGamepadProvider.h:

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setInitialGamepads):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/gamepad/GamepadProviderClient.h
Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.cpp
Source/WebCore/platform/gamepad/mac/HIDGamepadProvider.h
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/Logging.h
Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp
Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h
Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp
Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/WebProcess.messages.in