<!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>[204222] 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/204222">204222</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-08-06 01:00:20 -0700 (Sat, 06 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Lay WebProcess/UIProcess groundwork for an IPC GamepadProvider.
https://bugs.webkit.org/show_bug.cgi?id=160605

Reviewed by Alex Christensen.

This patch:
  - Introduces the GamepadProvider that the WebProcess will use (WebGamepadProvider)
  - Has that provider message to the UIProcess notifying interest in gamepad state
  - Introduces a GamepadProviderClient in the UIProcess (UIGamepadProvider) that will use
    one of the existing GamepadProviders to pass gamepad state along to WebProcesses.
  - Adds an empty skeleton for the soon-to-be-used WebGamepad, which will be the
    &quot;PlatformGamepad&quot; for WebProcesses.

* CMakeLists.txt:
* WebKit2.xcodeproj/project.pbxproj:

* UIProcess/Gamepads/UIGamepadProvider.cpp: Added.
(WebKit::UIGamepadProvider::singleton):
(WebKit::UIGamepadProvider::UIGamepadProvider):
(WebKit::UIGamepadProvider::~UIGamepadProvider):
(WebKit::UIGamepadProvider::platformGamepadConnected):
(WebKit::UIGamepadProvider::platformGamepadDisconnected):
(WebKit::UIGamepadProvider::platformGamepadInputActivity):
(WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
(WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
(WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
(WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
* UIProcess/Gamepads/UIGamepadProvider.h: Added.

* UIProcess/Gamepads/mac/UIGamepadProviderHID.cpp: Added.
(WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
(WebKit::UIGamepadProvider::platformStopMonitoringGamepads):

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::~WebProcessPool):
(WebKit::WebProcessPool::disconnectProcess):
(WebKit::WebProcessPool::startedUsingGamepads):
(WebKit::WebProcessPool::stoppedUsingGamepads):
(WebKit::WebProcessPool::processStoppedUsingGamepads):
* UIProcess/WebProcessPool.h:
* UIProcess/WebProcessPool.messages.in:

* WebProcess/Gamepad/WebGamepad.cpp: Added.
* WebProcess/Gamepad/WebGamepad.h: Added.

* WebProcess/Gamepad/WebGamepadProvider.cpp: Added.
(WebKit::WebGamepadProvider::singleton):
(WebKit::WebGamepadProvider::WebGamepadProvider):
(WebKit::WebGamepadProvider::~WebGamepadProvider):
(WebKit::WebGamepadProvider::startMonitoringGamepads):
(WebKit::WebGamepadProvider::stopMonitoringGamepads):
(WebKit::WebGamepadProvider::platformGamepads):
* WebProcess/Gamepad/WebGamepadProvider.h: Added.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):</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="#trunkSourceWebKit2UIProcessWebProcessPoolcpp">trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolh">trunk/Source/WebKit2/UIProcess/WebProcessPool.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolmessagesin">trunk/Source/WebKit2/UIProcess/WebProcessPool.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebKit2/UIProcess/Gamepad/</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>trunk/Source/WebKit2/UIProcess/Gamepad/mac/</li>
<li><a href="#trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp">trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp</a></li>
<li>trunk/Source/WebKit2/WebProcess/Gamepad/</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (204221 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/CMakeLists.txt        2016-08-06 06:28:24 UTC (rev 204221)
+++ trunk/Source/WebKit2/CMakeLists.txt        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/Automation&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/Databases&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/Downloads&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/UIProcess/Gamepad&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/InspectorServer&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/Launcher&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/UIProcess/Network&quot;
</span><span class="lines">@@ -53,6 +54,7 @@
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/Databases/IndexedDB&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/FileAPI&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/FullScreen&quot;
</span><ins>+    &quot;${WEBKIT2_DIR}/WebProcess/Gamepad&quot;
</ins><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/Geolocation&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/IconDatabase&quot;
</span><span class="cx">     &quot;${WEBKIT2_DIR}/WebProcess/InjectedBundle&quot;
</span><span class="lines">@@ -478,6 +480,8 @@
</span><span class="cx">     UIProcess/Downloads/DownloadProxy.cpp
</span><span class="cx">     UIProcess/Downloads/DownloadProxyMap.cpp
</span><span class="cx"> 
</span><ins>+    UIProcess/Gamepad/UIGamepadProvider.cpp
+
</ins><span class="cx">     UIProcess/InspectorServer/HTTPRequest.cpp
</span><span class="cx">     UIProcess/InspectorServer/WebInspectorServer.cpp
</span><span class="cx">     UIProcess/InspectorServer/WebSocketServer.cpp
</span><span class="lines">@@ -525,6 +529,9 @@
</span><span class="cx"> 
</span><span class="cx">     WebProcess/FullScreen/WebFullScreenManager.cpp
</span><span class="cx"> 
</span><ins>+    WebProcess/Gamepad/WebGamepad.cpp
+    WebProcess/Gamepad/WebGamepadProvider.cpp
+
</ins><span class="cx">     WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
</span><span class="cx">     WebProcess/Geolocation/WebGeolocationManager.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (204221 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-08-06 06:28:24 UTC (rev 204221)
+++ trunk/Source/WebKit2/ChangeLog        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2016-08-06  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Lay WebProcess/UIProcess groundwork for an IPC GamepadProvider.
+        https://bugs.webkit.org/show_bug.cgi?id=160605
+
+        Reviewed by Alex Christensen.
+
+        This patch:
+          - Introduces the GamepadProvider that the WebProcess will use (WebGamepadProvider)
+          - Has that provider message to the UIProcess notifying interest in gamepad state
+          - Introduces a GamepadProviderClient in the UIProcess (UIGamepadProvider) that will use
+            one of the existing GamepadProviders to pass gamepad state along to WebProcesses.
+          - Adds an empty skeleton for the soon-to-be-used WebGamepad, which will be the 
+            &quot;PlatformGamepad&quot; for WebProcesses.
+
+        * CMakeLists.txt:
+        * WebKit2.xcodeproj/project.pbxproj:
+
+        * UIProcess/Gamepads/UIGamepadProvider.cpp: Added.
+        (WebKit::UIGamepadProvider::singleton):
+        (WebKit::UIGamepadProvider::UIGamepadProvider):
+        (WebKit::UIGamepadProvider::~UIGamepadProvider):
+        (WebKit::UIGamepadProvider::platformGamepadConnected):
+        (WebKit::UIGamepadProvider::platformGamepadDisconnected):
+        (WebKit::UIGamepadProvider::platformGamepadInputActivity):
+        (WebKit::UIGamepadProvider::processPoolStartedUsingGamepads):
+        (WebKit::UIGamepadProvider::processPoolStoppedUsingGamepads):
+        (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
+        (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
+        * UIProcess/Gamepads/UIGamepadProvider.h: Added.
+
+        * UIProcess/Gamepads/mac/UIGamepadProviderHID.cpp: Added.
+        (WebKit::UIGamepadProvider::platformStartMonitoringGamepads):
+        (WebKit::UIGamepadProvider::platformStopMonitoringGamepads):
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::~WebProcessPool):
+        (WebKit::WebProcessPool::disconnectProcess):
+        (WebKit::WebProcessPool::startedUsingGamepads):
+        (WebKit::WebProcessPool::stoppedUsingGamepads):
+        (WebKit::WebProcessPool::processStoppedUsingGamepads):
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebProcessPool.messages.in:
+                
+        * WebProcess/Gamepad/WebGamepad.cpp: Added.
+        * WebProcess/Gamepad/WebGamepad.h: Added.
+        
+        * WebProcess/Gamepad/WebGamepadProvider.cpp: Added.
+        (WebKit::WebGamepadProvider::singleton):
+        (WebKit::WebGamepadProvider::WebGamepadProvider):
+        (WebKit::WebGamepadProvider::~WebGamepadProvider):
+        (WebKit::WebGamepadProvider::startMonitoringGamepads):
+        (WebKit::WebGamepadProvider::stopMonitoringGamepads):
+        (WebKit::WebGamepadProvider::platformGamepads):
+        * WebProcess/Gamepad/WebGamepadProvider.h: Added.
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+
</ins><span class="cx"> 2016-08-05  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r204195.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadUIGamepadProvidercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp (0 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -0,0 +1,98 @@
</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 &quot;config.h&quot;
+#include &quot;UIGamepadProvider.h&quot;
+
+#if ENABLE(GAMEPAD)
+
+#include &lt;WebCore/HIDGamepadProvider.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+UIGamepadProvider&amp; UIGamepadProvider::singleton()
+{
+    static NeverDestroyed&lt;UIGamepadProvider&gt; sharedProvider;
+    return sharedProvider;
+}
+
+UIGamepadProvider::UIGamepadProvider()
+{
+}
+
+UIGamepadProvider::~UIGamepadProvider()
+{
+    if (!m_processPoolsUsingGamepads.isEmpty())
+        platformStopMonitoringGamepads();
+}
+
+void UIGamepadProvider::platformGamepadConnected(PlatformGamepad&amp;)
+{
+}
+
+void UIGamepadProvider::platformGamepadDisconnected(PlatformGamepad&amp;)
+{
+}
+
+void UIGamepadProvider::platformGamepadInputActivity()
+{
+}
+
+void UIGamepadProvider::processPoolStartedUsingGamepads(WebProcessPool&amp; pool)
+{
+    ASSERT(!m_processPoolsUsingGamepads.contains(&amp;pool));
+    m_processPoolsUsingGamepads.add(&amp;pool);
+
+    if (m_processPoolsUsingGamepads.size() == 1)
+        platformStartMonitoringGamepads();
+}
+
+void UIGamepadProvider::processPoolStoppedUsingGamepads(WebProcessPool&amp; pool)
+{
+    ASSERT(m_processPoolsUsingGamepads.contains(&amp;pool));
+    m_processPoolsUsingGamepads.remove(&amp;pool);
+
+    if (m_processPoolsUsingGamepads.isEmpty())
+        platformStopMonitoringGamepads();
+}
+
+#if !PLATFORM(MAC)
+void UIGamepadProvider::platformStartMonitoringGamepads()
+{
+    // FIXME: Implement for other platforms
+}
+
+void UIGamepadProvider::platformStopMonitoringGamepads()
+{
+    // FIXME: Implement for other platforms
+}
+#endif // !PLATFORM(MAC)
+
+}
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadUIGamepadProviderh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h (0 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -0,0 +1,61 @@
</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 &lt;WebCore/GamepadProvider.h&gt;
+#include &lt;WebCore/GamepadProviderClient.h&gt;
+#include &lt;wtf/HashSet.h&gt;
+
+namespace WebKit {
+
+class WebProcessPool;
+
+class UIGamepadProvider : public WebCore::GamepadProviderClient {
+public:
+    UIGamepadProvider();
+    ~UIGamepadProvider() final;
+
+    static UIGamepadProvider&amp; singleton();
+
+    void platformGamepadConnected(WebCore::PlatformGamepad&amp;) final;
+    void platformGamepadDisconnected(WebCore::PlatformGamepad&amp;) final;
+    void platformGamepadInputActivity() final;
+
+    void processPoolStartedUsingGamepads(WebProcessPool&amp;);
+    void processPoolStoppedUsingGamepads(WebProcessPool&amp;);
+
+private:
+    void platformStartMonitoringGamepads();
+    void platformStopMonitoringGamepads();
+
+    HashSet&lt;WebProcessPool*&gt; m_processPoolsUsingGamepads;
+};
+
+}
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp (0 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -0,0 +1,51 @@
</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 &quot;config.h&quot;
+#include &quot;UIGamepadProvider.h&quot;
+
+#if ENABLE(GAMEPAD)
+
+#include &lt;WebCore/HIDGamepadProvider.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void UIGamepadProvider::platformStartMonitoringGamepads()
+{
+    ASSERT(!m_processPoolsUsingGamepads.isEmpty());
+    HIDGamepadProvider::singleton().startMonitoringGamepads(this);
+}
+
+void UIGamepadProvider::platformStopMonitoringGamepads()
+{
+    ASSERT(m_processPoolsUsingGamepads.isEmpty());
+    HIDGamepadProvider::singleton().stopMonitoringGamepads(this);
+}
+
+}
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (204221 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2016-08-06 06:28:24 UTC (rev 204221)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include &quot;SandboxExtension.h&quot;
</span><span class="cx"> #include &quot;StatisticsData.h&quot;
</span><span class="cx"> #include &quot;TextChecker.h&quot;
</span><ins>+#include &quot;UIGamepadProvider.h&quot;
</ins><span class="cx"> #include &quot;WKContextPrivate.h&quot;
</span><span class="cx"> #include &quot;WebAutomationSession.h&quot;
</span><span class="cx"> #include &quot;WebCertificateInfo.h&quot;
</span><span class="lines">@@ -259,6 +260,11 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_networkProcess)
</span><span class="cx">         m_networkProcess-&gt;shutDownProcess();
</span><ins>+
+#if ENABLE(GAMEPAD)
+    if (!m_processesUsingGamepads.isEmpty())
+        UIGamepadProvider::singleton().processPoolStoppedUsingGamepads(*this);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebProcessPool::initializeClient(const WKContextClientBase* client)
</span><span class="lines">@@ -752,6 +758,11 @@
</span><span class="cx">     static_cast&lt;WebContextSupplement*&gt;(supplement&lt;WebGeolocationManagerProxy&gt;())-&gt;processDidClose(process);
</span><span class="cx"> 
</span><span class="cx">     m_processes.removeFirst(process);
</span><ins>+
+#if ENABLE(GAMEPAD)
+    if (m_processesUsingGamepads.contains(process))
+        processStoppedUsingGamepads(process);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebProcessProxy&amp; WebProcessPool::createNewWebProcessRespectingProcessCountLimit()
</span><span class="lines">@@ -1231,6 +1242,42 @@
</span><span class="cx">     request-&gt;completedRequest(requestID, statisticsData);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(GAMEPAD)
+
+void WebProcessPool::startedUsingGamepads(IPC::Connection&amp; connection)
+{
+    auto* webProcessProxy = WebProcessProxy::fromConnection(&amp;connection);
+    if (!webProcessProxy)
+        return;
+
+    ASSERT(!m_processesUsingGamepads.contains(webProcessProxy));
+    m_processesUsingGamepads.add(webProcessProxy);
+
+    if (m_processesUsingGamepads.size() == 1)
+        UIGamepadProvider::singleton().processPoolStartedUsingGamepads(*this);
+}
+
+void WebProcessPool::stoppedUsingGamepads(IPC::Connection&amp; connection)
+{
+    auto* webProcessProxy = WebProcessProxy::fromConnection(&amp;connection);
+    if (!webProcessProxy)
+        return;
+
+    ASSERT(m_processesUsingGamepads.contains(webProcessProxy));
+    processStoppedUsingGamepads(webProcessProxy);
+}
+
+void WebProcessPool::processStoppedUsingGamepads(WebProcessProxy* webProcessProxy)
+{
+    ASSERT(m_processesUsingGamepads.contains(webProcessProxy));
+    m_processesUsingGamepads.remove(webProcessProxy);
+
+    if (m_processesUsingGamepads.isEmpty())
+        UIGamepadProvider::singleton().processPoolStoppedUsingGamepads(*this);
+}
+
+#endif // ENABLE(GAMEPAD)
+
</ins><span class="cx"> void WebProcessPool::garbageCollectJavaScriptObjects()
</span><span class="cx"> {
</span><span class="cx">     sendToAllProcesses(Messages::WebProcess::GarbageCollectJavaScriptObjects());
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (204221 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2016-08-06 06:28:24 UTC (rev 204221)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -387,6 +387,15 @@
</span><span class="cx"> 
</span><span class="cx">     void didGetStatistics(const StatisticsData&amp;, uint64_t callbackID);
</span><span class="cx"> 
</span><ins>+#if ENABLE(GAMEPAD)
+    void startedUsingGamepads(IPC::Connection&amp;);
+    void stoppedUsingGamepads(IPC::Connection&amp;);
+
+    void processStoppedUsingGamepads(WebProcessProxy*);
+
+    HashSet&lt;WebProcessProxy*&gt; m_processesUsingGamepads;
+#endif
+
</ins><span class="cx">     // IPC::MessageReceiver.
</span><span class="cx">     // Implemented in generated WebProcessPoolMessageReceiver.cpp
</span><span class="cx">     void didReceiveMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.messages.in (204221 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.messages.in        2016-08-06 06:28:24 UTC (rev 204221)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.messages.in        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -26,6 +26,11 @@
</span><span class="cx"> 
</span><span class="cx">     DidGetStatistics(struct WebKit::StatisticsData statisticsData, uint64_t callbackID)
</span><span class="cx"> 
</span><ins>+#if ENABLE(GAMEPAD)
+    StartedUsingGamepads() WantsConnection
+    StoppedUsingGamepads() WantsConnection
+#endif
+
</ins><span class="cx">     # Plug-in messages.
</span><span class="cx">     void AddPlugInAutoStartOriginHash(String pageOrigin, uint32_t hash, WebCore::SessionID sessionID)
</span><span class="cx">     void PlugInDidReceiveUserInteraction(uint32_t hash, WebCore::SessionID sessionID)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (204221 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-08-06 06:28:24 UTC (rev 204221)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -936,6 +936,11 @@
</span><span class="cx">                 514D9F5719119D35000063A7 /* ServicesController.h in Headers */ = {isa = PBXBuildFile; fileRef = 514D9F5519119D35000063A7 /* ServicesController.h */; };
</span><span class="cx">                 514D9F5819119D35000063A7 /* ServicesController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514D9F5619119D35000063A7 /* ServicesController.mm */; };
</span><span class="cx">                 51578B831209ECEF00A37C4A /* APIData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* APIData.h */; };
</span><ins>+                515BE1771D53FE8700DD7C68 /* WebGamepadProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1731D53FDDC00DD7C68 /* WebGamepadProvider.cpp */; };
+                515BE1791D53FE8F00DD7C68 /* WebGamepadProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 515BE1741D53FDDC00DD7C68 /* WebGamepadProvider.h */; };
+                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 */; };
</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">@@ -2975,6 +2980,13 @@
</span><span class="cx">                 514D9F5519119D35000063A7 /* ServicesController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServicesController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 514D9F5619119D35000063A7 /* ServicesController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ServicesController.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51578B821209ECEF00A37C4A /* APIData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                515BE1731D53FDDC00DD7C68 /* WebGamepadProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGamepadProvider.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                515BE1741D53FDDC00DD7C68 /* WebGamepadProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGamepadProvider.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                515BE19F1D550AB000DD7C68 /* WebGamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGamepad.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                515BE1A01D550AB000DD7C68 /* WebGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGamepad.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                515BE1A41D55292800DD7C68 /* UIGamepadProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIGamepadProvider.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                515BE1A51D55292800DD7C68 /* UIGamepadProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGamepadProvider.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIGamepadProviderHID.cpp; path = UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp; sourceTree = SOURCE_ROOT; };
</ins><span class="cx">                 515E7725183DD6F60007203F /* AsyncRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncRequest.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 515E7726183DD6F60007203F /* AsyncRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncRequest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 515E7729184008B90007203F /* DatabaseProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseProcessCreationParameters.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5469,6 +5481,36 @@
</span><span class="cx">                         path = Authentication;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                515BE1721D53FDB900DD7C68 /* Gamepad */ = {
+                        isa = PBXGroup;
+                        children = (
+                                515BE19F1D550AB000DD7C68 /* WebGamepad.cpp */,
+                                515BE1A01D550AB000DD7C68 /* WebGamepad.h */,
+                                515BE1731D53FDDC00DD7C68 /* WebGamepadProvider.cpp */,
+                                515BE1741D53FDDC00DD7C68 /* WebGamepadProvider.h */,
+                        );
+                        path = Gamepad;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
+                515BE17B1D54EF5A00DD7C68 /* Gamepad */ = {
+                        isa = PBXGroup;
+                        children = (
+                                515BE1A11D5523B300DD7C68 /* mac */,
+                                515BE1A41D55292800DD7C68 /* UIGamepadProvider.cpp */,
+                                515BE1A51D55292800DD7C68 /* UIGamepadProvider.h */,
+                        );
+                        path = Gamepad;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
+                515BE1A11D5523B300DD7C68 /* mac */ = {
+                        isa = PBXGroup;
+                        children = (
+                                515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */,
+                        );
+                        name = mac;
+                        path = UIProcess/Gamepad/mac;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 516319931628980E00E22F00 /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -5813,6 +5855,7 @@
</span><span class="cx">                                 BCACC43B16B24C5D00B6E092 /* EntryPoint */,
</span><span class="cx">                                 E170876D16D6CA7200F99226 /* FileAPI */,
</span><span class="cx">                                 CD73BA3D131A2A2100EEDED2 /* FullScreen */,
</span><ins>+                                515BE1721D53FDB900DD7C68 /* Gamepad */,
</ins><span class="cx">                                 BC0E5FCB12D696DD0012A72A /* Geolocation */,
</span><span class="cx">                                 51FBB9C1132E079200F327B4 /* IconDatabase */,
</span><span class="cx">                                 BC204EDF11C83E72008F3375 /* InjectedBundle */,
</span><span class="lines">@@ -5950,6 +5993,7 @@
</span><span class="cx">                                 9955A6E81C79809000EB6A93 /* Automation */,
</span><span class="cx">                                 1ABC3DF21899E415004F0626 /* Cocoa */,
</span><span class="cx">                                 1AB7D4C71288AA9A00CFD08C /* Downloads */,
</span><ins>+                                515BE17B1D54EF5A00DD7C68 /* Gamepad */,
</ins><span class="cx">                                 2DA944A81884E9AB00ED86DB /* ios */,
</span><span class="cx">                                 BC111B18112F5FB400337BAB /* Launcher */,
</span><span class="cx">                                 BCCF085C113F3B7500C650C5 /* mac */,
</span><span class="lines">@@ -7518,6 +7562,7 @@
</span><span class="cx">                                 2DA944A41884E4F000ED86DB /* GestureTypes.h in Headers */,
</span><span class="cx">                                 2DA049B8180CCD0A00AAFA9E /* GraphicsLayerCARemote.h in Headers */,
</span><span class="cx">                                 C0CE72AD1247E78D00BC0EC4 /* HandleMessage.h in Headers */,
</span><ins>+                                515BE1A91D55293400DD7C68 /* UIGamepadProvider.h in Headers */,
</ins><span class="cx">                                 1AC75A1B1B3368270056745B /* HangDetectionDisabler.h in Headers */,
</span><span class="cx">                                 37F90DE31376560E0051CF68 /* HTTPCookieAcceptPolicy.h in Headers */,
</span><span class="cx">                                 51E351CB180F2CCC00E53BE9 /* IDBUtilities.h in Headers */,
</span><span class="lines">@@ -8025,6 +8070,7 @@
</span><span class="cx">                                 1AB7D78D1288CD9A00CFD08C /* WKDownload.h in Headers */,
</span><span class="cx">                                 1AF4592F19464B2000F9D4A2 /* WKError.h in Headers */,
</span><span class="cx">                                 BCFD548C132D82680055D816 /* WKErrorCF.h in Headers */,
</span><ins>+                                515BE1791D53FE8F00DD7C68 /* WebGamepadProvider.h in Headers */,
</ins><span class="cx">                                 37B5045219EEF31300CE2CF8 /* WKErrorPrivate.h in Headers */,
</span><span class="cx">                                 BC4075FC124FF0270068F20A /* WKErrorRef.h in Headers */,
</span><span class="cx">                                 BC40783D1250FADD0068F20A /* WKEvent.h in Headers */,
</span><span class="lines">@@ -9176,6 +9222,7 @@
</span><span class="cx">                                 E179088D169BAA62006904C7 /* SecItemShim.cpp in Sources */,
</span><span class="cx">                                 E1790890169BAA7F006904C7 /* SecItemShimMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 E18E690B169B563F009B6670 /* SecItemShimProxy.cpp in Sources */,
</span><ins>+                                515BE1A71D55293400DD7C68 /* UIGamepadProviderHID.cpp in Sources */,
</ins><span class="cx">                                 E18E6917169B667B009B6670 /* SecItemShimProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 514D9F5819119D35000063A7 /* ServicesController.mm in Sources */,
</span><span class="cx">                                 1AFDE6591954A42B00C48FFA /* SessionState.cpp in Sources */,
</span><span class="lines">@@ -9196,6 +9243,7 @@
</span><span class="cx">                                 1A44B95B16B73F9F00B7BBD8 /* StorageManager.cpp in Sources */,
</span><span class="cx">                                 1AB31A9616BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 1A44B95716B737AA00B7BBD8 /* StorageNamespaceImpl.cpp in Sources */,
</span><ins>+                                515BE1771D53FE8700DD7C68 /* WebGamepadProvider.cpp in Sources */,
</ins><span class="cx">                                 1AE00D6B18327C1200087DD7 /* StringReference.cpp in Sources */,
</span><span class="cx">                                 296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */,
</span><span class="cx">                                 1ZZ417EF12C00D87002BE67B /* TextCheckerCompletion.cpp in Sources */,
</span><span class="lines">@@ -9244,6 +9292,7 @@
</span><span class="cx">                                 7C4ABED01AA8E9F00088AA37 /* WebCompiledContentExtension.cpp in Sources */,
</span><span class="cx">                                 7C4ABED41AA8FCB80088AA37 /* WebCompiledContentExtensionData.cpp in Sources */,
</span><span class="cx">                                 BC4A628F147312BE006C681A /* WebConnection.cpp in Sources */,
</span><ins>+                                515BE1A81D55293400DD7C68 /* UIGamepadProvider.cpp in Sources */,
</ins><span class="cx">                                 BC4A6291147312BE006C681A /* WebConnectionClient.cpp in Sources */,
</span><span class="cx">                                 1A1FEC1C1627B45700700F6D /* WebConnectionMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 BCD3675C148C26C000447E87 /* WebConnectionToUIProcess.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessGamepadWebGamepadcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.cpp (0 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.cpp        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -0,0 +1,35 @@
</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 &quot;config.h&quot;
+#include &quot;WebGamepad.h&quot;
+
+#if ENABLE(GAMEPAD)
+
+namespace WebKit {
+
+}
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessGamepadWebGamepadh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h (0 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepad.h        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -0,0 +1,34 @@
</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)
+
+namespace WebKit {
+
+}
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessGamepadWebGamepadProvidercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp (0 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.cpp        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -0,0 +1,79 @@
</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 &quot;config.h&quot;
+#include &quot;WebGamepadProvider.h&quot;
+
+#if ENABLE(GAMEPAD)
+
+#include &quot;WebProcess.h&quot;
+#include &quot;WebProcessPoolMessages.h&quot;
+#include &lt;wtf/NeverDestroyed.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebGamepadProvider&amp; WebGamepadProvider::singleton()
+{
+    static NeverDestroyed&lt;WebGamepadProvider&gt; provider;
+    return provider;
+}
+
+WebGamepadProvider::WebGamepadProvider()
+{
+}
+
+WebGamepadProvider::~WebGamepadProvider()
+{
+}
+
+void WebGamepadProvider::startMonitoringGamepads(GamepadProviderClient* client)
+{
+    ASSERT(!m_clients.contains(client));
+    m_clients.add(client);
+
+    if (m_clients.size() == 1)
+        WebProcess::singleton().send(Messages::WebProcessPool::StartedUsingGamepads(), 0);
+}
+
+void WebGamepadProvider::stopMonitoringGamepads(GamepadProviderClient* client)
+{
+    ASSERT(m_clients.contains(client));
+    m_clients.remove(client);
+
+    if (m_clients.isEmpty())
+        WebProcess::singleton().send(Messages::WebProcessPool::StoppedUsingGamepads(), 0);
+}
+
+const Vector&lt;PlatformGamepad*&gt;&amp; WebGamepadProvider::platformGamepads()
+{
+    static NeverDestroyed&lt;Vector&lt;PlatformGamepad*&gt;&gt; gamepads;
+    return gamepads;
+}
+
+}
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessGamepadWebGamepadProviderh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h (0 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/Gamepad/WebGamepadProvider.h        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -0,0 +1,52 @@
</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 &lt;WebCore/GamepadProvider.h&gt;
+#include &lt;wtf/HashSet.h&gt;
+
+namespace WebKit {
+
+class WebGamepadProvider : public WebCore::GamepadProvider {
+public:
+    WebGamepadProvider();
+    ~WebGamepadProvider() final;
+
+    static WebGamepadProvider&amp; singleton();
+
+    void startMonitoringGamepads(WebCore::GamepadProviderClient*) final;
+    void stopMonitoringGamepads(WebCore::GamepadProviderClient*) final;
+    const Vector&lt;WebCore::PlatformGamepad*&gt;&amp; platformGamepads() final;
+
+private:
+    HashSet&lt;WebCore::GamepadProviderClient*&gt; m_clients;
+};
+
+}
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (204221 => 204222)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2016-08-06 06:28:24 UTC (rev 204221)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2016-08-06 08:00:20 UTC (rev 204222)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> #include &quot;WebCoreArgumentCoders.h&quot;
</span><span class="cx"> #include &quot;WebFrame.h&quot;
</span><span class="cx"> #include &quot;WebFrameNetworkingContext.h&quot;
</span><ins>+#include &quot;WebGamepadProvider.h&quot;
</ins><span class="cx"> #include &quot;WebGeolocationManager.h&quot;
</span><span class="cx"> #include &quot;WebIconDatabaseProxy.h&quot;
</span><span class="cx"> #include &quot;WebLoaderStrategy.h&quot;
</span><span class="lines">@@ -400,6 +401,10 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(GAMEPAD)
+    GamepadProvider::singleton().setSharedProvider(WebGamepadProvider::singleton());
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::ensureNetworkProcessConnection()
</span></span></pre>
</div>
</div>

</body>
</html>