<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[204297] trunk/Source/WebKit2</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/204297">204297</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-08-09 14:29:05 -0700 (Tue, 09 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>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:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2CMakeListstxt">trunk/Source/WebKit2/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessGamepadUIGamepadProvidercpp">trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessGamepadUIGamepadProviderh">trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp">trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolcpp">trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolh">trunk/Source/WebKit2/UIProcess/WebProcessPool.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessGamepadWebGamepadcpp">trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessGamepadWebGamepadh">trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessGamepadWebGamepadProvidercpp">trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessGamepadWebGamepadProviderh">trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessh">trunk/Source/WebKit2/WebProcess/WebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessmessagesin">trunk/Source/WebKit2/WebProcess/WebProcess.messages.in</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebKit2/Shared/Gamepad/</li>
<li><a href="#trunkSourceWebKit2SharedGamepadGamepadDatacpp">trunk/Source/WebKit2/Shared/Gamepad/GamepadData.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedGamepadGamepadDatah">trunk/Source/WebKit2/Shared/Gamepad/GamepadData.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessGamepadUIGamepadcpp">trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessGamepadUIGamepadh">trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> "${WEBKIT2_DIR}/Shared/Databases"
</span><span class="cx"> "${WEBKIT2_DIR}/Shared/Databases/IndexedDB"
</span><span class="cx"> "${WEBKIT2_DIR}/Shared/FileAPI"
</span><ins>+ "${WEBKIT2_DIR}/Shared/Gamepad"
</ins><span class="cx"> "${WEBKIT2_DIR}/Shared/Plugins"
</span><span class="cx"> "${WEBKIT2_DIR}/Shared/Plugins/Netscape"
</span><span class="cx"> "${WEBKIT2_DIR}/Shared/Plugins/Netscape/x11"
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,74 @@
</span><ins>+2016-08-09 Brady Eidson <beidson@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:
+
</ins><span class="cx"> 2016-08-09 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Get rid of PluginStrategy
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedGamepadGamepadDatacppfromrev204296trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/Gamepad/GamepadData.cpp (from rev 204296, trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp) (0 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * 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)
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedGamepadGamepadDatahfromrev204296trunkSourceWebKit2WebProcessGamepadWebGamepadh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/Gamepad/GamepadData.h (from rev 204296, trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h) (0 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+/*
+ * 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)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadUIGamepadcppfromrev204296trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.cpp (from rev 204296, trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp) (0 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+/*
+ * 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)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadUIGamepadhfromrev204296trunkSourceWebKit2WebProcessGamepadWebGamepadh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepad.h (from rev 204296, trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h) (0 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * 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)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadUIGamepadProvidercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,6 +28,9 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx">
</span><ins>+#include "GamepadData.h"
+#include "UIGamepad.h"
+#include "WebProcessPool.h"
</ins><span class="cx"> #include <WebCore/HIDGamepadProvider.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="lines">@@ -35,6 +38,8 @@
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+static const double gamepadUpdateInterval = 1 / 60.0;
+
</ins><span class="cx"> UIGamepadProvider& UIGamepadProvider::singleton()
</span><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<UIGamepadProvider> sharedProvider;
</span><span class="lines">@@ -42,6 +47,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> UIGamepadProvider::UIGamepadProvider()
</span><ins>+ : m_timer(*this, &UIGamepadProvider::updateTimerFired)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -51,16 +57,86 @@
</span><span class="cx"> platformStopMonitoringGamepads();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void UIGamepadProvider::platformGamepadConnected(PlatformGamepad&)
</del><ins>+void UIGamepadProvider::updateTimerFired()
</ins><span class="cx"> {
</span><ins>+ 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;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void UIGamepadProvider::platformGamepadDisconnected(PlatformGamepad&)
</del><ins>+void UIGamepadProvider::startOrStopSynchingGamepadState()
</ins><span class="cx"> {
</span><ins>+ // 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);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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);
+}
+
</ins><span class="cx"> void UIGamepadProvider::platformGamepadInputActivity()
</span><span class="cx"> {
</span><ins>+ 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;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void UIGamepadProvider::processPoolStartedUsingGamepads(WebProcessPool& pool)
</span><span class="lines">@@ -72,6 +148,8 @@
</span><span class="cx">
</span><span class="cx"> if (!wereAnyProcessPoolsUsingGamepads)
</span><span class="cx"> platformStartMonitoringGamepads();
</span><ins>+
+ startOrStopSynchingGamepadState();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void UIGamepadProvider::processPoolStoppedUsingGamepads(WebProcessPool& pool)
</span><span class="lines">@@ -83,9 +161,12 @@
</span><span class="cx">
</span><span class="cx"> if (wereAnyProcessPoolsUsingGamepads && m_processPoolsUsingGamepads.isEmpty())
</span><span class="cx"> platformStopMonitoringGamepads();
</span><ins>+
+ startOrStopSynchingGamepadState();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if !PLATFORM(MAC)
</span><ins>+
</ins><span class="cx"> void UIGamepadProvider::platformStartMonitoringGamepads()
</span><span class="cx"> {
</span><span class="cx"> // FIXME: Implement for other platforms
</span><span class="lines">@@ -95,6 +176,15 @@
</span><span class="cx"> {
</span><span class="cx"> // FIXME: Implement for other platforms
</span><span class="cx"> }
</span><ins>+
+const Vector<PlatformGamepad*>& UIGamepadProvider::platformGamepads()
+{
+ static NeverDestroyed<Vector<PlatformGamepad*>> emptyGamepads;
+ return emptyGamepads;
+
+ // FIXME: Implement for other platforms
+}
+
</ins><span class="cx"> #endif // !PLATFORM(MAC)
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadUIGamepadProviderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,12 +28,16 @@
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx">
</span><span class="cx"> #include <WebCore/GamepadProviderClient.h>
</span><ins>+#include <WebCore/Timer.h>
</ins><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><ins>+#include <wtf/Vector.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+class UIGamepad;
</ins><span class="cx"> class WebProcessPool;
</span><ins>+struct GamepadData;
</ins><span class="cx">
</span><span class="cx"> class UIGamepadProvider : public WebCore::GamepadProviderClient {
</span><span class="cx"> public:
</span><span class="lines">@@ -42,6 +46,8 @@
</span><span class="cx"> void processPoolStartedUsingGamepads(WebProcessPool&);
</span><span class="cx"> void processPoolStoppedUsingGamepads(WebProcessPool&);
</span><span class="cx">
</span><ins>+ Vector<GamepadData> gamepadStates() const;
+
</ins><span class="cx"> private:
</span><span class="cx"> friend NeverDestroyed<UIGamepadProvider>;
</span><span class="cx"> UIGamepadProvider();
</span><span class="lines">@@ -49,12 +55,21 @@
</span><span class="cx">
</span><span class="cx"> void platformStartMonitoringGamepads();
</span><span class="cx"> void platformStopMonitoringGamepads();
</span><ins>+ const Vector<WebCore::PlatformGamepad*>& platformGamepads();
</ins><span class="cx">
</span><span class="cx"> void platformGamepadConnected(WebCore::PlatformGamepad&) final;
</span><span class="cx"> void platformGamepadDisconnected(WebCore::PlatformGamepad&) final;
</span><span class="cx"> void platformGamepadInputActivity() final;
</span><span class="cx">
</span><ins>+ void startOrStopSynchingGamepadState();
+ void updateTimerFired();
+
</ins><span class="cx"> HashSet<WebProcessPool*> m_processPoolsUsingGamepads;
</span><ins>+
+ Vector<std::unique_ptr<UIGamepad>> m_gamepads;
+
+ WebCore::Timer m_timer;
+ bool m_hadActivitySinceLastSynch { false };
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -46,6 +46,11 @@
</span><span class="cx"> HIDGamepadProvider::singleton().stopMonitoringGamepads(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+const Vector<PlatformGamepad*>& UIGamepadProvider::platformGamepads()
+{
+ return HIDGamepadProvider::singleton().platformGamepads();
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+}
+
</ins><span class="cx"> #endif // ENABLE(GAMEPAD)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include "CustomProtocolManagerMessages.h"
</span><span class="cx"> #include "DownloadProxy.h"
</span><span class="cx"> #include "DownloadProxyMessages.h"
</span><ins>+#include "GamepadData.h"
</ins><span class="cx"> #include "LogInitialization.h"
</span><span class="cx"> #include "NetworkProcessCreationParameters.h"
</span><span class="cx"> #include "NetworkProcessMessages.h"
</span><span class="lines">@@ -42,6 +43,7 @@
</span><span class="cx"> #include "SandboxExtension.h"
</span><span class="cx"> #include "StatisticsData.h"
</span><span class="cx"> #include "TextChecker.h"
</span><ins>+#include "UIGamepad.h"
</ins><span class="cx"> #include "UIGamepadProvider.h"
</span><span class="cx"> #include "WKContextPrivate.h"
</span><span class="cx"> #include "WebAutomationSession.h"
</span><span class="lines">@@ -1280,6 +1282,26 @@
</span><span class="cx"> UIGamepadProvider::singleton().processPoolStoppedUsingGamepads(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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);
+}
+
</ins><span class="cx"> #endif // ENABLE(GAMEPAD)
</span><span class="cx">
</span><span class="cx"> void WebProcessPool::garbageCollectJavaScriptObjects()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -79,11 +79,13 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> class DownloadProxy;
</span><ins>+class UIGamepad;
</ins><span class="cx"> class WebAutomationSession;
</span><span class="cx"> class WebContextSupplement;
</span><span class="cx"> class WebIconDatabase;
</span><span class="cx"> class WebPageGroup;
</span><span class="cx"> class WebPageProxy;
</span><ins>+struct GamepadData;
</ins><span class="cx"> struct NetworkProcessCreationParameters;
</span><span class="cx"> struct StatisticsData;
</span><span class="cx"> struct WebProcessCreationParameters;
</span><span class="lines">@@ -369,6 +371,12 @@
</span><span class="cx"> bool resourceLoadStatisticsEnabled() { return m_resourceLoadStatisticsEnabled; }
</span><span class="cx"> void setResourceLoadStatisticsEnabled(bool enabled) { m_resourceLoadStatisticsEnabled = enabled; }
</span><span class="cx">
</span><ins>+#if ENABLE(GAMEPAD)
+ void gamepadConnected(const UIGamepad&);
+ void gamepadDisconnected(const UIGamepad&);
+ void gamepadActivity(const Vector<GamepadData>&);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> void platformInitialize();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -942,6 +942,12 @@
</span><span class="cx">                 515BE1A71D55293400DD7C68 /* UIGamepadProviderHID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */; };
</span><span class="cx">                 515BE1A81D55293400DD7C68 /* UIGamepadProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1A41D55292800DD7C68 /* UIGamepadProvider.cpp */; };
</span><span class="cx">                 515BE1A91D55293400DD7C68 /* UIGamepadProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 515BE1A51D55292800DD7C68 /* UIGamepadProvider.h */; };
</span><ins>+                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 */; };
</ins><span class="cx">                 515E7727183DD6F60007203F /* AsyncRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515E7725183DD6F60007203F /* AsyncRequest.cpp */; };
</span><span class="cx">                 515E7728183DD6F60007203F /* AsyncRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 515E7726183DD6F60007203F /* AsyncRequest.h */; };
</span><span class="cx">                 515E772B184008B90007203F /* DatabaseProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515E7729184008B90007203F /* DatabaseProcessCreationParameters.cpp */; };
</span><span class="lines">@@ -2990,6 +2996,10 @@
</span><span class="cx">                 515BE1A41D55292800DD7C68 /* UIGamepadProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIGamepadProvider.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 515BE1A51D55292800DD7C68 /* UIGamepadProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGamepadProvider.h; sourceTree = "<group>"; };
</span><span class="cx">                 515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIGamepadProviderHID.cpp; path = UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp; sourceTree = SOURCE_ROOT; };
</span><ins>+                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>"; };
</ins><span class="cx">                 515E7725183DD6F60007203F /* AsyncRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncRequest.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 515E7726183DD6F60007203F /* AsyncRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncRequest.h; sourceTree = "<group>"; };
</span><span class="cx">                 515E7729184008B90007203F /* DatabaseProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseProcessCreationParameters.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -4476,6 +4486,7 @@
</span><span class="cx">                                 51E351C2180F2C8500E53BE9 /* Databases */,
</span><span class="cx">                                 BC82836816B3587900A278FE /* EntryPointUtilities */,
</span><span class="cx">                                 E170877216D6CFEC00F99226 /* FileAPI */,
</span><ins>+                                515BE1AE1D59003400DD7C68 /* Gamepad */,
</ins><span class="cx">                                 2DA944961884E4DA00ED86DB /* ios */,
</span><span class="cx">                                 BC111B5A112F628200337BAB /* mac */,
</span><span class="cx">                                 1AAE058C1279DCD400852418 /* Plugins */,
</span><span class="lines">@@ -5501,6 +5512,8 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 515BE1A11D5523B300DD7C68 /* mac */,
</span><ins>+                                515BE1AC1D555C5100DD7C68 /* UIGamepad.cpp */,
+                                515BE1AD1D555C5100DD7C68 /* UIGamepad.h */,
</ins><span class="cx">                                 515BE1A41D55292800DD7C68 /* UIGamepadProvider.cpp */,
</span><span class="cx">                                 515BE1A51D55292800DD7C68 /* UIGamepadProvider.h */,
</span><span class="cx">                         );
</span><span class="lines">@@ -5516,6 +5529,15 @@
</span><span class="cx">                         path = UIProcess/Gamepad/mac;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><ins>+                515BE1AE1D59003400DD7C68 /* Gamepad */ = {
+                        isa = PBXGroup;
+                        children = (
+                                515BE1B11D5902B600DD7C68 /* GamepadData.cpp */,
+                                515BE1B01D59006900DD7C68 /* GamepadData.h */,
+                        );
+                        path = Gamepad;
+                        sourceTree = "<group>";
+                };
</ins><span class="cx">                 516319931628980E00E22F00 /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -7427,6 +7449,7 @@
</span><span class="cx">                                 1AE286781C7E76510069AC4F /* _WKWebsiteDataSize.h in Headers */,
</span><span class="cx">                                 1AE286801C7F92C00069AC4F /* _WKWebsiteDataSizeInternal.h in Headers */,
</span><span class="cx">                                 1AFB4C721ADF155D00B33339 /* _WKWebsiteDataStore.h in Headers */,
</span><ins>+                                515BE1B31D5902DD00DD7C68 /* GamepadData.h in Headers */,
</ins><span class="cx">                                 1A4A93B71AEB08EA00150E9C /* _WKWebsiteDataStoreInternal.h in Headers */,
</span><span class="cx">                                 A115DC72191D82DA00DA8072 /* _WKWebViewPrintFormatter.h in Headers */,
</span><span class="cx">                                 A19DD3C01D07D16800AC823B /* _WKWebViewPrintFormatterInternal.h in Headers */,
</span><span class="lines">@@ -7753,6 +7776,7 @@
</span><span class="cx">                                 E1790891169BAA82006904C7 /* SecItemShimMessages.h in Headers */,
</span><span class="cx">                                 E18E690C169B563F009B6670 /* SecItemShimProxy.h in Headers */,
</span><span class="cx">                                 E18E6918169B667B009B6670 /* SecItemShimProxyMessages.h in Headers */,
</span><ins>+                                515BE1B51D5917FF00DD7C68 /* UIGamepad.h in Headers */,
</ins><span class="cx">                                 514D9F5719119D35000063A7 /* ServicesController.h in Headers */,
</span><span class="cx">                                 1AFDE65A1954A42B00C48FFA /* SessionState.h in Headers */,
</span><span class="cx">                                 1A002D49196B345D00B9AD44 /* SessionStateCoding.h in Headers */,
</span><span class="lines">@@ -7893,6 +7917,7 @@
</span><span class="cx">                                 2D3EF4431917646300034184 /* WebMemoryPressureHandlerIOS.h in Headers */,
</span><span class="cx">                                 909854ED12BC4E18000AD080 /* WebMemorySampler.h in Headers */,
</span><span class="cx">                                 BCF69F9A1176CED600471A52 /* WebNavigationDataStore.h in Headers */,
</span><ins>+                                515BE1AB1D555AA000DD7C68 /* WebGamepad.h in Headers */,
</ins><span class="cx">                                 7CCCC8FB1A5F50FD008FB0DA /* WebNavigationState.h in Headers */,
</span><span class="cx">                                 31A2EC49148997C200810D71 /* WebNotification.h in Headers */,
</span><span class="cx">                                 310999C7146C9E3D0029DEB9 /* WebNotificationClient.h in Headers */,
</span><span class="lines">@@ -9181,6 +9206,7 @@
</span><span class="cx">                                 1A043CEB124FE38F00FFBFB5 /* PluginProcessMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 1A0EC75F124BC7B2007EF4A5 /* PluginProcessProxy.cpp in Sources */,
</span><span class="cx">                                 1A2D90BB1281C931001EB962 /* PluginProcessProxyMac.mm in Sources */,
</span><ins>+                                515BE1B41D5917FF00DD7C68 /* UIGamepad.cpp in Sources */,
</ins><span class="cx">                                 1A043B5D124D5E9D00FFBFB5 /* PluginProcessProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 1A043DC2124FF87500FFBFB5 /* PluginProxy.cpp in Sources */,
</span><span class="cx">                                 1A2D92211281DC1B001EB962 /* PluginProxyMac.mm in Sources */,
</span><span class="lines">@@ -9199,6 +9225,7 @@
</span><span class="cx">                                 2D47B56C1810714E003A3AEE /* RemoteLayerBackingStore.mm in Sources */,
</span><span class="cx">                                 2DDF731618E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm in Sources */,
</span><span class="cx">                                 1AB16AE9164B3A8800290D62 /* RemoteLayerTreeContext.mm in Sources */,
</span><ins>+                                515BE1B21D5902DD00DD7C68 /* GamepadData.cpp in Sources */,
</ins><span class="cx">                                 2D29ECD1192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm in Sources */,
</span><span class="cx">                                 1AB16ADD1648598400290D62 /* RemoteLayerTreeDrawingArea.mm in Sources */,
</span><span class="cx">                                 1AB16AE11648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm in Sources */,
</span><span class="lines">@@ -9494,6 +9521,7 @@
</span><span class="cx">                                 7C361D78192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 15739BBE1B42046600D258C1 /* WebUserMediaClient.cpp in Sources */,
</span><span class="cx">                                 52D5A1B71C574A0200DE34A3 /* WebVideoFullscreenManager.mm in Sources */,
</span><ins>+                                515BE1AA1D555A9B00DD7C68 /* WebGamepad.cpp in Sources */,
</ins><span class="cx">                                 3F418EF91887BD97002795FD /* WebVideoFullscreenManagerMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 52D5A1B11C57496200DE34A3 /* WebVideoFullscreenManagerProxy.mm in Sources */,
</span><span class="cx">                                 3F418EFB1887BD97002795FD /* WebVideoFullscreenManagerProxyMessageReceiver.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessGamepadWebGamepadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.cpp (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,8 +28,40 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx">
</span><ins>+#include "GamepadData.h"
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+WebGamepad::WebGamepad(const GamepadData& gamepadData)
+ : PlatformGamepad(gamepadData.index)
+{
+ m_axisValues.resize(gamepadData.axisValues.size());
+ m_buttonValues.resize(gamepadData.buttonValues.size());
+
+ updateValues(gamepadData);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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;
+}
+
+}
+
</ins><span class="cx"> #endif // ENABLE(GAMEPAD)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessGamepadWebGamepadh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -27,8 +27,28 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx">
</span><ins>+#include <WebCore/PlatformGamepad.h>
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+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;
+};
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(GAMEPAD)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessGamepadWebGamepadProvidercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,8 +28,11 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(GAMEPAD)
</span><span class="cx">
</span><ins>+#include "GamepadData.h"
+#include "WebGamepad.h"
</ins><span class="cx"> #include "WebProcess.h"
</span><span class="cx"> #include "WebProcessPoolMessages.h"
</span><ins>+#include <WebCore/GamepadProviderClient.h>
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -50,6 +53,47 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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();
+}
+
</ins><span class="cx"> void WebGamepadProvider::startMonitoringGamepads(GamepadProviderClient& client)
</span><span class="cx"> {
</span><span class="cx"> bool processHadGamepadClients = !m_clients.isEmpty();
</span><span class="lines">@@ -74,8 +118,7 @@
</span><span class="cx">
</span><span class="cx"> const Vector<PlatformGamepad*>& WebGamepadProvider::platformGamepads()
</span><span class="cx"> {
</span><del>- static NeverDestroyed<Vector<PlatformGamepad*>> gamepads;
- return gamepads;
</del><ins>+ return m_rawGamepads;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessGamepadWebGamepadProviderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -33,10 +33,19 @@
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+class SharedMemory;
+class WebGamepad;
+
+struct GamepadData;
+
</ins><span class="cx"> class WebGamepadProvider : public WebCore::GamepadProvider {
</span><span class="cx"> public:
</span><span class="cx"> static WebGamepadProvider& singleton();
</span><span class="cx">
</span><ins>+ void gamepadConnected(const GamepadData&);
+ void gamepadDisconnected(unsigned index);
+ void gamepadActivity(const Vector<GamepadData>&);
+
</ins><span class="cx"> private:
</span><span class="cx"> friend NeverDestroyed<WebGamepadProvider>;
</span><span class="cx"> WebGamepadProvider();
</span><span class="lines">@@ -47,8 +56,11 @@
</span><span class="cx"> const Vector<WebCore::PlatformGamepad*>& platformGamepads() final;
</span><span class="cx">
</span><span class="cx"> HashSet<WebCore::GamepadProviderClient*> m_clients;
</span><ins>+
+ Vector<std::unique_ptr<WebGamepad>> m_gamepads;
+ Vector<WebCore::PlatformGamepad*> m_rawGamepads;
</ins><span class="cx"> };
</span><span class="cx">
</span><del>-}
</del><ins>+} // namespace WebKit
</ins><span class="cx">
</span><span class="cx"> #endif // ENABLE(GAMEPAD)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1030,6 +1030,25 @@
</span><span class="cx"> parentProcessConnection()->send(Messages::WebProcessProxy::DidReceiveMainThreadPing(), 0);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#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
+
</ins><span class="cx"> void WebProcess::setJavaScriptGarbageCollectorTimerEnabled(bool flag)
</span><span class="cx"> {
</span><span class="cx"> GCController::singleton().setJavaScriptGarbageCollectorTimerEnabled(flag);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -87,6 +87,7 @@
</span><span class="cx"> class WebPageGroupProxy;
</span><span class="cx"> class WebProcessSupplement;
</span><span class="cx"> enum class WebsiteDataType;
</span><ins>+struct GamepadData;
</ins><span class="cx"> struct WebPageCreationParameters;
</span><span class="cx"> struct WebPageGroupData;
</span><span class="cx"> struct WebPreferencesStore;
</span><span class="lines">@@ -275,6 +276,12 @@
</span><span class="cx">
</span><span class="cx"> void mainThreadPing();
</span><span class="cx">
</span><ins>+#if ENABLE(GAMEPAD)
+ void gamepadConnected(const GamepadData&);
+ void gamepadDisconnected(unsigned index);
+ void gamepadActivity(const Vector<GamepadData>&);
+#endif
+
</ins><span class="cx"> void releasePageCache();
</span><span class="cx">
</span><span class="cx"> void fetchWebsiteData(WebCore::SessionID, OptionSet<WebsiteDataType>, uint64_t callbackID);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (204296 => 204297)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -101,4 +101,10 @@
</span><span class="cx"> ProcessDidResume()
</span><span class="cx">
</span><span class="cx"> MainThreadPing()
</span><ins>+
+#if ENABLE(GAMEPAD)
+ GamepadConnected(struct WebKit::GamepadData gamepadData)
+ GamepadDisconnected(unsigned index)
+ GamepadActivity(Vector<WebKit::GamepadData> gamepadDatas)
+#endif
</ins><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>