Title: [170459] trunk/Source
Revision
170459
Author
beid...@apple.com
Date
2014-06-25 20:59:10 -0700 (Wed, 25 Jun 2014)

Log Message

Add new platform gamepad abstractions
https://bugs.webkit.org/show_bug.cgi?id=134325

Reviewed by Dean Jackson.

Source/WebCore:
No new tests (Not yet a tested config)

- GamepadStrategy lets ports customize the 3 basic behaviors needed for a gamepad
  implementation to feed the API in WebCore.
- GamepadStrategyClient gives arbitrary objects in WebCore the ability to register
  for callbacks with the GamepadStrategy.
- PlatformGamepad is a platform-agnostic object that represents the data that
  feeds into the Gamepad object that is exposed to web content.

The code in this patch is dead as-is, but https://bugs.webkit.org/show_bug.cgi?id=134324
will contain an immediate follow-up patch that uses it.

Makes sense to review them separately.

* WebCore.xcodeproj/project.pbxproj:

* platform/GamepadStrategy.h: Added.
(WebCore::GamepadStrategy::~GamepadStrategy):

* platform/GamepadStrategyClient.h: Added.
(WebCore::GamepadStrategyClient::~GamepadStrategyClient):

* platform/PlatformGamepad.h: Added.
(WebCore::PlatformGamepad::~PlatformGamepad):
(WebCore::PlatformGamepad::id):
(WebCore::PlatformGamepad::lastUpdateTime):
(WebCore::PlatformGamepad::connectTime):
(WebCore::PlatformGamepad::PlatformGamepad):

* platform/PlatformStrategies.h:
(WebCore::PlatformStrategies::gamepadStrategy):
(WebCore::PlatformStrategies::PlatformStrategies):

Source/WebKit/mac:
* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::createGamepadStrategy):
(WebPlatformStrategies::startMonitoringGamepads):
(WebPlatformStrategies::stopMonitoringGamepads):
(WebPlatformStrategies::platformGamepads):

Source/WebKit/win:
* WebCoreSupport/WebPlatformStrategies.cpp:
(WebPlatformStrategies::createGamepadStrategy):
* WebCoreSupport/WebPlatformStrategies.h:

Source/WebKit2:
* NetworkProcess/NetworkProcessPlatformStrategies.cpp:
(WebKit::NetworkProcessPlatformStrategies::createGamepadStrategy):
* NetworkProcess/NetworkProcessPlatformStrategies.h:

Actually return a GamepadStrategy in WK2 with no implementation for now:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::createGamepadStrategy):
(WebKit::WebPlatformStrategies::startMonitoringGamepads):
(WebKit::WebPlatformStrategies::stopMonitoringGamepads):
(WebKit::WebPlatformStrategies::platformGamepads):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170458 => 170459)


--- trunk/Source/WebCore/ChangeLog	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebCore/ChangeLog	2014-06-26 03:59:10 UTC (rev 170459)
@@ -1,3 +1,43 @@
+2014-06-25  Brady Eidson  <beid...@apple.com>
+
+        Add new platform gamepad abstractions
+        https://bugs.webkit.org/show_bug.cgi?id=134325
+
+        Reviewed by Dean Jackson.
+
+        No new tests (Not yet a tested config)
+
+        - GamepadStrategy lets ports customize the 3 basic behaviors needed for a gamepad
+          implementation to feed the API in WebCore.
+        - GamepadStrategyClient gives arbitrary objects in WebCore the ability to register
+          for callbacks with the GamepadStrategy.
+        - PlatformGamepad is a platform-agnostic object that represents the data that
+          feeds into the Gamepad object that is exposed to web content.
+
+        The code in this patch is dead as-is, but https://bugs.webkit.org/show_bug.cgi?id=134324
+        will contain an immediate follow-up patch that uses it.
+
+        Makes sense to review them separately.
+
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * platform/GamepadStrategy.h: Added.
+        (WebCore::GamepadStrategy::~GamepadStrategy):
+
+        * platform/GamepadStrategyClient.h: Added.
+        (WebCore::GamepadStrategyClient::~GamepadStrategyClient):
+
+        * platform/PlatformGamepad.h: Added.
+        (WebCore::PlatformGamepad::~PlatformGamepad):
+        (WebCore::PlatformGamepad::id):
+        (WebCore::PlatformGamepad::lastUpdateTime):
+        (WebCore::PlatformGamepad::connectTime):
+        (WebCore::PlatformGamepad::PlatformGamepad):
+
+        * platform/PlatformStrategies.h:
+        (WebCore::PlatformStrategies::gamepadStrategy):
+        (WebCore::PlatformStrategies::PlatformStrategies):
+
 2014-06-25  Zalan Bujtas  <za...@apple.com>
 
         Assertion failed: CGPathAddRoundedRect asserts on non-renderable rounded rectangle.

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (170458 => 170459)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-06-26 03:59:10 UTC (rev 170459)
@@ -1835,6 +1835,7 @@
 		512DD8FD0D91E6AF000F89EE /* ArchiveFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8F30D91E6AF000F89EE /* ArchiveFactory.h */; };
 		512EA9BC181F2EE0001D01E0 /* IDBPendingOpenCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 512EA9BB181F2EE0001D01E0 /* IDBPendingOpenCall.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		512EA9BE18202857001D01E0 /* IDBOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 512EA9BD18202857001D01E0 /* IDBOperation.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		5131B512195381200085C896 /* GamepadStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 5131B50F195379C30085C896 /* GamepadStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 51327D5E11A33A2B004F9D65 /* SinkDocument.h */; };
 		51327D6111A33A2B004F9D65 /* SinkDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */; };
 		513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; };
@@ -1921,6 +1922,7 @@
 		51A052561058874000CC9E95 /* ProtectionSpaceHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A052551058874000CC9E95 /* ProtectionSpaceHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51A4BB0A1954D61600FA5C2E /* Gamepad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A4BB071954D61600FA5C2E /* Gamepad.cpp */; };
 		51A4BB101954D62700FA5C2E /* NavigatorGamepad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A4BB0D1954D62700FA5C2E /* NavigatorGamepad.cpp */; };
+		51A9D9E6195B8F47001B2B5C /* GamepadStrategyClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A9D9E5195B8F47001B2B5C /* GamepadStrategyClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51AA3F6F0BD5AA9E00892971 /* ResourceLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51AA3F6E0BD5AA9E00892971 /* ResourceLoaderMac.mm */; };
 		51ABAE1B103C18FF008C5260 /* SocketStreamError.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ABAE1A103C18FF008C5260 /* SocketStreamError.h */; };
 		51ABAE1E103C1913008C5260 /* SocketStreamHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ABAE1C103C1913008C5260 /* SocketStreamHandle.h */; };
@@ -1931,6 +1933,7 @@
 		51AF503616F100F60095B2E8 /* ResourceLoaderTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AF503516F100F60095B2E8 /* ResourceLoaderTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51B07A441823248B00AA8D1A /* IDBPendingDeleteCall.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B07A431823248B00AA8D1A /* IDBPendingDeleteCall.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */; };
+		51B58FD4195A964D002990B0 /* PlatformGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 515E5FEF195101470086CA5E /* PlatformGamepad.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BE37DE0DAEE00E001085FC /* StorageArea.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51C0AA390F2AA10A001648C2 /* CachedFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C0AA380F2AA10A001648C2 /* CachedFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51C0AA410F2AA15E001648C2 /* CachedFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51C0AA400F2AA15E001648C2 /* CachedFrame.cpp */; };
@@ -8897,6 +8900,7 @@
 		512DD8F30D91E6AF000F89EE /* ArchiveFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchiveFactory.h; sourceTree = "<group>"; };
 		512EA9BB181F2EE0001D01E0 /* IDBPendingOpenCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBPendingOpenCall.h; sourceTree = "<group>"; };
 		512EA9BD18202857001D01E0 /* IDBOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBOperation.h; sourceTree = "<group>"; };
+		5131B50F195379C30085C896 /* GamepadStrategy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GamepadStrategy.h; sourceTree = "<group>"; };
 		51327D5E11A33A2B004F9D65 /* SinkDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SinkDocument.h; sourceTree = "<group>"; };
 		51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SinkDocument.cpp; sourceTree = "<group>"; };
 		513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; };
@@ -8935,6 +8939,7 @@
 		514C76680CE923A1007EF3CD /* ResourceRequestBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceRequestBase.h; sourceTree = "<group>"; };
 		514C76690CE923A1007EF3CD /* ResourceResponseBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceResponseBase.cpp; sourceTree = "<group>"; };
 		514C766A0CE923A1007EF3CD /* ResourceResponseBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceResponseBase.h; sourceTree = "<group>"; };
+		515E5FEF195101470086CA5E /* PlatformGamepad.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformGamepad.h; sourceTree = "<group>"; };
 		5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemPOSIX.cpp; sourceTree = "<group>"; };
 		5160306B0CC4362300C8AC25 /* FileSystemCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemCF.cpp; sourceTree = "<group>"; };
 		5160F4970B0AA75F00C1D2AF /* HistoryItemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = HistoryItemMac.mm; path = mac/HistoryItemMac.mm; sourceTree = "<group>"; };
@@ -8995,6 +9000,7 @@
 		51A4BB0D1954D62700FA5C2E /* NavigatorGamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorGamepad.cpp; sourceTree = "<group>"; };
 		51A4BB0E1954D62700FA5C2E /* NavigatorGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorGamepad.h; sourceTree = "<group>"; };
 		51A4BB0F1954D62700FA5C2E /* NavigatorGamepad.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorGamepad.idl; sourceTree = "<group>"; };
+		51A9D9E5195B8F47001B2B5C /* GamepadStrategyClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadStrategyClient.h; sourceTree = "<group>"; };
 		51AA3F6E0BD5AA9E00892971 /* ResourceLoaderMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceLoaderMac.mm; sourceTree = "<group>"; };
 		51ABAE1A103C18FF008C5260 /* SocketStreamError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamError.h; sourceTree = "<group>"; };
 		51ABAE1C103C1913008C5260 /* SocketStreamHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandle.h; sourceTree = "<group>"; };
@@ -21270,6 +21276,8 @@
 				C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */,
 				514B3F720C722047000530DF /* FileSystem.h */,
 				BC073BA90C399B1F000F5979 /* FloatConversion.h */,
+				5131B50F195379C30085C896 /* GamepadStrategy.h */,
+				51A9D9E5195B8F47001B2B5C /* GamepadStrategyClient.h */,
 				A8748BDF12CBF2DC001FBA41 /* HashTools.h */,
 				BC3BC29B0E91AB0F00835588 /* HostWindow.h */,
 				862F129F18C1DCE4005C54AF /* HysteresisActivity.h */,
@@ -21305,6 +21313,7 @@
 				E1424C89164B3B4E00F32D40 /* PlatformCookieJar.h */,
 				BC5C76291497FE1400BC4775 /* PlatformEvent.h */,
 				A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */,
+				515E5FEF195101470086CA5E /* PlatformGamepad.h */,
 				935C476609AC4D4300A6AAB4 /* PlatformKeyboardEvent.h */,
 				932871BF0B20DEB70049035A /* PlatformMenuDescription.h */,
 				935C476709AC4D4300A6AAB4 /* PlatformMouseEvent.h */,
@@ -23744,6 +23753,7 @@
 				85E711920AC5D5350053270F /* DOMCSSRuleListInternal.h in Headers */,
 				85032DE50AA8C9BE007D3B7D /* DOMCSSStyleDeclaration.h in Headers */,
 				85E711930AC5D5350053270F /* DOMCSSStyleDeclarationInternal.h in Headers */,
+				51B58FD4195A964D002990B0 /* PlatformGamepad.h in Headers */,
 				85032DE70AA8C9BE007D3B7D /* DOMCSSStyleRule.h in Headers */,
 				85909CE20ACC7A7E00DF01F1 /* DOMCSSStyleRuleInternal.h in Headers */,
 				E15FF7D518C9553800FE4C87 /* KeypressCommand.h in Headers */,
@@ -23890,6 +23900,7 @@
 				85BA4D150AA688680088052D /* DOMHTMLOListElement.h in Headers */,
 				85E711BE0AC5D5350053270F /* DOMHTMLOListElementInternal.h in Headers */,
 				85F32AEE0AA63B8700FF3184 /* DOMHTMLOptGroupElement.h in Headers */,
+				5131B512195381200085C896 /* GamepadStrategy.h in Headers */,
 				85E711BF0AC5D5350053270F /* DOMHTMLOptGroupElementInternal.h in Headers */,
 				8540756B0AD6CBF900620C57 /* DOMHTMLOptionElement.h in Headers */,
 				8540756D0AD6CBF900620C57 /* DOMHTMLOptionElementInternal.h in Headers */,
@@ -24448,6 +24459,7 @@
 				51D719D9181106E00016DC51 /* IDBIndex.h in Headers */,
 				51ABB5B8186D0ED1008391A1 /* IDBIndexMetadata.h in Headers */,
 				510194411836D20800925523 /* IDBIndexWriterLevelDB.h in Headers */,
+				51A9D9E6195B8F47001B2B5C /* GamepadStrategyClient.h in Headers */,
 				51D719DC181106E00016DC51 /* IDBKey.h in Headers */,
 				511EC1A6188DACA400BA3EB6 /* IDBKeyData.h in Headers */,
 				51D719DE181106E00016DC51 /* IDBKeyPath.h in Headers */,

Added: trunk/Source/WebCore/platform/GamepadStrategy.h (0 => 170459)


--- trunk/Source/WebCore/platform/GamepadStrategy.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/GamepadStrategy.h	2014-06-26 03:59:10 UTC (rev 170459)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef GamepadStrategy_h
+#define GamepadStrategy_h
+
+#if ENABLE(GAMEPAD)
+
+namespace WebCore {
+
+class PlatformGamepad;
+class GamepadStrategyClient;
+
+class GamepadStrategy {
+public:
+    virtual void startMonitoringGamepads(GamepadStrategyClient*) = 0;
+    virtual void stopMonitoringGamepads(GamepadStrategyClient*) = 0;
+    virtual const Vector<PlatformGamepad*>& platformGamepads() = 0;
+
+protected:
+    virtual ~GamepadStrategy()
+    {
+    }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD)
+#endif // GamepadStrategy_h

Added: trunk/Source/WebCore/platform/GamepadStrategyClient.h (0 => 170459)


--- trunk/Source/WebCore/platform/GamepadStrategyClient.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/GamepadStrategyClient.h	2014-06-26 03:59:10 UTC (rev 170459)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef GamepadStrategyClient_h
+#define GamepadStrategyClient_h
+
+#if ENABLE(GAMEPAD)
+
+namespace WebCore {
+
+class GamepadStrategyClient {
+public:
+    virtual ~GamepadStrategyClient() { }
+
+    virtual void platformGamepadConnected(unsigned index) = 0;
+    virtual void platformGamepadDisconnected(unsigned index) = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD)
+#endif // GamepadStrategyClient_h

Added: trunk/Source/WebCore/platform/PlatformGamepad.h (0 => 170459)


--- trunk/Source/WebCore/platform/PlatformGamepad.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/PlatformGamepad.h	2014-06-26 03:59:10 UTC (rev 170459)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef PlatformGamepad_h
+#define PlatformGamepad_h
+
+#if ENABLE(GAMEPAD)
+
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class PlatformGamepad {
+public:
+    virtual ~PlatformGamepad() { }
+
+    const String& id() const { return m_id; }
+    double lastUpdateTime() const { return m_lastUpdateTime; }
+    double connectTime() const { return m_connectTime; }
+    virtual const Vector<double>& axisValues() const = 0;
+    virtual const Vector<double>& buttonValues() const = 0;
+
+protected:
+    PlatformGamepad()
+        : m_lastUpdateTime(0.0)
+        , m_connectTime(0.0)
+    {
+    }
+
+    String m_id;
+    double m_lastUpdateTime;
+    double m_connectTime;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD)
+#endif // PlatformGamepad_h

Modified: trunk/Source/WebCore/platform/PlatformStrategies.h (170458 => 170459)


--- trunk/Source/WebCore/platform/PlatformStrategies.h	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebCore/platform/PlatformStrategies.h	2014-06-26 03:59:10 UTC (rev 170459)
@@ -36,6 +36,10 @@
 class SharedWorkerStrategy;
 class StorageStrategy;
 
+#if ENABLE(GAMEPAD)
+class GamepadStrategy;
+#endif
+
 class PlatformStrategies {
 public:
     CookiesStrategy* cookiesStrategy()
@@ -87,15 +91,27 @@
         return m_storageStrategy;
     }
 
+#if ENABLE(GAMEPAD)
+    GamepadStrategy* gamepadStrategy()
+    {
+        if (!m_gamepadStrategy)
+            m_gamepadStrategy = createGamepadStrategy();
+        return m_gamepadStrategy;
+    }
+#endif
+
 protected:
     PlatformStrategies()
-        : m_cookiesStrategy(0)
-        , m_databaseStrategy(0)
-        , m_loaderStrategy(0)
-        , m_pasteboardStrategy(0)
-        , m_pluginStrategy(0)
-        , m_sharedWorkerStrategy(0)
-        , m_storageStrategy(0)
+        : m_cookiesStrategy(nullptr)
+        , m_databaseStrategy(nullptr)
+        , m_loaderStrategy(nullptr)
+        , m_pasteboardStrategy(nullptr)
+        , m_pluginStrategy(nullptr)
+        , m_sharedWorkerStrategy(nullptr)
+        , m_storageStrategy(nullptr)
+#if ENABLE(GAMEPAD)
+        , m_gamepadStrategy(nullptr)
+#endif
     {
     }
 
@@ -111,6 +127,9 @@
     virtual PluginStrategy* createPluginStrategy() = 0;
     virtual SharedWorkerStrategy* createSharedWorkerStrategy() = 0;
     virtual StorageStrategy* createStorageStrategy() = 0;
+#if ENABLE(GAMEPAD)
+    virtual GamepadStrategy* createGamepadStrategy() = 0;
+#endif
 
     CookiesStrategy* m_cookiesStrategy;
     DatabaseStrategy* m_databaseStrategy;
@@ -119,6 +138,9 @@
     PluginStrategy* m_pluginStrategy;
     SharedWorkerStrategy* m_sharedWorkerStrategy;
     StorageStrategy* m_storageStrategy;
+#if ENABLE(GAMEPAD)
+    GamepadStrategy* m_gamepadStrategy;
+#endif
 };
 
 PlatformStrategies* platformStrategies();

Modified: trunk/Source/WebKit/mac/ChangeLog (170458 => 170459)


--- trunk/Source/WebKit/mac/ChangeLog	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-06-26 03:59:10 UTC (rev 170459)
@@ -1,3 +1,17 @@
+2014-06-25  Brady Eidson  <beid...@apple.com>
+
+        Add new platform gamepad abstractions
+        https://bugs.webkit.org/show_bug.cgi?id=134325
+
+        Reviewed by Dean Jackson.
+
+        * WebCoreSupport/WebPlatformStrategies.h:
+        * WebCoreSupport/WebPlatformStrategies.mm:
+        (WebPlatformStrategies::createGamepadStrategy):
+        (WebPlatformStrategies::startMonitoringGamepads):
+        (WebPlatformStrategies::stopMonitoringGamepads):
+        (WebPlatformStrategies::platformGamepads):
+
 2014-06-25  Gavin Barraclough  <baraclo...@apple.com>
 
         Should _updateVisibilityState on view hide/unhide.

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h (170458 => 170459)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h	2014-06-26 03:59:10 UTC (rev 170459)
@@ -35,10 +35,18 @@
 #include <WebCore/SharedWorkerStrategy.h>
 #include <WebCore/StorageStrategy.h>
 
+#if ENABLE(GAMEPAD)
+#include <WebCore/GamepadStrategy.h>
+#endif
+
 struct PasteboardImage;
 struct PasteboardWebContent;
 
-class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::DatabaseStrategy, private WebCore::LoaderStrategy, private WebCore::PasteboardStrategy, private WebCore::PluginStrategy, private WebCore::SharedWorkerStrategy, private WebCore::StorageStrategy {
+class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::DatabaseStrategy, private WebCore::LoaderStrategy, private WebCore::PasteboardStrategy, private WebCore::PluginStrategy, private WebCore::SharedWorkerStrategy, private WebCore::StorageStrategy
+#if ENABLE(GAMEPAD)
+    , private WebCore::GamepadStrategy
+#endif
+{
 public:
     static void initializeIfNecessary();
     
@@ -53,6 +61,9 @@
     virtual WebCore::PluginStrategy* createPluginStrategy() override;
     virtual WebCore::SharedWorkerStrategy* createSharedWorkerStrategy() override;
     virtual WebCore::StorageStrategy* createStorageStrategy() override;
+#if ENABLE(GAMEPAD)
+    virtual WebCore::GamepadStrategy* createGamepadStrategy() override;
+#endif
 
     // WebCore::CookiesStrategy
     virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&) override;
@@ -101,6 +112,13 @@
     virtual long setBufferForType(PassRefPtr<WebCore::SharedBuffer>, const String& pasteboardType, const String& pasteboardName) override;
     virtual long setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) override;
     virtual long setStringForType(const String&, const String& pasteboardType, const String& pasteboardName) override;
+
+#if ENABLE(GAMEPAD)
+    // WebCore::GamepadStrategy
+    virtual void startMonitoringGamepads(WebCore::GamepadStrategyClient*) override;
+    virtual void stopMonitoringGamepads(WebCore::GamepadStrategyClient*) override;
+    virtual const Vector<WebCore::PlatformGamepad*>& platformGamepads() override;
+#endif
 };
 
 #endif // WebPlatformStrategies_h

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm (170458 => 170459)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm	2014-06-26 03:59:10 UTC (rev 170459)
@@ -38,6 +38,7 @@
 #import <WebCore/SharedBuffer.h>
 #import <WebCore/SubframeLoader.h>
 #import <WebKitSystemInterface.h>
+#import <wtf/NeverDestroyed.h>
 
 using namespace WebCore;
 
@@ -89,6 +90,13 @@
     return this;
 }
 
+#if ENABLE(GAMEPAD)
+GamepadStrategy* WebPlatformStrategies::createGamepadStrategy()
+{
+    return this;
+}
+#endif
+
 String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
 {
     return WebCore::cookiesForDOM(session, firstParty, url);
@@ -212,6 +220,22 @@
     return PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType);
 }
 
+#if ENABLE(GAMEPAD)
+void WebPlatformStrategies::startMonitoringGamepads(GamepadStrategyClient*)
+{
+}
+
+void WebPlatformStrategies::stopMonitoringGamepads(GamepadStrategyClient*)
+{
+}
+
+const Vector<PlatformGamepad*>& WebPlatformStrategies::platformGamepads()
+{
+    NeverDestroyed<Vector<PlatformGamepad*>> dummyGamepads;
+    return dummyGamepads;
+}
+#endif // ENABLE(GAMEPAD)
+
 #if PLATFORM(IOS)
 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content)
 {
@@ -252,5 +276,4 @@
 {
     return PlatformPasteboard().changeCount();
 }
-
-#endif
+#endif // PLATFORM(IOS)

Modified: trunk/Source/WebKit/win/ChangeLog (170458 => 170459)


--- trunk/Source/WebKit/win/ChangeLog	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit/win/ChangeLog	2014-06-26 03:59:10 UTC (rev 170459)
@@ -1,3 +1,14 @@
+2014-06-25  Brady Eidson  <beid...@apple.com>
+
+        Add new platform gamepad abstractions
+        https://bugs.webkit.org/show_bug.cgi?id=134325
+
+        Reviewed by Dean Jackson.
+
+        * WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebPlatformStrategies::createGamepadStrategy):
+        * WebCoreSupport/WebPlatformStrategies.h:
+
 2014-06-19  Anders Carlsson  <ander...@apple.com>
 
         Try to fix Windows build.

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp (170458 => 170459)


--- trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp	2014-06-26 03:59:10 UTC (rev 170459)
@@ -83,6 +83,13 @@
     return this;
 }
 
+#if ENABLE(GAMEPAD)
+GamepadStrategy* WebPlatformStrategies::createGamepadStrategy()
+{
+    return nullptr;
+}
+#endif
+
 String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
 {
     return WebCore::cookiesForDOM(session, firstParty, url);

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h (170458 => 170459)


--- trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h	2014-06-26 03:59:10 UTC (rev 170459)
@@ -49,6 +49,9 @@
     virtual WebCore::PluginStrategy* createPluginStrategy();
     virtual WebCore::SharedWorkerStrategy* createSharedWorkerStrategy();
     virtual WebCore::StorageStrategy* createStorageStrategy();
+#if ENABLE(GAMEPAD)
+    virtual WebCore::GamepadStrategy* createGamepadStrategy();
+#endif
 
     // WebCore::CookiesStrategy
     virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&);

Modified: trunk/Source/WebKit2/ChangeLog (170458 => 170459)


--- trunk/Source/WebKit2/ChangeLog	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit2/ChangeLog	2014-06-26 03:59:10 UTC (rev 170459)
@@ -1,3 +1,22 @@
+2014-06-25  Brady Eidson  <beid...@apple.com>
+
+        Add new platform gamepad abstractions
+        https://bugs.webkit.org/show_bug.cgi?id=134325
+
+        Reviewed by Dean Jackson.
+
+        * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
+        (WebKit::NetworkProcessPlatformStrategies::createGamepadStrategy):
+        * NetworkProcess/NetworkProcessPlatformStrategies.h:
+
+        Actually return a GamepadStrategy in WK2 with no implementation for now:
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::createGamepadStrategy):
+        (WebKit::WebPlatformStrategies::startMonitoringGamepads):
+        (WebKit::WebPlatformStrategies::stopMonitoringGamepads):
+        (WebKit::WebPlatformStrategies::platformGamepads):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
 2014-06-25  Jaehun Lim  <ljaehun....@samsung.com>
 
         Unreviewed, CMake build fix after r170450

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.cpp (170458 => 170459)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.cpp	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.cpp	2014-06-26 03:59:10 UTC (rev 170459)
@@ -74,6 +74,13 @@
     return 0;
 }
 
+#if ENABLE(GAMEPAD)
+GamepadStrategy* NetworkProcessPlatformStrategies::createGamepadStrategy()
+{
+    return nullptr;
+}
+#endif
+
 ResourceLoadScheduler* NetworkProcessPlatformStrategies::resourceLoadScheduler()
 {
     ASSERT_NOT_REACHED();

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.h (170458 => 170459)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.h	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcessPlatformStrategies.h	2014-06-26 03:59:10 UTC (rev 170459)
@@ -44,6 +44,9 @@
     virtual WebCore::PluginStrategy* createPluginStrategy() override;
     virtual WebCore::SharedWorkerStrategy* createSharedWorkerStrategy() override;
     virtual WebCore::StorageStrategy* createStorageStrategy() override;
+#if ENABLE(GAMEPAD)
+    virtual WebCore::GamepadStrategy* createGamepadStrategy() override;
+#endif
 
     // WebCore::LoaderStrategy
     virtual WebCore::ResourceLoadScheduler* resourceLoadScheduler() override;

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (170458 => 170459)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2014-06-26 03:59:10 UTC (rev 170459)
@@ -124,6 +124,13 @@
     return this;
 }
 
+#if ENABLE(GAMEPAD)
+GamepadStrategy* WebPlatformStrategies::createGamepadStrategy()
+{
+    return this;
+}
+#endif
+
 // CookiesStrategy
 
 String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
@@ -506,6 +513,22 @@
     return newChangeCount;
 }
 
+#if ENABLE(GAMEPAD)
+void WebPlatformStrategies::startMonitoringGamepads(GamepadStrategyClient*)
+{
+}
+
+void WebPlatformStrategies::stopMonitoringGamepads(GamepadStrategyClient*)
+{
+}
+
+const Vector<PlatformGamepad*>& WebPlatformStrategies::platformGamepads()
+{
+    NeverDestroyed<Vector<PlatformGamepad*>> dummyGamepads;
+    return dummyGamepads;
+}
+#endif // ENABLE(GAMEPAD)
+
 #if PLATFORM(IOS)
 void WebPlatformStrategies::writeToPasteboard(const WebCore::PasteboardWebContent& content)
 {
@@ -566,8 +589,8 @@
     return changeCount;
 }
 
-#endif
+#endif // PLATFORM(IOS)
 
-#endif
+#endif // PLATFORM(COCOA)
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h (170458 => 170459)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2014-06-26 02:39:10 UTC (rev 170458)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2014-06-26 03:59:10 UTC (rev 170459)
@@ -36,9 +36,17 @@
 #include <WebCore/StorageStrategy.h>
 #include <wtf/NeverDestroyed.h>
 
+#if ENABLE(GAMEPAD)
+#include <WebCore/GamepadStrategy.h>
+#endif
+
 namespace WebKit {
 
-class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::DatabaseStrategy, private WebCore::LoaderStrategy, private WebCore::PasteboardStrategy, private WebCore::PluginStrategy, private WebCore::SharedWorkerStrategy, private WebCore::StorageStrategy {
+class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::DatabaseStrategy, private WebCore::LoaderStrategy, private WebCore::PasteboardStrategy, private WebCore::PluginStrategy, private WebCore::SharedWorkerStrategy, private WebCore::StorageStrategy
+#if ENABLE(GAMEPAD)
+    , private WebCore::GamepadStrategy
+#endif
+{
     friend class NeverDestroyed<WebPlatformStrategies>;
 public:
     static void initialize();
@@ -54,6 +62,9 @@
     virtual WebCore::PluginStrategy* createPluginStrategy() override;
     virtual WebCore::SharedWorkerStrategy* createSharedWorkerStrategy() override;
     virtual WebCore::StorageStrategy* createStorageStrategy() override;
+#if ENABLE(GAMEPAD)
+    virtual WebCore::GamepadStrategy* createGamepadStrategy() override;
+#endif
 
     // WebCore::CookiesStrategy
     virtual String cookiesForDOM(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&) override;
@@ -127,6 +138,13 @@
     Vector<WebCore::PluginInfo> m_cachedPlugins;
     Vector<WebCore::PluginInfo> m_cachedApplicationPlugins;
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
+
+#if ENABLE(GAMEPAD)
+    // WebCore::GamepadStrategy
+    virtual void startMonitoringGamepads(WebCore::GamepadStrategyClient*) override;
+    virtual void stopMonitoringGamepads(WebCore::GamepadStrategyClient*) override;
+    virtual const Vector<WebCore::PlatformGamepad*>& platformGamepads() override;
+#endif
 };
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to