Diff
Modified: trunk/Source/WebKit2/CMakeLists.txt (204296 => 204297)
--- trunk/Source/WebKit2/CMakeLists.txt 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/CMakeLists.txt 2016-08-09 21:29:05 UTC (rev 204297)
@@ -21,6 +21,7 @@
"${WEBKIT2_DIR}/Shared/Databases"
"${WEBKIT2_DIR}/Shared/Databases/IndexedDB"
"${WEBKIT2_DIR}/Shared/FileAPI"
+ "${WEBKIT2_DIR}/Shared/Gamepad"
"${WEBKIT2_DIR}/Shared/Plugins"
"${WEBKIT2_DIR}/Shared/Plugins/Netscape"
"${WEBKIT2_DIR}/Shared/Plugins/Netscape/x11"
Modified: trunk/Source/WebKit2/ChangeLog (204296 => 204297)
--- trunk/Source/WebKit2/ChangeLog 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/ChangeLog 2016-08-09 21:29:05 UTC (rev 204297)
@@ -1,3 +1,74 @@
+2016-08-09 Brady Eidson <beid...@apple.com>
+
+ Implement "dumb" WK2 support for gamepads.
+ https://bugs.webkit.org/show_bug.cgi?id=160700
+
+ Reviewed by Alex Christensen.
+
+ With this patch, gamepads work in WK2.
+
+ Things known to be missing to make this mechanism more "smart":
+ - Refresh values along with display sync instead of on a 60hz timer (bug 160673)
+ - Only send updated values to the current focused web page (bug 160699)
+
+ * CMakeLists.txt:
+ * WebKit2.xcodeproj/project.pbxproj:
+
+ * Shared/Gamepad/GamepadData.cpp: Copied from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
+ (WebKit::GamepadData::encode):
+ (WebKit::GamepadData::decode):
+ (WebKit::GamepadData::isNull):
+ (WebKit::GamepadData::loggingString):
+ * Shared/Gamepad/GamepadData.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepad.h.
+
+ * UIProcess/Gamepad/UIGamepad.cpp: Copied from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
+ (WebKit::UIGamepad::UIGamepad):
+ (WebKit::UIGamepad::updateFromPlatformGamepad):
+ (WebKit::UIGamepad::gamepadData):
+ * UIProcess/Gamepad/UIGamepad.h: Copied from Source/WebKit2/WebProcess/Gamepad/WebGamepad.h.
+ (WebKit::UIGamepad::index):
+
+ * UIProcess/Gamepad/UIGamepadProvider.cpp:
+ (WebKit::UIGamepadProvider::UIGamepadProvider):
+ (WebKit::UIGamepadProvider::updateTimerFired):
+ (WebKit::UIGamepadProvider::startOrStopSynchingGamepadState):
+ (WebKit::UIGamepadProvider::platformGamepadConnected):
+ (WebKit::UIGamepadProvider::platformGamepadDisconnected):
+ (WebKit::UIGamepadProvider::platformGamepadInputActivity):
+ (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
+ (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
+ (WebKit::UIGamepadProvider::platformGamepads):
+ * UIProcess/Gamepad/UIGamepadProvider.h:
+ * UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp:
+ (WebKit::UIGamepadProvider::platformGamepads):
+
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::gamepadConnected):
+ (WebKit::WebProcessPool::gamepadDisconnected):
+ (WebKit::WebProcessPool::gamepadActivity):
+ * UIProcess/WebProcessPool.h:
+
+ * WebProcess/Gamepad/WebGamepad.cpp:
+ (WebKit::WebGamepad::WebGamepad):
+ (WebKit::WebGamepad::axisValues):
+ (WebKit::WebGamepad::buttonValues):
+ (WebKit::WebGamepad::updateValues):
+ * WebProcess/Gamepad/WebGamepad.h:
+
+ * WebProcess/Gamepad/WebGamepadProvider.cpp:
+ (WebKit::WebGamepadProvider::gamepadConnected):
+ (WebKit::WebGamepadProvider::gamepadDisconnected):
+ (WebKit::WebGamepadProvider::gamepadActivity):
+ (WebKit::WebGamepadProvider::platformGamepads):
+ * WebProcess/Gamepad/WebGamepadProvider.h:
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::gamepadConnected):
+ (WebKit::WebProcess::gamepadDisconnected):
+ (WebKit::WebProcess::gamepadActivity):
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+
2016-08-09 Anders Carlsson <ander...@apple.com>
Get rid of PluginStrategy
Copied: trunk/Source/WebKit2/Shared/Gamepad/GamepadData.cpp (from rev 204296, trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp) (0 => 204297)
--- trunk/Source/WebKit2/Shared/Gamepad/GamepadData.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/Gamepad/GamepadData.cpp 2016-08-09 21:29:05 UTC (rev 204297)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GamepadData.h"
+
+#if ENABLE(GAMEPAD)
+
+#include "ArgumentCoders.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebKit {
+
+void GamepadData::encode(IPC::ArgumentEncoder& encoder) const
+{
+ encoder << index << axisValues << buttonValues;
+}
+
+bool GamepadData::decode(IPC::ArgumentDecoder& decoder, GamepadData& data)
+{
+ if (!decoder.decode(data.index))
+ return false;
+
+ if (!decoder.decode(data.axisValues))
+ return false;
+
+ if (!decoder.decode(data.buttonValues))
+ return false;
+
+ return true;
+}
+
+bool GamepadData::isNull() const
+{
+ return !index && axisValues.isEmpty() && buttonValues.isEmpty();
+}
+
+String GamepadData::loggingString() const
+{
+ StringBuilder builder;
+
+ builder.append(makeString(String::number(axisValues.size()), " axes, ", String::number(buttonValues.size()), " buttons\n"));
+
+ for (size_t i = 0; i < axisValues.size(); ++i)
+ builder.append(makeString(" Axis ", String::number(i), ": ", String::number(axisValues[i])));
+
+ builder.append("\n");
+ for (size_t i = 0; i < buttonValues.size(); ++i)
+ builder.append(makeString(" Button ", String::number(i), ": ", String::number(buttonValues[i])));
+
+ return builder.toString();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(GAMEPAD)
Copied: trunk/Source/WebKit2/Shared/Gamepad/GamepadData.h (from rev 204296, trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h) (0 => 204297)
--- trunk/Source/WebKit2/Shared/Gamepad/GamepadData.h (rev 0)
+++ trunk/Source/WebKit2/Shared/Gamepad/GamepadData.h 2016-08-09 21:29:05 UTC (rev 204297)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(GAMEPAD)
+
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace IPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+struct GamepadData {
+ void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, GamepadData&);
+
+ bool isNull() const;
+
+ unsigned index;
+ Vector<double> axisValues;
+ Vector<double> buttonValues;
+
+ String loggingString() const;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(GAMEPAD)
Copied: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.cpp (from rev 204296, trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp) (0 => 204297)
--- trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.cpp 2016-08-09 21:29:05 UTC (rev 204297)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "UIGamepad.h"
+
+#if ENABLE(GAMEPAD)
+
+#include "GamepadData.h"
+#include <WebCore/PlatformGamepad.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+UIGamepad::UIGamepad(WebCore::PlatformGamepad& platformGamepad)
+ : m_index(platformGamepad.index())
+{
+ m_axisValues.resize(platformGamepad.axisValues().size());
+ m_buttonValues.resize(platformGamepad.buttonValues().size());
+
+ updateFromPlatformGamepad(platformGamepad);
+}
+
+void UIGamepad::updateFromPlatformGamepad(WebCore::PlatformGamepad& platformGamepad)
+{
+ ASSERT(m_index == platformGamepad.index());
+ ASSERT(m_axisValues.size() == platformGamepad.axisValues().size());
+ ASSERT(m_buttonValues.size() == platformGamepad.buttonValues().size());
+
+ m_axisValues = platformGamepad.axisValues();
+ m_buttonValues = platformGamepad.buttonValues();
+}
+
+GamepadData UIGamepad::gamepadData() const
+{
+ return { m_index, m_axisValues, m_buttonValues };
+}
+
+}
+
+#endif // ENABLE(GAMEPAD)
Copied: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.h (from rev 204296, trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h) (0 => 204297)
--- trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.h 2016-08-09 21:29:05 UTC (rev 204297)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(GAMEPAD)
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+class PlatformGamepad;
+}
+
+namespace WebKit {
+
+struct GamepadData;
+
+class UIGamepad {
+public:
+ UIGamepad(WebCore::PlatformGamepad&);
+
+ unsigned index() const { return m_index; }
+
+ GamepadData gamepadData() const;
+
+ void updateFromPlatformGamepad(WebCore::PlatformGamepad&);
+
+private:
+ unsigned m_index;
+ Vector<double> m_axisValues;
+ Vector<double> m_buttonValues;
+};
+
+}
+
+#endif // ENABLE(GAMEPAD)
Modified: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp (204296 => 204297)
--- trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp 2016-08-09 21:29:05 UTC (rev 204297)
@@ -28,6 +28,9 @@
#if ENABLE(GAMEPAD)
+#include "GamepadData.h"
+#include "UIGamepad.h"
+#include "WebProcessPool.h"
#include <WebCore/HIDGamepadProvider.h>
#include <wtf/NeverDestroyed.h>
@@ -35,6 +38,8 @@
namespace WebKit {
+static const double gamepadUpdateInterval = 1 / 60.0;
+
UIGamepadProvider& UIGamepadProvider::singleton()
{
static NeverDestroyed<UIGamepadProvider> sharedProvider;
@@ -42,6 +47,7 @@
}
UIGamepadProvider::UIGamepadProvider()
+ : m_timer(*this, &UIGamepadProvider::updateTimerFired)
{
}
@@ -51,16 +57,86 @@
platformStopMonitoringGamepads();
}
-void UIGamepadProvider::platformGamepadConnected(PlatformGamepad&)
+void UIGamepadProvider::updateTimerFired()
{
+ if (!m_hadActivitySinceLastSynch)
+ return;
+
+ Vector<GamepadData> gamepadDatas;
+ gamepadDatas.reserveInitialCapacity(m_gamepads.size());
+
+ for (auto& gamepad : m_gamepads) {
+ if (gamepad)
+ gamepadDatas.uncheckedAppend(gamepad->gamepadData());
+ else
+ gamepadDatas.uncheckedAppend({ });
+ }
+
+ // FIXME (https://bugs.webkit.org/show_bug.cgi?id=160699)
+ // Only send updates to the process pool that contains the currently focused web page.
+ for (auto& pool : m_processPoolsUsingGamepads)
+ pool->gamepadActivity(gamepadDatas);
+
+ m_hadActivitySinceLastSynch = false;
}
-void UIGamepadProvider::platformGamepadDisconnected(PlatformGamepad&)
+void UIGamepadProvider::startOrStopSynchingGamepadState()
{
+ // FIXME (https://bugs.webkit.org/show_bug.cgi?id=160699)
+ // Only start synching updates if the currently focused WKWebView is also listening for gamepads.
+
+ // FIXME (https://bugs.webkit.org/show_bug.cgi?id=160673)
+ // Instead of refreshing gamepad data on a 60hz timer, actually sync with the display.
+ if (m_gamepads.isEmpty() || m_processPoolsUsingGamepads.isEmpty())
+ m_timer.stop();
+ else
+ m_timer.startRepeating(gamepadUpdateInterval);
}
+void UIGamepadProvider::platformGamepadConnected(PlatformGamepad& gamepad)
+{
+ if (m_gamepads.size() <= gamepad.index())
+ m_gamepads.resize(gamepad.index() + 1);
+
+ ASSERT(!m_gamepads[gamepad.index()]);
+ m_gamepads[gamepad.index()] = std::make_unique<UIGamepad>(gamepad);
+
+ m_hadActivitySinceLastSynch = true;
+ startOrStopSynchingGamepadState();
+
+ for (auto& pool : m_processPoolsUsingGamepads)
+ pool->gamepadConnected(*m_gamepads[gamepad.index()]);
+}
+
+void UIGamepadProvider::platformGamepadDisconnected(PlatformGamepad& gamepad)
+{
+ ASSERT(gamepad.index() < m_gamepads.size());
+ ASSERT(m_gamepads[gamepad.index()]);
+
+ std::unique_ptr<UIGamepad> disconnectedGamepad = WTFMove(m_gamepads[gamepad.index()]);
+
+ startOrStopSynchingGamepadState();
+
+ for (auto& pool : m_processPoolsUsingGamepads)
+ pool->gamepadDisconnected(*disconnectedGamepad);
+}
+
void UIGamepadProvider::platformGamepadInputActivity()
{
+ auto platformGamepads = this->platformGamepads();
+ ASSERT(platformGamepads.size() == m_gamepads.size());
+
+ for (size_t i = 0; i < platformGamepads.size(); ++i) {
+ if (!platformGamepads[i]) {
+ ASSERT(!m_gamepads[i]);
+ continue;
+ }
+
+ ASSERT(m_gamepads[i]);
+ m_gamepads[i]->updateFromPlatformGamepad(*platformGamepads[i]);
+ }
+
+ m_hadActivitySinceLastSynch = true;
}
void UIGamepadProvider::processPoolStartedUsingGamepads(WebProcessPool& pool)
@@ -72,6 +148,8 @@
if (!wereAnyProcessPoolsUsingGamepads)
platformStartMonitoringGamepads();
+
+ startOrStopSynchingGamepadState();
}
void UIGamepadProvider::processPoolStoppedUsingGamepads(WebProcessPool& pool)
@@ -83,9 +161,12 @@
if (wereAnyProcessPoolsUsingGamepads && m_processPoolsUsingGamepads.isEmpty())
platformStopMonitoringGamepads();
+
+ startOrStopSynchingGamepadState();
}
#if !PLATFORM(MAC)
+
void UIGamepadProvider::platformStartMonitoringGamepads()
{
// FIXME: Implement for other platforms
@@ -95,6 +176,15 @@
{
// FIXME: Implement for other platforms
}
+
+const Vector<PlatformGamepad*>& UIGamepadProvider::platformGamepads()
+{
+ static NeverDestroyed<Vector<PlatformGamepad*>> emptyGamepads;
+ return emptyGamepads;
+
+ // FIXME: Implement for other platforms
+}
+
#endif // !PLATFORM(MAC)
}
Modified: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h (204296 => 204297)
--- trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h 2016-08-09 21:29:05 UTC (rev 204297)
@@ -28,12 +28,16 @@
#if ENABLE(GAMEPAD)
#include <WebCore/GamepadProviderClient.h>
+#include <WebCore/Timer.h>
#include <wtf/HashSet.h>
#include <wtf/NeverDestroyed.h>
+#include <wtf/Vector.h>
namespace WebKit {
+class UIGamepad;
class WebProcessPool;
+struct GamepadData;
class UIGamepadProvider : public WebCore::GamepadProviderClient {
public:
@@ -42,6 +46,8 @@
void processPoolStartedUsingGamepads(WebProcessPool&);
void processPoolStoppedUsingGamepads(WebProcessPool&);
+ Vector<GamepadData> gamepadStates() const;
+
private:
friend NeverDestroyed<UIGamepadProvider>;
UIGamepadProvider();
@@ -49,12 +55,21 @@
void platformStartMonitoringGamepads();
void platformStopMonitoringGamepads();
+ const Vector<WebCore::PlatformGamepad*>& platformGamepads();
void platformGamepadConnected(WebCore::PlatformGamepad&) final;
void platformGamepadDisconnected(WebCore::PlatformGamepad&) final;
void platformGamepadInputActivity() final;
+ void startOrStopSynchingGamepadState();
+ void updateTimerFired();
+
HashSet<WebProcessPool*> m_processPoolsUsingGamepads;
+
+ Vector<std::unique_ptr<UIGamepad>> m_gamepads;
+
+ WebCore::Timer m_timer;
+ bool m_hadActivitySinceLastSynch { false };
};
}
Modified: trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp (204296 => 204297)
--- trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp 2016-08-09 21:29:05 UTC (rev 204297)
@@ -46,6 +46,11 @@
HIDGamepadProvider::singleton().stopMonitoringGamepads(*this);
}
+const Vector<PlatformGamepad*>& UIGamepadProvider::platformGamepads()
+{
+ return HIDGamepadProvider::singleton().platformGamepads();
}
+}
+
#endif // ENABLE(GAMEPAD)
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (204296 => 204297)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2016-08-09 21:29:05 UTC (rev 204297)
@@ -35,6 +35,7 @@
#include "CustomProtocolManagerMessages.h"
#include "DownloadProxy.h"
#include "DownloadProxyMessages.h"
+#include "GamepadData.h"
#include "LogInitialization.h"
#include "NetworkProcessCreationParameters.h"
#include "NetworkProcessMessages.h"
@@ -42,6 +43,7 @@
#include "SandboxExtension.h"
#include "StatisticsData.h"
#include "TextChecker.h"
+#include "UIGamepad.h"
#include "UIGamepadProvider.h"
#include "WKContextPrivate.h"
#include "WebAutomationSession.h"
@@ -1280,6 +1282,26 @@
UIGamepadProvider::singleton().processPoolStoppedUsingGamepads(*this);
}
+void WebProcessPool::gamepadConnected(const UIGamepad& gamepad)
+{
+ for (auto& process : m_processesUsingGamepads)
+ process->send(Messages::WebProcess::GamepadConnected(gamepad.gamepadData()), 0);
+}
+
+void WebProcessPool::gamepadDisconnected(const UIGamepad& gamepad)
+{
+ for (auto& process : m_processesUsingGamepads)
+ process->send(Messages::WebProcess::GamepadDisconnected(gamepad.index()), 0);
+}
+
+void WebProcessPool::gamepadActivity(const Vector<GamepadData>& gamepadDatas)
+{
+ // FIXME (https://bugs.webkit.org/show_bug.cgi?id=160699)
+ // Only send updates to the process that contains the currently focused web page.
+ for (auto& process : m_processesUsingGamepads)
+ process->send(Messages::WebProcess::GamepadActivity(gamepadDatas), 0);
+}
+
#endif // ENABLE(GAMEPAD)
void WebProcessPool::garbageCollectJavaScriptObjects()
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (204296 => 204297)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2016-08-09 21:29:05 UTC (rev 204297)
@@ -79,11 +79,13 @@
namespace WebKit {
class DownloadProxy;
+class UIGamepad;
class WebAutomationSession;
class WebContextSupplement;
class WebIconDatabase;
class WebPageGroup;
class WebPageProxy;
+struct GamepadData;
struct NetworkProcessCreationParameters;
struct StatisticsData;
struct WebProcessCreationParameters;
@@ -369,6 +371,12 @@
bool resourceLoadStatisticsEnabled() { return m_resourceLoadStatisticsEnabled; }
void setResourceLoadStatisticsEnabled(bool enabled) { m_resourceLoadStatisticsEnabled = enabled; }
+#if ENABLE(GAMEPAD)
+ void gamepadConnected(const UIGamepad&);
+ void gamepadDisconnected(const UIGamepad&);
+ void gamepadActivity(const Vector<GamepadData>&);
+#endif
+
private:
void platformInitialize();
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (204296 => 204297)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-08-09 21:29:05 UTC (rev 204297)
@@ -942,6 +942,12 @@
515BE1A71D55293400DD7C68 /* UIGamepadProviderHID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */; };
515BE1A81D55293400DD7C68 /* UIGamepadProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1A41D55292800DD7C68 /* UIGamepadProvider.cpp */; };
515BE1A91D55293400DD7C68 /* UIGamepadProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 515BE1A51D55292800DD7C68 /* UIGamepadProvider.h */; };
+ 515BE1AA1D555A9B00DD7C68 /* WebGamepad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE19F1D550AB000DD7C68 /* WebGamepad.cpp */; };
+ 515BE1AB1D555AA000DD7C68 /* WebGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 515BE1A01D550AB000DD7C68 /* WebGamepad.h */; };
+ 515BE1B21D5902DD00DD7C68 /* GamepadData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1B11D5902B600DD7C68 /* GamepadData.cpp */; };
+ 515BE1B31D5902DD00DD7C68 /* GamepadData.h in Headers */ = {isa = PBXBuildFile; fileRef = 515BE1B01D59006900DD7C68 /* GamepadData.h */; };
+ 515BE1B41D5917FF00DD7C68 /* UIGamepad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1AC1D555C5100DD7C68 /* UIGamepad.cpp */; };
+ 515BE1B51D5917FF00DD7C68 /* UIGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 515BE1AD1D555C5100DD7C68 /* UIGamepad.h */; };
515E7727183DD6F60007203F /* AsyncRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515E7725183DD6F60007203F /* AsyncRequest.cpp */; };
515E7728183DD6F60007203F /* AsyncRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 515E7726183DD6F60007203F /* AsyncRequest.h */; };
515E772B184008B90007203F /* DatabaseProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515E7729184008B90007203F /* DatabaseProcessCreationParameters.cpp */; };
@@ -2990,6 +2996,10 @@
515BE1A41D55292800DD7C68 /* UIGamepadProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIGamepadProvider.cpp; sourceTree = "<group>"; };
515BE1A51D55292800DD7C68 /* UIGamepadProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGamepadProvider.h; sourceTree = "<group>"; };
515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIGamepadProviderHID.cpp; path = UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp; sourceTree = SOURCE_ROOT; };
+ 515BE1AC1D555C5100DD7C68 /* UIGamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIGamepad.cpp; sourceTree = "<group>"; };
+ 515BE1AD1D555C5100DD7C68 /* UIGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGamepad.h; sourceTree = "<group>"; };
+ 515BE1B01D59006900DD7C68 /* GamepadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadData.h; sourceTree = "<group>"; };
+ 515BE1B11D5902B600DD7C68 /* GamepadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GamepadData.cpp; sourceTree = "<group>"; };
515E7725183DD6F60007203F /* AsyncRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncRequest.cpp; sourceTree = "<group>"; };
515E7726183DD6F60007203F /* AsyncRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncRequest.h; sourceTree = "<group>"; };
515E7729184008B90007203F /* DatabaseProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseProcessCreationParameters.cpp; sourceTree = "<group>"; };
@@ -4476,6 +4486,7 @@
51E351C2180F2C8500E53BE9 /* Databases */,
BC82836816B3587900A278FE /* EntryPointUtilities */,
E170877216D6CFEC00F99226 /* FileAPI */,
+ 515BE1AE1D59003400DD7C68 /* Gamepad */,
2DA944961884E4DA00ED86DB /* ios */,
BC111B5A112F628200337BAB /* mac */,
1AAE058C1279DCD400852418 /* Plugins */,
@@ -5501,6 +5512,8 @@
isa = PBXGroup;
children = (
515BE1A11D5523B300DD7C68 /* mac */,
+ 515BE1AC1D555C5100DD7C68 /* UIGamepad.cpp */,
+ 515BE1AD1D555C5100DD7C68 /* UIGamepad.h */,
515BE1A41D55292800DD7C68 /* UIGamepadProvider.cpp */,
515BE1A51D55292800DD7C68 /* UIGamepadProvider.h */,
);
@@ -5516,6 +5529,15 @@
path = UIProcess/Gamepad/mac;
sourceTree = "<group>";
};
+ 515BE1AE1D59003400DD7C68 /* Gamepad */ = {
+ isa = PBXGroup;
+ children = (
+ 515BE1B11D5902B600DD7C68 /* GamepadData.cpp */,
+ 515BE1B01D59006900DD7C68 /* GamepadData.h */,
+ );
+ path = Gamepad;
+ sourceTree = "<group>";
+ };
516319931628980E00E22F00 /* mac */ = {
isa = PBXGroup;
children = (
@@ -7427,6 +7449,7 @@
1AE286781C7E76510069AC4F /* _WKWebsiteDataSize.h in Headers */,
1AE286801C7F92C00069AC4F /* _WKWebsiteDataSizeInternal.h in Headers */,
1AFB4C721ADF155D00B33339 /* _WKWebsiteDataStore.h in Headers */,
+ 515BE1B31D5902DD00DD7C68 /* GamepadData.h in Headers */,
1A4A93B71AEB08EA00150E9C /* _WKWebsiteDataStoreInternal.h in Headers */,
A115DC72191D82DA00DA8072 /* _WKWebViewPrintFormatter.h in Headers */,
A19DD3C01D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h in Headers */,
@@ -7753,6 +7776,7 @@
E1790891169BAA82006904C7 /* SecItemShimMessages.h in Headers */,
E18E690C169B563F009B6670 /* SecItemShimProxy.h in Headers */,
E18E6918169B667B009B6670 /* SecItemShimProxyMessages.h in Headers */,
+ 515BE1B51D5917FF00DD7C68 /* UIGamepad.h in Headers */,
514D9F5719119D35000063A7 /* ServicesController.h in Headers */,
1AFDE65A1954A42B00C48FFA /* SessionState.h in Headers */,
1A002D49196B345D00B9AD44 /* SessionStateCoding.h in Headers */,
@@ -7893,6 +7917,7 @@
2D3EF4431917646300034184 /* WebMemoryPressureHandlerIOS.h in Headers */,
909854ED12BC4E18000AD080 /* WebMemorySampler.h in Headers */,
BCF69F9A1176CED600471A52 /* WebNavigationDataStore.h in Headers */,
+ 515BE1AB1D555AA000DD7C68 /* WebGamepad.h in Headers */,
7CCCC8FB1A5F50FD008FB0DA /* WebNavigationState.h in Headers */,
31A2EC49148997C200810D71 /* WebNotification.h in Headers */,
310999C7146C9E3D0029DEB9 /* WebNotificationClient.h in Headers */,
@@ -9181,6 +9206,7 @@
1A043CEB124FE38F00FFBFB5 /* PluginProcessMessageReceiver.cpp in Sources */,
1A0EC75F124BC7B2007EF4A5 /* PluginProcessProxy.cpp in Sources */,
1A2D90BB1281C931001EB962 /* PluginProcessProxyMac.mm in Sources */,
+ 515BE1B41D5917FF00DD7C68 /* UIGamepad.cpp in Sources */,
1A043B5D124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp in Sources */,
1A043DC2124FF87500FFBFB5 /* PluginProxy.cpp in Sources */,
1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */,
@@ -9199,6 +9225,7 @@
2D47B56C1810714E003A3AEE /* RemoteLayerBackingStore.mm in Sources */,
2DDF731618E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm in Sources */,
1AB16AE9164B3A8800290D62 /* RemoteLayerTreeContext.mm in Sources */,
+ 515BE1B21D5902DD00DD7C68 /* GamepadData.cpp in Sources */,
2D29ECD1192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm in Sources */,
1AB16ADD1648598400290D62 /* RemoteLayerTreeDrawingArea.mm in Sources */,
1AB16AE11648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm in Sources */,
@@ -9494,6 +9521,7 @@
7C361D78192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp in Sources */,
15739BBE1B42046600D258C1 /* WebUserMediaClient.cpp in Sources */,
52D5A1B71C574A0200DE34A3 /* WebVideoFullscreenManager.mm in Sources */,
+ 515BE1AA1D555A9B00DD7C68 /* WebGamepad.cpp in Sources */,
3F418EF91887BD97002795FD /* WebVideoFullscreenManagerMessageReceiver.cpp in Sources */,
52D5A1B11C57496200DE34A3 /* WebVideoFullscreenManagerProxy.mm in Sources */,
3F418EFB1887BD97002795FD /* WebVideoFullscreenManagerProxyMessageReceiver.cpp in Sources */,
Modified: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.cpp (204296 => 204297)
--- trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.cpp 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.cpp 2016-08-09 21:29:05 UTC (rev 204297)
@@ -28,8 +28,40 @@
#if ENABLE(GAMEPAD)
+#include "GamepadData.h"
+
namespace WebKit {
+WebGamepad::WebGamepad(const GamepadData& gamepadData)
+ : PlatformGamepad(gamepadData.index)
+{
+ m_axisValues.resize(gamepadData.axisValues.size());
+ m_buttonValues.resize(gamepadData.buttonValues.size());
+
+ updateValues(gamepadData);
}
+const Vector<double>& WebGamepad::axisValues() const
+{
+ return m_axisValues;
+}
+
+const Vector<double>& WebGamepad::buttonValues() const
+{
+ return m_buttonValues;
+}
+
+void WebGamepad::updateValues(const GamepadData& gamepadData)
+{
+ ASSERT(!gamepadData.isNull());
+ ASSERT(gamepadData.index == index());
+ ASSERT(m_axisValues.size() == gamepadData.axisValues.size());
+ ASSERT(m_buttonValues.size() == gamepadData.buttonValues.size());
+
+ m_axisValues = gamepadData.axisValues;
+ m_buttonValues = gamepadData.buttonValues;
+}
+
+}
+
#endif // ENABLE(GAMEPAD)
Modified: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h (204296 => 204297)
--- trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h 2016-08-09 21:29:05 UTC (rev 204297)
@@ -27,8 +27,28 @@
#if ENABLE(GAMEPAD)
+#include <WebCore/PlatformGamepad.h>
+
namespace WebKit {
+class SharedMemory;
+
+struct GamepadData;
+
+class WebGamepad : public WebCore::PlatformGamepad {
+public:
+ WebGamepad(const GamepadData&);
+
+ const Vector<double>& axisValues() const override;
+ const Vector<double>& buttonValues() const override;
+
+ void updateValues(const GamepadData&);
+
+private:
+ Vector<double> m_axisValues;
+ Vector<double> m_buttonValues;
+};
+
}
#endif // ENABLE(GAMEPAD)
Modified: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp (204296 => 204297)
--- trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp 2016-08-09 21:29:05 UTC (rev 204297)
@@ -28,8 +28,11 @@
#if ENABLE(GAMEPAD)
+#include "GamepadData.h"
+#include "WebGamepad.h"
#include "WebProcess.h"
#include "WebProcessPoolMessages.h"
+#include <WebCore/GamepadProviderClient.h>
#include <wtf/NeverDestroyed.h>
using namespace WebCore;
@@ -50,6 +53,47 @@
{
}
+void WebGamepadProvider::gamepadConnected(const GamepadData& gamepadData)
+{
+ if (m_gamepads.size() <= gamepadData.index) {
+ m_gamepads.resize(gamepadData.index + 1);
+ m_rawGamepads.resize(gamepadData.index + 1);
+ }
+
+ ASSERT(!m_gamepads[gamepadData.index]);
+
+ m_gamepads[gamepadData.index] = std::make_unique<WebGamepad>(gamepadData);
+ m_rawGamepads[gamepadData.index] = m_gamepads[gamepadData.index].get();
+
+ for (auto* client : m_clients)
+ client->platformGamepadConnected(*m_gamepads[gamepadData.index]);
+}
+
+
+void WebGamepadProvider::gamepadDisconnected(unsigned index)
+{
+ ASSERT(m_gamepads.size() > index);
+
+ std::unique_ptr<WebGamepad> disconnectedGamepad = WTFMove(m_gamepads[index]);
+ m_rawGamepads[index] = nullptr;
+
+ for (auto* client : m_clients)
+ client->platformGamepadDisconnected(*disconnectedGamepad);
+}
+
+void WebGamepadProvider::gamepadActivity(const Vector<GamepadData>& gamepadDatas)
+{
+ ASSERT(m_gamepads.size() == gamepadDatas.size());
+
+ for (size_t i = 0; i < m_gamepads.size(); ++i) {
+ if (m_gamepads[i])
+ m_gamepads[i]->updateValues(gamepadDatas[i]);
+ }
+
+ for (auto* client : m_clients)
+ client->platformGamepadInputActivity();
+}
+
void WebGamepadProvider::startMonitoringGamepads(GamepadProviderClient& client)
{
bool processHadGamepadClients = !m_clients.isEmpty();
@@ -74,8 +118,7 @@
const Vector<PlatformGamepad*>& WebGamepadProvider::platformGamepads()
{
- static NeverDestroyed<Vector<PlatformGamepad*>> gamepads;
- return gamepads;
+ return m_rawGamepads;
}
}
Modified: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h (204296 => 204297)
--- trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h 2016-08-09 21:29:05 UTC (rev 204297)
@@ -33,10 +33,19 @@
namespace WebKit {
+class SharedMemory;
+class WebGamepad;
+
+struct GamepadData;
+
class WebGamepadProvider : public WebCore::GamepadProvider {
public:
static WebGamepadProvider& singleton();
+ void gamepadConnected(const GamepadData&);
+ void gamepadDisconnected(unsigned index);
+ void gamepadActivity(const Vector<GamepadData>&);
+
private:
friend NeverDestroyed<WebGamepadProvider>;
WebGamepadProvider();
@@ -47,8 +56,11 @@
const Vector<WebCore::PlatformGamepad*>& platformGamepads() final;
HashSet<WebCore::GamepadProviderClient*> m_clients;
+
+ Vector<std::unique_ptr<WebGamepad>> m_gamepads;
+ Vector<WebCore::PlatformGamepad*> m_rawGamepads;
};
-}
+} // namespace WebKit
#endif // ENABLE(GAMEPAD)
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (204296 => 204297)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-08-09 21:29:05 UTC (rev 204297)
@@ -1030,6 +1030,25 @@
parentProcessConnection()->send(Messages::WebProcessProxy::DidReceiveMainThreadPing(), 0);
}
+#if ENABLE(GAMEPAD)
+
+void WebProcess::gamepadConnected(const GamepadData& gamepadData)
+{
+ WebGamepadProvider::singleton().gamepadConnected(gamepadData);
+}
+
+void WebProcess::gamepadDisconnected(unsigned index)
+{
+ WebGamepadProvider::singleton().gamepadDisconnected(index);
+}
+
+void WebProcess::gamepadActivity(const Vector<GamepadData>& gamepadDatas)
+{
+ WebGamepadProvider::singleton().gamepadActivity(gamepadDatas);
+}
+
+#endif
+
void WebProcess::setJavaScriptGarbageCollectorTimerEnabled(bool flag)
{
GCController::singleton().setJavaScriptGarbageCollectorTimerEnabled(flag);
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (204296 => 204297)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2016-08-09 21:29:05 UTC (rev 204297)
@@ -87,6 +87,7 @@
class WebPageGroupProxy;
class WebProcessSupplement;
enum class WebsiteDataType;
+struct GamepadData;
struct WebPageCreationParameters;
struct WebPageGroupData;
struct WebPreferencesStore;
@@ -275,6 +276,12 @@
void mainThreadPing();
+#if ENABLE(GAMEPAD)
+ void gamepadConnected(const GamepadData&);
+ void gamepadDisconnected(unsigned index);
+ void gamepadActivity(const Vector<GamepadData>&);
+#endif
+
void releasePageCache();
void fetchWebsiteData(WebCore::SessionID, OptionSet<WebsiteDataType>, uint64_t callbackID);
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (204296 => 204297)
--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2016-08-09 21:22:54 UTC (rev 204296)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2016-08-09 21:29:05 UTC (rev 204297)
@@ -101,4 +101,10 @@
ProcessDidResume()
MainThreadPing()
+
+#if ENABLE(GAMEPAD)
+ GamepadConnected(struct WebKit::GamepadData gamepadData)
+ GamepadDisconnected(unsigned index)
+ GamepadActivity(Vector<WebKit::GamepadData> gamepadDatas)
+#endif
}