Title: [263878] trunk/Source/WebCore
Revision
263878
Author
beid...@apple.com
Date
2020-07-02 18:05:35 -0700 (Thu, 02 Jul 2020)

Log Message

GameController.framework soft linking refactoring
https://bugs.webkit.org/show_bug.cgi?id=213909

Reviewed by Tim Horton.

No new tests (No behavior changes)

* WebCore.xcodeproj/project.pbxproj:
* platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
(WebCore::GameControllerGamepadProvider::startMonitoringGamepads):
* platform/gamepad/cocoa/GameControllerSPI.h: Added.
* platform/gamepad/cocoa/GameControllerSoftLink.h: Added.
* platform/gamepad/cocoa/GameControllerSoftLink.mm: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (263877 => 263878)


--- trunk/Source/WebCore/ChangeLog	2020-07-03 00:22:29 UTC (rev 263877)
+++ trunk/Source/WebCore/ChangeLog	2020-07-03 01:05:35 UTC (rev 263878)
@@ -1,3 +1,19 @@
+2020-07-02  Brady Eidson  <beid...@apple.com>
+
+        GameController.framework soft linking refactoring
+        https://bugs.webkit.org/show_bug.cgi?id=213909
+
+        Reviewed by Tim Horton.
+
+        No new tests (No behavior changes)
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
+        (WebCore::GameControllerGamepadProvider::startMonitoringGamepads):
+        * platform/gamepad/cocoa/GameControllerSPI.h: Added.
+        * platform/gamepad/cocoa/GameControllerSoftLink.h: Added.
+        * platform/gamepad/cocoa/GameControllerSoftLink.mm: Added.
+
 2020-07-02  Simon Fraser  <simon.fra...@apple.com>
 
         REGRESSION(r260276): menu items in footer of https://salo.ai are invisible until you hover or resize

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (263877 => 263878)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-07-03 00:22:29 UTC (rev 263877)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-07-03 01:05:35 UTC (rev 263878)
@@ -1408,6 +1408,7 @@
 		512DD8F80D91E6AF000F89EE /* ArchiveResourceCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8EE0D91E6AF000F89EE /* ArchiveResourceCollection.h */; };
 		512DD8FC0D91E6AF000F89EE /* ArchiveResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8F20D91E6AF000F89EE /* ArchiveResource.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		512DD8FD0D91E6AF000F89EE /* ArchiveFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 512DD8F30D91E6AF000F89EE /* ArchiveFactory.h */; };
+		5130F2F624AEA60A00E1D0A0 /* GameControllerSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5130F2F424AEA60300E1D0A0 /* GameControllerSoftLink.mm */; };
 		51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 51327D5E11A33A2B004F9D65 /* SinkDocument.h */; };
 		513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
 		51405C89190B014400754F94 /* SelectionRectGatherer.h in Headers */ = {isa = PBXBuildFile; fileRef = 51405C87190B014400754F94 /* SelectionRectGatherer.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8223,6 +8224,9 @@
 		512DD8F20D91E6AF000F89EE /* ArchiveResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchiveResource.h; sourceTree = "<group>"; };
 		512DD8F30D91E6AF000F89EE /* ArchiveFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchiveFactory.h; sourceTree = "<group>"; };
 		512F1A771C07EA0D00908239 /* IDBGetResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBGetResult.cpp; sourceTree = "<group>"; };
+		5130F2F224AEA60200E1D0A0 /* GameControllerSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameControllerSoftLink.h; sourceTree = "<group>"; };
+		5130F2F424AEA60300E1D0A0 /* GameControllerSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GameControllerSoftLink.mm; sourceTree = "<group>"; };
+		5130F2F524AEA60300E1D0A0 /* GameControllerSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameControllerSPI.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>"; };
@@ -19711,6 +19715,9 @@
 				51E398FD1D6E474B009C8831 /* GameControllerGamepad.mm */,
 				51E398FE1D6E474B009C8831 /* GameControllerGamepadProvider.h */,
 				51E398FF1D6E474B009C8831 /* GameControllerGamepadProvider.mm */,
+				5130F2F224AEA60200E1D0A0 /* GameControllerSoftLink.h */,
+				5130F2F424AEA60300E1D0A0 /* GameControllerSoftLink.mm */,
+				5130F2F524AEA60300E1D0A0 /* GameControllerSPI.h */,
 			);
 			path = cocoa;
 			sourceTree = "<group>";
@@ -34915,6 +34922,7 @@
 				DE5F84321FA186E9006DB63A /* UnifiedSource329.cpp in Sources */,
 				DE5F84331FA186E9006DB63A /* UnifiedSource330.cpp in Sources */,
 				DE5F84341FA186E9006DB63A /* UnifiedSource331.cpp in Sources */,
+				5130F2F624AEA60A00E1D0A0 /* GameControllerSoftLink.mm in Sources */,
 				DE5F84351FA186E9006DB63A /* UnifiedSource332.cpp in Sources */,
 				DE5F84361FA186E9006DB63A /* UnifiedSource333.cpp in Sources */,
 				DE5F84371FA186E9006DB63A /* UnifiedSource334.cpp in Sources */,

Modified: trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm (263877 => 263878)


--- trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm	2020-07-03 00:22:29 UTC (rev 263877)
+++ trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerGamepadProvider.mm	2020-07-03 01:05:35 UTC (rev 263878)
@@ -29,17 +29,12 @@
 #if ENABLE(GAMEPAD)
 
 #import "GameControllerGamepad.h"
+#import "GameControllerSoftLink.h"
 #import "GamepadProviderClient.h"
 #import "Logging.h"
 #import <GameController/GameController.h>
 #import <wtf/NeverDestroyed.h>
-#import <wtf/SoftLinking.h>
 
-SOFT_LINK_FRAMEWORK_OPTIONAL(GameController)
-SOFT_LINK_CLASS_OPTIONAL(GameController, GCController);
-SOFT_LINK_CONSTANT_MAY_FAIL(GameController, GCControllerDidConnectNotification, NSString *)
-SOFT_LINK_CONSTANT_MAY_FAIL(GameController, GCControllerDidDisconnectNotification, NSString *)
-
 namespace WebCore {
 
 static const Seconds inputNotificationDelay { 16_ms };
@@ -106,14 +101,14 @@
     if (m_connectObserver)
         return;
 
-    if (canLoadGCControllerDidConnectNotification()) {
-        m_connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:getGCControllerDidConnectNotification() object:nil queue:nil usingBlock:^(NSNotification *notification) {
+    if (canLoad_GameController_GCControllerDidConnectNotification()) {
+        m_connectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:get_GameController_GCControllerDidConnectNotification() object:nil queue:nil usingBlock:^(NSNotification *notification) {
             GameControllerGamepadProvider::singleton().controllerDidConnect(notification.object, ConnectionVisibility::Visible);
         }];
     }
 
-    if (canLoadGCControllerDidDisconnectNotification()) {
-        m_disconnectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:getGCControllerDidDisconnectNotification() object:nil queue:nil usingBlock:^(NSNotification *notification) {
+    if (canLoad_GameController_GCControllerDidDisconnectNotification()) {
+        m_disconnectObserver = [[NSNotificationCenter defaultCenter] addObserverForName:get_GameController_GCControllerDidDisconnectNotification() object:nil queue:nil usingBlock:^(NSNotification *notification) {
             GameControllerGamepadProvider::singleton().controllerDidDisconnect(notification.object);
         }];
     }

Added: trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerSPI.h (0 => 263878)


--- trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerSPI.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerSPI.h	2020-07-03 01:05:35 UTC (rev 263878)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#if ENABLE(GAMEPAD) && PLATFORM(COCOA)
+
+// FIXME: Refactor more GC framework stuff into this header
+
+#endif // ENABLE(GAMEPAD) && PLATFORM(COCOA)

Added: trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerSoftLink.h (0 => 263878)


--- trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerSoftLink.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerSoftLink.h	2020-07-03 01:05:35 UTC (rev 263878)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 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) && PLATFORM(COCOA)
+
+#import "GameControllerSPI.h"
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, GameController)
+SOFT_LINK_CLASS_FOR_HEADER(WebCore, GCController)
+
+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, GameController, GCControllerDidConnectNotification, NSString *)
+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_HEADER(WebCore, GameController, GCControllerDidDisconnectNotification, NSString *)
+
+#endif // ENABLE(GAMEPAD) && PLATFORM(COCOA)

Added: trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerSoftLink.mm (0 => 263878)


--- trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerSoftLink.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/gamepad/cocoa/GameControllerSoftLink.mm	2020-07-03 01:05:35 UTC (rev 263878)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 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 "config.h"
+
+#if ENABLE(GAMEPAD) && PLATFORM(COCOA)
+
+#import "GameControllerSPI.h"
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_SOURCE(WebCore, GameController)
+SOFT_LINK_CLASS_FOR_SOURCE_OPTIONAL(WebCore, GameController, GCController)
+
+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, GameController, GCControllerDidConnectNotification, NSString *)
+SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, GameController, GCControllerDidDisconnectNotification, NSString *)
+
+#endif // ENABLE(GAMEPAD) && PLATFORM(COCOA)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to