<!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>[205199] trunk</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/205199">205199</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-08-30 15:23:20 -0700 (Tue, 30 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>GameController.framework backend for gamepad API.
https://bugs.webkit.org/show_bug.cgi?id=161086

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (Native framework backends not directly testable)

* WebCore.xcodeproj/project.pbxproj:

* platform/gamepad/cocoa/GameControllerGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
* platform/gamepad/cocoa/GameControllerGamepad.mm: Added.
(WebCore::GameControllerGamepad::GameControllerGamepad):
(WebCore::GameControllerGamepad::setupAsExtendedGamepad):
(WebCore::GameControllerGamepad::setupAsGamepad):

* platform/gamepad/cocoa/GameControllerGamepadProvider.h: Added.
* platform/gamepad/cocoa/GameControllerGamepadProvider.mm: Added.
(WebCore::GameControllerGamepadProvider::singleton):
(WebCore::GameControllerGamepadProvider::GameControllerGamepadProvider):
(WebCore::GameControllerGamepadProvider::controllerDidConnect):
(WebCore::GameControllerGamepadProvider::controllerDidDisconnect):
(WebCore::GameControllerGamepadProvider::startMonitoringGamepads):
(WebCore::GameControllerGamepadProvider::stopMonitoringGamepads):
(WebCore::GameControllerGamepadProvider::indexForNewlyConnectedDevice):
(WebCore::GameControllerGamepadProvider::gamepadHadInput):
(WebCore::GameControllerGamepadProvider::makeInvisibileGamepadsVisible):
(WebCore::GameControllerGamepadProvider::inputNotificationTimerFired):

Source/WebKit2:

* UIProcess/API/Cocoa/WKProcessPool.mm:
(+[WKProcessPool _forceGameControllerFramework]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:

* UIProcess/Gamepad/UIGamepadProvider.h:

* UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm: Renamed from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
(WebKit::UIGamepadProvider::setUsesGameControllerFramework):
(WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
(WebKit::UIGamepadProvider::platformStopMonitoringInput):
(WebKit::UIGamepadProvider::platformStartMonitoringInput):

* WebKit2.xcodeproj/project.pbxproj:

Source/WTF:

* wtf/RunLoop.h:
(WTF::RunLoop::TimerBase::startOneShot):

Tools:

* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate awakeFromNib]):

* MiniBrowser/mac/SettingsController.h:
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]):
(-[SettingsController validateMenuItem:]):
(-[SettingsController usesGameControllerFramework]):
(-[SettingsController toggleUsesGameControllerFramework:]):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfRunLooph">trunk/Source/WTF/wtf/RunLoop.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessGamepadUIGamepadProviderh">trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowsermacAppDelegatem">trunk/Tools/MiniBrowser/mac/AppDelegate.m</a></li>
<li><a href="#trunkToolsMiniBrowsermacSettingsControllerh">trunk/Tools/MiniBrowser/mac/SettingsController.h</a></li>
<li><a href="#trunkToolsMiniBrowsermacSettingsControllerm">trunk/Tools/MiniBrowser/mac/SettingsController.m</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebCore/platform/gamepad/cocoa/</li>
<li><a href="#trunkSourceWebCoreplatformgamepadcocoaGameControllerGamepadh">trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgamepadcocoaGameControllerGamepadmm">trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgamepadcocoaGameControllerGamepadProviderh">trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgamepadcocoaGameControllerGamepadProvidermm">trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm</a></li>
<li>trunk/Source/WebKit2/UIProcess/Gamepad/cocoa/</li>
<li><a href="#trunkSourceWebKit2UIProcessGamepadcocoaUIGamepadProviderCocoamm">trunk/Source/WebKit2/UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp">trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WTF/ChangeLog        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-08-30  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        GameController.framework backend for gamepad API.
+        https://bugs.webkit.org/show_bug.cgi?id=161086
+
+        Reviewed by Alex Christensen.
+
+        * wtf/RunLoop.h:
+        (WTF::RunLoop::TimerBase::startOneShot):
+
</ins><span class="cx"> 2016-08-30  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Introduce the ThrowScope and force every throw site to instantiate a ThrowScope.
</span></span></pre></div>
<a id="trunkSourceWTFwtfRunLooph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/RunLoop.h (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/RunLoop.h        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WTF/wtf/RunLoop.h        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx">         void startRepeating(double repeatInterval) { start(repeatInterval, true); }
</span><span class="cx">         void startRepeating(std::chrono::milliseconds repeatInterval) { startRepeating(repeatInterval.count() * 0.001); }
</span><span class="cx">         void startOneShot(double interval) { start(interval, false); }
</span><ins>+        void startOneShot(std::chrono::milliseconds interval) { start(interval.count() * 0.001, false); }
</ins><span class="cx"> 
</span><span class="cx">         WTF_EXPORT_PRIVATE void stop();
</span><span class="cx">         WTF_EXPORT_PRIVATE bool isActive() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WebCore/ChangeLog        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2016-08-30  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        GameController.framework backend for gamepad API.
+        https://bugs.webkit.org/show_bug.cgi?id=161086
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Native framework backends not directly testable)
+
+        * WebCore.xcodeproj/project.pbxproj:
+        
+        * platform/gamepad/cocoa/GameControllerGamepad.h: Copied from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
+        * platform/gamepad/cocoa/GameControllerGamepad.mm: Added.
+        (WebCore::GameControllerGamepad::GameControllerGamepad):
+        (WebCore::GameControllerGamepad::setupAsExtendedGamepad):
+        (WebCore::GameControllerGamepad::setupAsGamepad):
+        
+        * platform/gamepad/cocoa/GameControllerGamepadProvider.h: Added.
+        * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: Added.
+        (WebCore::GameControllerGamepadProvider::singleton):
+        (WebCore::GameControllerGamepadProvider::GameControllerGamepadProvider):
+        (WebCore::GameControllerGamepadProvider::controllerDidConnect):
+        (WebCore::GameControllerGamepadProvider::controllerDidDisconnect):
+        (WebCore::GameControllerGamepadProvider::startMonitoringGamepads):
+        (WebCore::GameControllerGamepadProvider::stopMonitoringGamepads):
+        (WebCore::GameControllerGamepadProvider::indexForNewlyConnectedDevice):
+        (WebCore::GameControllerGamepadProvider::gamepadHadInput):
+        (WebCore::GameControllerGamepadProvider::makeInvisibileGamepadsVisible):
+        (WebCore::GameControllerGamepadProvider::inputNotificationTimerFired):
+
</ins><span class="cx"> 2016-08-30  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Introduce the ThrowScope and force every throw site to instantiate a ThrowScope.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -2174,6 +2174,7 @@
</span><span class="cx">                 51ABAE1E103C1913008C5260 /* SocketStreamHandleImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ABAE1C103C1913008C5260 /* SocketStreamHandleImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51ABAE1F103C1913008C5260 /* SocketStreamHandleImplCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABAE1D103C1913008C5260 /* SocketStreamHandleImplCFNet.cpp */; };
</span><span class="cx">                 51ABF64D16392E2800132A7A /* LoaderStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABF64C16392E2800132A7A /* LoaderStrategy.cpp */; };
</span><ins>+                51AEA4C91D6E3CC900E0269D /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51AEA4C81D6E3CC100E0269D /* GameController.framework */; };
</ins><span class="cx">                 51AF503616F100F60095B2E8 /* ResourceLoaderTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AF503516F100F60095B2E8 /* ResourceLoaderTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */; };
</span><span class="cx">                 51B454EA1B4DAE7D0085EAA6 /* PingHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B454E91B4DAE7D0085EAA6 /* PingHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2211,6 +2212,10 @@
</span><span class="cx">                 51E1ECC10C91C90400DC255B /* IconRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E1ECBB0C91C90400DC255B /* IconRecord.h */; };
</span><span class="cx">                 51E1ECC20C91C90400DC255B /* PageURLRecord.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E1ECBC0C91C90400DC255B /* PageURLRecord.cpp */; };
</span><span class="cx">                 51E1ECC30C91C90400DC255B /* PageURLRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E1ECBD0C91C90400DC255B /* PageURLRecord.h */; };
</span><ins>+                51E399001D6E4750009C8831 /* GameControllerGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E398FC1D6E474B009C8831 /* GameControllerGamepad.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                51E399011D6E4750009C8831 /* GameControllerGamepad.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E398FD1D6E474B009C8831 /* GameControllerGamepad.mm */; };
+                51E399021D6E4750009C8831 /* GameControllerGamepadProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E398FE1D6E474B009C8831 /* GameControllerGamepadProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                51E399031D6E4750009C8831 /* GameControllerGamepadProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E398FF1D6E474B009C8831 /* GameControllerGamepadProvider.mm */; };
</ins><span class="cx">                 51E3AA0A1B98BCAB0036AD81 /* SecurityOriginData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E3AA081B98BC9A0036AD81 /* SecurityOriginData.cpp */; };
</span><span class="cx">                 51E3AA0B1B98BCAB0036AD81 /* SecurityOriginData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E3AA091B98BC9A0036AD81 /* SecurityOriginData.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51E3F9C70DA059DC00250911 /* Storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E3F9C50DA059DC00250911 /* Storage.cpp */; };
</span><span class="lines">@@ -9130,6 +9135,7 @@
</span><span class="cx">                 51ABAE1C103C1913008C5260 /* SocketStreamHandleImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandleImpl.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51ABAE1D103C1913008C5260 /* SocketStreamHandleImplCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SocketStreamHandleImplCFNet.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51ABF64C16392E2800132A7A /* LoaderStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoaderStrategy.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                51AEA4C81D6E3CC100E0269D /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = ../../../../../../System/Library/Frameworks/GameController.framework; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 51AF503516F100F60095B2E8 /* ResourceLoaderTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoaderTypes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyWebArchiveMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51B454E91B4DAE7D0085EAA6 /* PingHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PingHandle.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9196,6 +9202,10 @@
</span><span class="cx">                 51E1ECBB0C91C90400DC255B /* IconRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconRecord.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E1ECBC0C91C90400DC255B /* PageURLRecord.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageURLRecord.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E1ECBD0C91C90400DC255B /* PageURLRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageURLRecord.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                51E398FC1D6E474B009C8831 /* GameControllerGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameControllerGamepad.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51E398FD1D6E474B009C8831 /* GameControllerGamepad.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GameControllerGamepad.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51E398FE1D6E474B009C8831 /* GameControllerGamepadProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameControllerGamepadProvider.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51E398FF1D6E474B009C8831 /* GameControllerGamepadProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GameControllerGamepadProvider.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 51E3AA081B98BC9A0036AD81 /* SecurityOriginData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOriginData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E3AA091B98BC9A0036AD81 /* SecurityOriginData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityOriginData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E3F9C40DA059DC00250911 /* Storage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Storage.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -14317,6 +14327,7 @@
</span><span class="cx">                                 93F19B1608245E59001E9ABC /* JavaScriptCore.framework in Frameworks */,
</span><span class="cx">                                 93F19B1708245E59001E9ABC /* libicucore.dylib in Frameworks */,
</span><span class="cx">                                 1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */,
</span><ins>+                                51AEA4C91D6E3CC900E0269D /* GameController.framework in Frameworks */,
</ins><span class="cx">                                 DD763BB20992C2C900740B8E /* libxml2.dylib in Frameworks */,
</span><span class="cx">                                 379919B21200DE5000EA041C /* libz.dylib in Frameworks */,
</span><span class="cx">                                 A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */,
</span><span class="lines">@@ -14791,6 +14802,7 @@
</span><span class="cx">                                 FD2DBF0E12B048A300ED98C6 /* Accelerate.framework */,
</span><span class="cx">                                 FD2DBF0F12B048A300ED98C6 /* AudioToolbox.framework */,
</span><span class="cx">                                 AA5F3B9016CC5BEB00455EB0 /* CoreFoundation.framework */,
</span><ins>+                                51AEA4C81D6E3CC100E0269D /* GameController.framework */,
</ins><span class="cx">                                 1AB33DA412551E320024457A /* IOKit.framework */,
</span><span class="cx">                                 F8216299029F4FB501000131 /* JavaScriptCore.framework */,
</span><span class="cx">                                 93F1D31A0558CC5C00821BC0 /* libicucore.dylib */,
</span><span class="lines">@@ -16503,6 +16515,7 @@
</span><span class="cx">                 515BE1871D54F5DB00DD7C68 /* gamepad */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                51AEA4BF1D6E3C2300E0269D /* cocoa */,
</ins><span class="cx">                                 515BE1961D54F64500DD7C68 /* mac */,
</span><span class="cx">                                 515BE1881D54F5F600DD7C68 /* EmptyGamepadProvider.cpp */,
</span><span class="cx">                                 515BE1891D54F5F600DD7C68 /* EmptyGamepadProvider.h */,
</span><span class="lines">@@ -16599,6 +16612,17 @@
</span><span class="cx">                         name = Gamepad;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                51AEA4BF1D6E3C2300E0269D /* cocoa */ = {
+                        isa = PBXGroup;
+                        children = (
+                                51E398FC1D6E474B009C8831 /* GameControllerGamepad.h */,
+                                51E398FD1D6E474B009C8831 /* GameControllerGamepad.mm */,
+                                51E398FE1D6E474B009C8831 /* GameControllerGamepadProvider.h */,
+                                51E398FF1D6E474B009C8831 /* GameControllerGamepadProvider.mm */,
+                        );
+                        path = cocoa;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 51C4AA5118B28357007BFE9B /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -25187,6 +25211,7 @@
</span><span class="cx">                                 B2FA3D670AB75A6F000E5AC4 /* JSSVGDocument.h in Headers */,
</span><span class="cx">                                 B222F69D0AB771B80022EFAD /* JSSVGElement.h in Headers */,
</span><span class="cx">                                 8542A7990AE5C94400DF58DF /* JSSVGElementWrapperFactory.h in Headers */,
</span><ins>+                                51E399001D6E4750009C8831 /* GameControllerGamepad.h in Headers */,
</ins><span class="cx">                                 B2FA3D690AB75A6F000E5AC4 /* JSSVGEllipseElement.h in Headers */,
</span><span class="cx">                                 B266CD4E0C3AEC6500EB08D2 /* JSSVGException.h in Headers */,
</span><span class="cx">                                 B2FA3D6B0AB75A6F000E5AC4 /* JSSVGFEBlendElement.h in Headers */,
</span><span class="lines">@@ -26640,6 +26665,7 @@
</span><span class="cx">                                 CDA07FBE18E0A16A004699FA /* SystemSleepListener.h in Headers */,
</span><span class="cx">                                 CDA07FC218E0A22B004699FA /* SystemSleepListenerMac.h in Headers */,
</span><span class="cx">                                 5D5975B319635F1100D00878 /* SystemVersion.h in Headers */,
</span><ins>+                                51E399021D6E4750009C8831 /* GameControllerGamepadProvider.h in Headers */,
</ins><span class="cx">                                 A8CFF0510A154F09000A4234 /* TableLayout.h in Headers */,
</span><span class="cx">                                 463EB6231B8789E00096ED51 /* TagCollection.h in Headers */,
</span><span class="cx">                                 F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */,
</span><span class="lines">@@ -28879,6 +28905,7 @@
</span><span class="cx">                                 B2FA3D680AB75A6F000E5AC4 /* JSSVGEllipseElement.cpp in Sources */,
</span><span class="cx">                                 B266CD4D0C3AEC6500EB08D2 /* JSSVGException.cpp in Sources */,
</span><span class="cx">                                 B2FA3D6A0AB75A6F000E5AC4 /* JSSVGFEBlendElement.cpp in Sources */,
</span><ins>+                                51E399031D6E4750009C8831 /* GameControllerGamepadProvider.mm in Sources */,
</ins><span class="cx">                                 B2FA3D6C0AB75A6F000E5AC4 /* JSSVGFEColorMatrixElement.cpp in Sources */,
</span><span class="cx">                                 B2FA3D6E0AB75A6F000E5AC4 /* JSSVGFEComponentTransferElement.cpp in Sources */,
</span><span class="cx">                                 B2FA3D700AB75A6F000E5AC4 /* JSSVGFECompositeElement.cpp in Sources */,
</span><span class="lines">@@ -29335,6 +29362,7 @@
</span><span class="cx">                                 E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */,
</span><span class="cx">                                 33503CC71017A1B1003B47E1 /* Notification.cpp in Sources */,
</span><span class="cx">                                 3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */,
</span><ins>+                                51E399011D6E4750009C8831 /* GameControllerGamepad.mm in Sources */,
</ins><span class="cx">                                 3128CA68147331520074C72A /* NotificationController.cpp in Sources */,
</span><span class="cx">                                 E1513D511677F08800149FCB /* NotImplemented.cpp in Sources */,
</span><span class="cx">                                 1A569D0A0D7E2B82007C3983 /* NP_jsobject.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgamepadcocoaGameControllerGamepadhfromrev205198trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.h (from rev 205198, trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp) (0 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.h                                (rev 0)
+++ trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.h        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -0,0 +1,68 @@
</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) &amp;&amp; defined(__LP64__)
+
+#include &quot;PlatformGamepad.h&quot;
+#include &lt;wtf/RetainPtr.h&gt;
+
+OBJC_CLASS GCController;
+OBJC_CLASS GCControllerAxisInput;
+OBJC_CLASS GCControllerButtonInput;
+OBJC_CLASS GCControllerElement;
+OBJC_CLASS GCExtendedGamepad;
+OBJC_CLASS GCGamepad;
+
+namespace WebCore {
+
+class GameControllerGamepad : public PlatformGamepad {
+    WTF_MAKE_NONCOPYABLE(GameControllerGamepad);
+public:
+    GameControllerGamepad(GCController *, unsigned index);
+
+    const Vector&lt;double&gt;&amp; axisValues() const final { return m_axisValues; }
+    const Vector&lt;double&gt;&amp; buttonValues() const final { return m_buttonValues; }
+
+private:
+    void setupAsExtendedGamepad();
+    void setupAsGamepad();
+
+    RetainPtr&lt;GCController&gt; m_gcController;
+
+    Vector&lt;double&gt; m_axisValues;
+    Vector&lt;double&gt; m_buttonValues;
+
+    RetainPtr&lt;GCGamepad&gt; m_gamepad;
+    RetainPtr&lt;GCExtendedGamepad&gt; m_extendedGamepad;
+};
+
+
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD) &amp;&amp; defined(__LP64__)
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgamepadcocoaGameControllerGamepadmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm (0 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepad.mm        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -0,0 +1,180 @@
</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;GameControllerGamepad.h&quot;
+
+#if ENABLE(GAMEPAD) &amp;&amp; defined(__LP64__)
+#include &quot;GameControllerGamepadProvider.h&quot;
+#include &lt;GameController/GameController.h&gt;
+#include &lt;wtf/CurrentTime.h&gt;
+
+namespace WebCore {
+
+GameControllerGamepad::GameControllerGamepad(GCController *controller, unsigned index)
+    : PlatformGamepad(index)
+    , m_gcController(controller)
+{
+    ASSERT(index &lt; 4);
+    controller.playerIndex = (GCControllerPlayerIndex)(GCControllerPlayerIndex1 + index);
+
+    m_extendedGamepad = controller.extendedGamepad;
+    if (!m_extendedGamepad)
+        m_gamepad = controller.gamepad;
+
+    ASSERT(m_extendedGamepad || m_gamepad);
+
+    if (m_extendedGamepad)
+        setupAsExtendedGamepad();
+    else
+        setupAsGamepad();
+}
+
+void GameControllerGamepad::setupAsExtendedGamepad()
+{
+    ASSERT(m_extendedGamepad);
+
+    m_id = makeString(String(m_gcController.get().vendorName), ASCIILiteral(&quot; Extended Gamepad&quot;));
+
+    m_extendedGamepad.get().valueChangedHandler = ^(GCExtendedGamepad *, GCControllerElement *) {
+        m_lastUpdateTime = monotonicallyIncreasingTime();
+        GameControllerGamepadProvider::singleton().gamepadHadInput(*this);
+    };
+
+    m_buttonValues.resize(8);
+    m_buttonValues[0] = m_extendedGamepad.get().buttonA.value;
+    m_buttonValues[1] = m_extendedGamepad.get().buttonB.value;
+    m_buttonValues[2] = m_extendedGamepad.get().buttonX.value;
+    m_buttonValues[3] = m_extendedGamepad.get().buttonY.value;
+    m_buttonValues[4] = m_extendedGamepad.get().leftShoulder.value;
+    m_buttonValues[5] = m_extendedGamepad.get().rightShoulder.value;
+    m_buttonValues[6] = m_extendedGamepad.get().leftTrigger.value;
+    m_buttonValues[7] = m_extendedGamepad.get().rightTrigger.value;
+
+    m_axisValues.resize(6);
+    m_axisValues[0] = m_extendedGamepad.get().leftThumbstick.xAxis.value;
+    m_axisValues[1] = m_extendedGamepad.get().leftThumbstick.yAxis.value;
+    m_axisValues[2] = m_extendedGamepad.get().rightThumbstick.xAxis.value;
+    m_axisValues[3] = m_extendedGamepad.get().rightThumbstick.yAxis.value;
+    m_axisValues[4] = m_extendedGamepad.get().dpad.xAxis.value;
+    m_axisValues[5] = m_extendedGamepad.get().dpad.yAxis.value;
+
+    m_extendedGamepad.get().buttonA.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[0] = value;
+    };
+    m_extendedGamepad.get().buttonB.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[1] = value;
+    };
+    m_extendedGamepad.get().buttonX.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[2] = value;
+    };
+    m_extendedGamepad.get().buttonY.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[3] = value;
+    };
+    m_extendedGamepad.get().leftShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[4] = value;
+    };
+    m_extendedGamepad.get().rightShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[5] = value;
+    };
+    m_extendedGamepad.get().leftTrigger.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[6] = value;
+    };
+    m_extendedGamepad.get().rightTrigger.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[7] = value;
+    };
+
+    m_extendedGamepad.get().leftThumbstick.xAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
+        m_axisValues[0] = value;
+    };
+    m_extendedGamepad.get().leftThumbstick.yAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
+        m_axisValues[1] = value;
+    };
+    m_extendedGamepad.get().rightThumbstick.xAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
+        m_axisValues[2] = value;
+    };
+    m_extendedGamepad.get().rightThumbstick.yAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
+        m_axisValues[3] = value;
+    };
+    m_extendedGamepad.get().dpad.xAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
+        m_axisValues[4] = value;
+    };
+    m_extendedGamepad.get().dpad.yAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
+        m_axisValues[5] = value;
+    };
+}
+
+void GameControllerGamepad::setupAsGamepad()
+{
+    ASSERT(m_gamepad);
+
+    m_id = makeString(String(m_gcController.get().vendorName), ASCIILiteral(&quot; Gamepad&quot;));
+
+    m_gamepad.get().valueChangedHandler = ^(GCGamepad *, GCControllerElement *) {
+        m_lastUpdateTime = monotonicallyIncreasingTime();
+        GameControllerGamepadProvider::singleton().gamepadHadInput(*this);
+    };
+
+    m_buttonValues.resize(6);
+    m_buttonValues[0] = m_extendedGamepad.get().buttonA.value;
+    m_buttonValues[1] = m_extendedGamepad.get().buttonB.value;
+    m_buttonValues[2] = m_extendedGamepad.get().buttonX.value;
+    m_buttonValues[3] = m_extendedGamepad.get().buttonY.value;
+    m_buttonValues[4] = m_extendedGamepad.get().leftShoulder.value;
+    m_buttonValues[5] = m_extendedGamepad.get().rightShoulder.value;
+
+    m_axisValues.resize(2);
+    m_axisValues[0] = m_extendedGamepad.get().dpad.xAxis.value;
+    m_axisValues[1] = m_extendedGamepad.get().dpad.yAxis.value;
+
+    m_extendedGamepad.get().buttonA.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[0] = value;
+    };
+    m_extendedGamepad.get().buttonB.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[1] = value;
+    };
+    m_extendedGamepad.get().buttonX.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[2] = value;
+    };
+    m_extendedGamepad.get().buttonY.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[3] = value;
+    };
+    m_extendedGamepad.get().leftShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[4] = value;
+    };
+    m_extendedGamepad.get().rightShoulder.valueChangedHandler = ^(GCControllerButtonInput *, float value, BOOL) {
+        m_buttonValues[5] = value;
+    };
+
+    m_extendedGamepad.get().leftThumbstick.xAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
+        m_axisValues[0] = value;
+    };
+    m_extendedGamepad.get().leftThumbstick.yAxis.valueChangedHandler = ^(GCControllerAxisInput *, float value) {
+        m_axisValues[1] = value;
+    };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD) &amp;&amp; defined(__LP64__)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgamepadcocoaGameControllerGamepadProviderh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h (0 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h                                (rev 0)
+++ trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.h        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -0,0 +1,91 @@
</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) &amp;&amp; defined(__LP64__)
+
+#include &quot;GamepadProvider.h&quot;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/HashSet.h&gt;
+#include &lt;wtf/NeverDestroyed.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+#include &lt;wtf/RunLoop.h&gt;
+
+OBJC_CLASS GCController;
+OBJC_CLASS NSObject;
+
+namespace WebCore {
+
+class GameControllerGamepad;
+class GamepadProviderClient;
+
+class GameControllerGamepadProvider : public GamepadProvider {
+    WTF_MAKE_NONCOPYABLE(GameControllerGamepadProvider);
+    friend class NeverDestroyed&lt;GameControllerGamepadProvider&gt;;
+public:
+    WEBCORE_EXPORT static GameControllerGamepadProvider&amp; singleton();
+
+    WEBCORE_EXPORT void startMonitoringGamepads(GamepadProviderClient&amp;) final;
+    WEBCORE_EXPORT void stopMonitoringGamepads(GamepadProviderClient&amp;) final;
+    const Vector&lt;PlatformGamepad*&gt;&amp; platformGamepads() final { return m_gamepadVector; }
+
+    WEBCORE_EXPORT void stopMonitoringInput();
+    WEBCORE_EXPORT void startMonitoringInput();
+
+    void gamepadHadInput(GameControllerGamepad&amp;);
+
+private:
+    GameControllerGamepadProvider();
+
+    enum class ConnectionVisibility {
+        Visible,
+        Invisible,
+    };
+
+    void controllerDidConnect(GCController *, ConnectionVisibility);
+    void controllerDidDisconnect(GCController *);
+
+    unsigned indexForNewlyConnectedDevice();
+
+    void inputNotificationTimerFired();
+
+    void makeInvisibileGamepadsVisible();
+
+    HashSet&lt;GamepadProviderClient*&gt; m_clients;
+
+    HashMap&lt;GCController *, std::unique_ptr&lt;GameControllerGamepad&gt;&gt; m_gamepadMap;
+    Vector&lt;PlatformGamepad*&gt; m_gamepadVector;
+    HashSet&lt;PlatformGamepad*&gt; m_invisibleGamepads;
+
+    RetainPtr&lt;NSObject&gt; m_connectObserver;
+    RetainPtr&lt;NSObject&gt; m_disconnectObserver;
+
+    RunLoop::Timer&lt;GameControllerGamepadProvider&gt; m_inputNotificationTimer;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgamepadcocoaGameControllerGamepadProvidermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm (0 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -0,0 +1,160 @@
</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.
+ */
+#import &quot;config.h&quot;
+#import &quot;GameControllerGamepadProvider.h&quot;
+
+#if ENABLE(GAMEPAD) &amp;&amp; defined(__LP64__)
+
+#import &quot;GameControllerGamepad.h&quot;
+#import &quot;GamepadProviderClient.h&quot;
+#import &quot;Logging.h&quot;
+#import &lt;GameController/GameController.h&gt;
+
+namespace WebCore {
+
+static const std::chrono::milliseconds InputNotificationDelay = 16ms;
+
+GameControllerGamepadProvider&amp; GameControllerGamepadProvider::singleton()
+{
+    static NeverDestroyed&lt;GameControllerGamepadProvider&gt; sharedProvider;
+    return sharedProvider;
+}
+
+GameControllerGamepadProvider::GameControllerGamepadProvider()
+    : m_inputNotificationTimer(RunLoop::current(), this, &amp;GameControllerGamepadProvider::inputNotificationTimerFired)
+
+{
+}
+
+void GameControllerGamepadProvider::controllerDidConnect(GCController *controller, ConnectionVisibility visibility)
+{
+    LOG(Gamepad, &quot;GameControllerGamepadProvider controller %p added&quot;, controller);
+
+    unsigned index = indexForNewlyConnectedDevice();
+    auto gamepad = std::make_unique&lt;GameControllerGamepad&gt;(controller, index);
+
+    if (m_gamepadVector.size() &lt;= index)
+        m_gamepadVector.resize(index + 1);
+
+    m_gamepadVector[index] = gamepad.get();
+    m_gamepadMap.set(controller, WTFMove(gamepad));
+
+
+    if (visibility == ConnectionVisibility::Invisible) {
+        m_invisibleGamepads.add(m_gamepadVector[index]);
+        return;
+    }
+
+    makeInvisibileGamepadsVisible();
+
+    for (auto&amp; client : m_clients)
+        client-&gt;platformGamepadConnected(*m_gamepadVector[index]);
+}
+
+void GameControllerGamepadProvider::controllerDidDisconnect(GCController *controller)
+{
+    LOG(Gamepad, &quot;GameControllerGamepadProvider controller %p removed&quot;, controller);
+
+    auto removedGamepad = m_gamepadMap.take(controller);
+    ASSERT(removedGamepad);
+
+    auto i = m_gamepadVector.find(removedGamepad.get());
+    if (i != notFound)
+        m_gamepadVector[i] = nullptr;
+
+    m_invisibleGamepads.remove(removedGamepad.get());
+
+    for (auto&amp; client : m_clients)
+        client-&gt;platformGamepadDisconnected(*removedGamepad);
+}
+
+void GameControllerGamepadProvider::startMonitoringGamepads(GamepadProviderClient&amp; client)
+{
+    ASSERT(!m_clients.contains(&amp;client));
+    m_clients.add(&amp;client);
+
+    if (m_connectObserver)
+        return;
+
+    m_connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidConnectNotification object:nil queue:nil usingBlock:^(NSNotification *notification) {
+        GameControllerGamepadProvider::singleton().controllerDidConnect(notification.object, ConnectionVisibility::Visible);
+    }];
+
+    m_disconnectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:GCControllerDidDisconnectNotification object:nil queue:nil usingBlock:^(NSNotification *notification) {
+        GameControllerGamepadProvider::singleton().controllerDidDisconnect(notification.object);
+    }];
+
+    for (GCController *controller in [GCController controllers])
+        controllerDidConnect(controller, ConnectionVisibility::Invisible);
+}
+
+void GameControllerGamepadProvider::stopMonitoringGamepads(GamepadProviderClient&amp; client)
+{
+    ASSERT(m_clients.contains(&amp;client));
+    m_clients.remove(&amp;client);
+
+    if (!m_connectObserver || !m_clients.isEmpty())
+        return;
+
+    [[NSNotificationCenter defaultCenter] removeObserver:m_connectObserver.get()];
+    [[NSNotificationCenter defaultCenter] removeObserver:m_disconnectObserver.get()];
+}
+
+unsigned GameControllerGamepadProvider::indexForNewlyConnectedDevice()
+{
+    unsigned index = 0;
+    while (index &lt; m_gamepadVector.size() &amp;&amp; m_gamepadVector[index])
+        ++index;
+
+    return index;
+}
+
+void GameControllerGamepadProvider::gamepadHadInput(GameControllerGamepad&amp;)
+{
+    if (!m_inputNotificationTimer.isActive())
+        m_inputNotificationTimer.startOneShot(InputNotificationDelay);
+}
+
+void GameControllerGamepadProvider::makeInvisibileGamepadsVisible()
+{
+    for (auto* gamepad : m_invisibleGamepads) {
+        for (auto&amp; client : m_clients)
+            client-&gt;platformGamepadConnected(*gamepad);
+    }
+
+    m_invisibleGamepads.clear();
+}
+
+void GameControllerGamepadProvider::inputNotificationTimerFired()
+{
+    makeInvisibileGamepadsVisible();
+
+    for (auto&amp; client : m_clients)
+        client-&gt;platformGamepadInputActivity();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WebKit2/ChangeLog        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-08-30  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        GameController.framework backend for gamepad API.
+        https://bugs.webkit.org/show_bug.cgi?id=161086
+
+        Reviewed by Alex Christensen.
+
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (+[WKProcessPool _forceGameControllerFramework]):
+        * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+
+        * UIProcess/Gamepad/UIGamepadProvider.h:
+
+        * UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm: Renamed from Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp.
+        (WebKit::UIGamepadProvider::setUsesGameControllerFramework):
+        (WebKit::UIGamepadProvider::platformSetDefaultGamepadProvider):
+        (WebKit::UIGamepadProvider::platformStopMonitoringInput):
+        (WebKit::UIGamepadProvider::platformStartMonitoringInput):
+
+        * WebKit2.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2016-08-30  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Introduce the ThrowScope and force every throw site to instantiate a ThrowScope.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #import &quot;CacheModel.h&quot;
</span><span class="cx"> #import &quot;DownloadClient.h&quot;
</span><span class="cx"> #import &quot;SandboxUtilities.h&quot;
</span><ins>+#import &quot;UIGamepadProvider.h&quot;
</ins><span class="cx"> #import &quot;WKObject.h&quot;
</span><span class="cx"> #import &quot;WeakObjCPtr.h&quot;
</span><span class="cx"> #import &quot;WebCertificateInfo.h&quot;
</span><span class="lines">@@ -290,6 +291,13 @@
</span><span class="cx">     _processPool-&gt;terminateDatabaseProcess();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>++ (void)_forceGameControllerFramework
+{
+#if ENABLE(GAMEPAD)
+    WebKit::UIGamepadProvider::setUsesGameControllerFramework();
+#endif
+}
+
</ins><span class="cx"> - (BOOL)_isCookieStoragePartitioningEnabled
</span><span class="cx"> {
</span><span class="cx">     return _processPool-&gt;cookieStoragePartitioningEnabled();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -64,6 +64,9 @@
</span><span class="cx"> // Test only. Should be called only while no web content processes are running.
</span><span class="cx"> - (void)_terminateDatabaseProcess;
</span><span class="cx"> 
</span><ins>+// Test only. Should be called before any web content processes are launched.
++ (void)_forceGameControllerFramework;
+
</ins><span class="cx"> @property (nonatomic, getter=_isCookieStoragePartitioningEnabled, setter=_setCookieStoragePartitioningEnabled:) BOOL _cookieStoragePartitioningEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadUIGamepadProviderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -52,6 +52,10 @@
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;GamepadData&gt; gamepadStates() const;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+    static void setUsesGameControllerFramework();
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     friend NeverDestroyed&lt;UIGamepadProvider&gt;;
</span><span class="cx">     UIGamepadProvider();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadcocoaUIGamepadProviderCocoammfromrev205198trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm (from rev 205198, trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp) (0 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/cocoa/UIGamepadProviderCocoa.mm        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -0,0 +1,81 @@
</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/GameControllerGamepadProvider.h&gt;
+#include &lt;WebCore/HIDGamepadProvider.h&gt;
+#include &lt;WebCore/MockGamepadProvider.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static bool useGameControllerFramework = false;
+
+void UIGamepadProvider::setUsesGameControllerFramework()
+{
+    useGameControllerFramework = true;
+}
+
+void UIGamepadProvider::platformSetDefaultGamepadProvider()
+{
+    if (GamepadProvider::singleton().isMockGamepadProvider())
+        return;
+
+#if PLATFORM(IOS)
+    GamepadProvider::setSharedProvider(GameControllerGamepadProvider::singleton());
+#elif defined(__LP64__)
+    if (useGameControllerFramework)
+        GamepadProvider::setSharedProvider(GameControllerGamepadProvider::singleton());
+    else
+        GamepadProvider::setSharedProvider(HIDGamepadProvider::singleton());
+#else
+    GamepadProvider::setSharedProvider(HIDGamepadProvider::singleton());
+#endif
+}
+
+void UIGamepadProvider::platformStopMonitoringInput()
+{
+#if PLATFORM(MAC)
+    if (!useGameControllerFramework)
+        HIDGamepadProvider::singleton().stopMonitoringInput();
+#endif
+}
+
+void UIGamepadProvider::platformStartMonitoringInput()
+{
+#if PLATFORM(MAC)
+    if (!useGameControllerFramework)
+        HIDGamepadProvider::singleton().startMonitoringInput();
+#endif
+}
+
+}
+
+#endif // ENABLE(GAMEPAD)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessGamepadmacUIGamepadProviderHIDcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -1,60 +0,0 @@
</span><del>-/*
- * 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;WebCore/MockGamepadProvider.h&gt;
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void UIGamepadProvider::platformSetDefaultGamepadProvider()
-{
-    if (GamepadProvider::singleton().isMockGamepadProvider())
-        return;
-
-    GamepadProvider::setSharedProvider(HIDGamepadProvider::singleton());
-}
-
-void UIGamepadProvider::platformStopMonitoringInput()
-{
-    // No effect when the MockGamepadProvider is being used.
-    return HIDGamepadProvider::singleton().stopMonitoringInput();
-}
-
-void UIGamepadProvider::platformStartMonitoringInput()
-{
-    // No effect when the MockGamepadProvider is being used.
-    return HIDGamepadProvider::singleton().startMonitoringInput();
-}
-
-}
-
-#endif // ENABLE(GAMEPAD)
</del></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -936,7 +936,6 @@
</span><span class="cx">                 51578B831209ECEF00A37C4A /* APIData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* APIData.h */; };
</span><span class="cx">                 515BE1771D53FE8700DD7C68 /* WebGamepadProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1731D53FDDC00DD7C68 /* WebGamepadProvider.cpp */; };
</span><span class="cx">                 515BE1791D53FE8F00DD7C68 /* WebGamepadProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 515BE1741D53FDDC00DD7C68 /* WebGamepadProvider.h */; };
</span><del>-                515BE1A71D55293400DD7C68 /* UIGamepadProviderHID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */; };
</del><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><span class="cx">                 515BE1AA1D555A9B00DD7C68 /* WebGamepad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE19F1D550AB000DD7C68 /* WebGamepad.cpp */; };
</span><span class="lines">@@ -1016,6 +1015,7 @@
</span><span class="cx">                 51E35200180F5D0F00E53BE9 /* DatabaseToWebProcessConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E351FD180F5D0B00E53BE9 /* DatabaseToWebProcessConnection.cpp */; };
</span><span class="cx">                 51E35202180F5D1E00E53BE9 /* DatabaseProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E35201180F5D1E00E53BE9 /* DatabaseProcessMac.mm */; };
</span><span class="cx">                 51E35209180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E35208180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm */; };
</span><ins>+                51E399061D6F54C7009C8831 /* UIGamepadProviderCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E399051D6F54C5009C8831 /* UIGamepadProviderCocoa.mm */; };
</ins><span class="cx">                 51EFC1CF1524E62500C9A938 /* WKBundleDOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FA2D541521118600C1BA0B /* WKBundleDOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */; };
</span><span class="cx">                 51F060E11654318500F3281B /* WebResourceLoaderMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */; };
</span><span class="lines">@@ -2990,7 +2990,6 @@
</span><span class="cx">                 515BE1A01D550AB000DD7C68 /* WebGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGamepad.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 515BE1A41D55292800DD7C68 /* UIGamepadProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIGamepadProvider.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 515BE1A51D55292800DD7C68 /* UIGamepadProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGamepadProvider.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIGamepadProviderHID.cpp; path = UIProcess/Gamepad/mac/UIGamepadProviderHID.cpp; sourceTree = SOURCE_ROOT; };
</del><span class="cx">                 515BE1AC1D555C5100DD7C68 /* UIGamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIGamepad.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 515BE1AD1D555C5100DD7C68 /* UIGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGamepad.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 515BE1B01D59006900DD7C68 /* GamepadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3077,6 +3076,7 @@
</span><span class="cx">                 51E35201180F5D1E00E53BE9 /* DatabaseProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DatabaseProcessMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E35207180F5D6100E53BE9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E35208180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DatabaseServiceEntryPoint.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                51E399051D6F54C5009C8831 /* UIGamepadProviderCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIGamepadProviderCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoaderMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebResourceLoaderMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51F7DC4A180CC93600212CA3 /* com.apple.WebKit.Databases.Development.xpc */ = {isa = PBXFileReference; explicitFileType = &quot;wrapper.xpc-service&quot;; includeInIndex = 0; path = com.apple.WebKit.Databases.Development.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="lines">@@ -5501,6 +5501,7 @@
</span><span class="cx">                 515BE17B1D54EF5A00DD7C68 /* Gamepad */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                51E399041D6F54AD009C8831 /* cocoa */,
</ins><span class="cx">                                 515BE1A11D5523B300DD7C68 /* mac */,
</span><span class="cx">                                 515BE1AC1D555C5100DD7C68 /* UIGamepad.cpp */,
</span><span class="cx">                                 515BE1AD1D555C5100DD7C68 /* UIGamepad.h */,
</span><span class="lines">@@ -5513,7 +5514,6 @@
</span><span class="cx">                 515BE1A11D5523B300DD7C68 /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */,
</del><span class="cx">                                 515BE1B61D5A94F900DD7C68 /* UIGamepadProviderMac.mm */,
</span><span class="cx">                         );
</span><span class="cx">                         name = mac;
</span><span class="lines">@@ -5618,6 +5618,14 @@
</span><span class="cx">                         path = IndexedDB;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                51E399041D6F54AD009C8831 /* cocoa */ = {
+                        isa = PBXGroup;
+                        children = (
+                                51E399051D6F54C5009C8831 /* UIGamepadProviderCocoa.mm */,
+                        );
+                        path = cocoa;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 51F7DC0A180CC41100212CA3 /* DatabaseProcess */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -9190,6 +9198,7 @@
</span><span class="cx">                                 1A0EC910124C0AF5007EF4A5 /* PluginProcessConnectionManager.cpp in Sources */,
</span><span class="cx">                                 1A7865B916CAC71500ACE83A /* PluginProcessConnectionManagerMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 1A2BB6D014117B4D000F35D4 /* PluginProcessConnectionMessageReceiver.cpp in Sources */,
</span><ins>+                                51E399061D6F54C7009C8831 /* UIGamepadProviderCocoa.mm in Sources */,
</ins><span class="cx">                                 1A2D90D31281C966001EB962 /* PluginProcessCreationParameters.cpp in Sources */,
</span><span class="cx">                                 1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */,
</span><span class="cx">                                 1A0EC604124A9F2C007EF4A5 /* PluginProcessManager.cpp in Sources */,
</span><span class="lines">@@ -9274,7 +9283,6 @@
</span><span class="cx">                                 1AFE436518B6C081009C7A48 /* UIDelegate.mm in Sources */,
</span><span class="cx">                                 515BE1B41D5917FF00DD7C68 /* UIGamepad.cpp in Sources */,
</span><span class="cx">                                 515BE1A81D55293400DD7C68 /* UIGamepadProvider.cpp in Sources */,
</span><del>-                                515BE1A71D55293400DD7C68 /* UIGamepadProviderHID.cpp in Sources */,
</del><span class="cx">                                 515BE1B71D5A94FD00DD7C68 /* UIGamepadProviderMac.mm in Sources */,
</span><span class="cx">                                 1A64245F12DE29A100CAAE2C /* UpdateInfo.cpp in Sources */,
</span><span class="cx">                                 1AC1336718565B5700F3EC05 /* UserData.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Tools/ChangeLog        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-08-30  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        GameController.framework backend for gamepad API.
+        https://bugs.webkit.org/show_bug.cgi?id=161086
+
+        Reviewed by Alex Christensen.
+
+        * MiniBrowser/mac/AppDelegate.m:
+        (-[BrowserAppDelegate awakeFromNib]):
+
+        * MiniBrowser/mac/SettingsController.h:
+        * MiniBrowser/mac/SettingsController.m:
+        (-[SettingsController _populateMenu]):
+        (-[SettingsController validateMenuItem:]):
+        (-[SettingsController usesGameControllerFramework]):
+        (-[SettingsController toggleUsesGameControllerFramework:]):
+
</ins><span class="cx"> 2016-08-30  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use of uninitialised memory in TransformationMatrx::blend4()
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacAppDelegatem"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.m (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/AppDelegate.m        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.m        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -66,6 +66,12 @@
</span><span class="cx"> {
</span><span class="cx">     NSMenuItem *item = [[NSMenuItem alloc] init];
</span><span class="cx">     [item setSubmenu:[[SettingsController shared] menu]];
</span><ins>+
+#if WK_API_ENABLED
+    if ([[SettingsController shared] usesGameControllerFramework])
+        [WKProcessPool _forceGameControllerFramework];
+#endif
+
</ins><span class="cx">     [[NSApp mainMenu] insertItem:[item autorelease] atIndex:[[NSApp mainMenu] indexOfItemWithTitle:@&quot;Debug&quot;]];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacSettingsControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/SettingsController.h (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/SettingsController.h        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Tools/MiniBrowser/mac/SettingsController.h        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> @property (nonatomic, readonly) BOOL displayListDrawingEnabled;
</span><span class="cx"> @property (nonatomic, readonly) BOOL resourceLoadStatisticsEnabled;
</span><span class="cx"> @property (nonatomic, readonly) BOOL visualViewportEnabled;
</span><ins>+@property (nonatomic, readonly) BOOL usesGameControllerFramework;
</ins><span class="cx"> 
</span><span class="cx"> @property (nonatomic, readonly) NSString *defaultURL;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacSettingsControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/SettingsController.m (205198 => 205199)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/SettingsController.m        2016-08-30 20:54:54 UTC (rev 205198)
+++ trunk/Tools/MiniBrowser/mac/SettingsController.m        2016-08-30 22:23:20 UTC (rev 205199)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> static NSString * const SimpleLineLayoutDebugBordersEnabledPreferenceKey = @&quot;SimpleLineLayoutDebugBordersEnabled&quot;;
</span><span class="cx"> static NSString * const TiledScrollingIndicatorVisiblePreferenceKey = @&quot;TiledScrollingIndicatorVisible&quot;;
</span><span class="cx"> static NSString * const ResourceUsageOverlayVisiblePreferenceKey = @&quot;ResourceUsageOverlayVisible&quot;;
</span><ins>+static NSString * const UsesGameControllerFrameworkKey = @&quot;UsesGameControllerFramework&quot;;
</ins><span class="cx"> static NSString * const IncrementalRenderingSuppressedPreferenceKey = @&quot;IncrementalRenderingSuppressed&quot;;
</span><span class="cx"> static NSString * const AcceleratedDrawingEnabledPreferenceKey = @&quot;AcceleratedDrawingEnabled&quot;;
</span><span class="cx"> static NSString * const DisplayListDrawingEnabledPreferenceKey = @&quot;DisplayListDrawingEnabled&quot;;
</span><span class="lines">@@ -132,6 +133,7 @@
</span><span class="cx">     [self _addItemWithTitle:@&quot;Use UI-Side Compositing&quot; action:@selector(toggleUseUISideCompositing:) indented:YES];
</span><span class="cx">     [self _addItemWithTitle:@&quot;Disable Per-Window Web Processes&quot; action:@selector(togglePerWindowWebProcessesDisabled:) indented:YES];
</span><span class="cx">     [self _addItemWithTitle:@&quot;Show Resource Usage Overlay&quot; action:@selector(toggleShowResourceUsageOverlay:) indented:YES];
</span><ins>+    [self _addItemWithTitle:@&quot;Use GameController.framework on macOS (Restart required)&quot; action:@selector(toggleUsesGameControllerFramework:) indented:YES];
</ins><span class="cx"> 
</span><span class="cx">     NSMenuItem *debugOverlaysSubmenuItem = [[NSMenuItem alloc] initWithTitle:@&quot;Debug Overlays&quot; action:nil keyEquivalent:@&quot;&quot;];
</span><span class="cx">     NSMenu *debugOverlaysMenu = [[NSMenu alloc] initWithTitle:@&quot;Debug Overlays&quot;];
</span><span class="lines">@@ -203,6 +205,8 @@
</span><span class="cx">         [menuItem setState:[self tiledScrollingIndicatorVisible] ? NSOnState : NSOffState];
</span><span class="cx">     else if (action == @selector(toggleShowResourceUsageOverlay:))
</span><span class="cx">         [menuItem setState:[self resourceUsageOverlayVisible] ? NSOnState : NSOffState];
</span><ins>+    else if (action == @selector(toggleUsesGameControllerFramework:))
+        [menuItem setState:[self usesGameControllerFramework] ? NSOnState : NSOffState];
</ins><span class="cx">     else if (action == @selector(toggleUseUISideCompositing:))
</span><span class="cx">         [menuItem setState:[self useUISideCompositing] ? NSOnState : NSOffState];
</span><span class="cx">     else if (action == @selector(togglePerWindowWebProcessesDisabled:))
</span><span class="lines">@@ -350,6 +354,16 @@
</span><span class="cx">     [self _toggleBooleanDefault:ResourceUsageOverlayVisiblePreferenceKey];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)usesGameControllerFramework
+{
+    return [[NSUserDefaults standardUserDefaults] boolForKey:UsesGameControllerFrameworkKey];
+}
+
+- (void)toggleUsesGameControllerFramework:(id)sender
+{
+    [self _toggleBooleanDefault:UsesGameControllerFrameworkKey];
+}
+
</ins><span class="cx"> - (BOOL)tiledScrollingIndicatorVisible
</span><span class="cx"> {
</span><span class="cx">     return [[NSUserDefaults standardUserDefaults] boolForKey:TiledScrollingIndicatorVisiblePreferenceKey];
</span></span></pre>
</div>
</div>

</body>
</html>