-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Swift in WebKit] Fix Swift 6 warnings and errors in WKSLinearMediaPlayer #47043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Swift in WebKit] Fix Swift 6 warnings and errors in WKSLinearMediaPlayer #47043
Conversation
EWS run on previous version of this PR (hash d87fddc) |
d87fddc
to
1f51336
Compare
EWS run on previous version of this PR (hash 1f51336) |
1f51336
to
9847f2a
Compare
EWS run on previous version of this PR (hash 9847f2a) |
9847f2a
to
7492c7c
Compare
EWS run on previous version of this PR (hash 7492c7c) |
7492c7c
to
2876c9a
Compare
EWS run on previous version of this PR (hash 2876c9a) |
2876c9a
to
e7c9669
Compare
EWS run on previous version of this PR (hash e7c9669) |
e7c9669
to
753e491
Compare
EWS run on previous version of this PR (hash 753e491) |
753e491
to
a39e08c
Compare
EWS run on previous version of this PR (hash a39e08c) |
a39e08c
to
d35b378
Compare
EWS run on previous version of this PR (hash d35b378) |
@@ -47,7 +47,7 @@ | |||
#include <wtf/ThreadSafeWeakPtr.h> | |||
|
|||
OBJC_CLASS AVPlayerViewController; | |||
OBJC_CLASS LMPlayableViewController; | |||
OBJC_CLASS WKPlayableViewController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: mis-sorted
@@ -30,7 +30,7 @@ | |||
#include <WebCore/VideoPresentationInterfaceIOS.h> | |||
#include <wtf/TZoneMalloc.h> | |||
|
|||
OBJC_CLASS LMPlayableViewController; | |||
OBJC_CLASS WKPlayableViewController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: mis-sorted
@@ -300,7 +298,7 @@ - (void)layoutSublayers | |||
|
|||
ALWAYS_LOG_IF_POSSIBLE(LOGIDENTIFIER); | |||
m_playerViewController = [linearMediaPlayer() makeViewController]; | |||
[m_playerViewController view].alpha = 0; | |||
[[m_playerViewController baseViewController] view].alpha = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
[[m_playerViewController baseViewController] view].alpha = 0; | |
[m_playerViewController baseViewController].view.alpha = 0; |
@@ -45,7 +45,7 @@ | |||
#include <wtf/WeakHashSet.h> | |||
#include <wtf/text/WTFString.h> | |||
|
|||
OBJC_CLASS LMPlayableViewController; | |||
OBJC_CLASS WKPlayableViewController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: mis-sorted
@@ -98,6 +94,19 @@ API_AVAILABLE(visionos(1.0)) | |||
@property (nonatomic, readonly) float disparityAdjustment; | |||
@end | |||
|
|||
NS_ASSUME_NONNULL_END | |||
NS_SWIFT_UI_ACTOR | |||
@interface WKPlayableViewController : NSObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be called WKSPlayableViewController
so long as it lives in WebKitSwift. It's also strange to call this a view controller when it isn't (i.e. is not a UIViewController
).
d35b378
to
eba036f
Compare
EWS run on previous version of this PR (hash eba036f) |
eba036f
to
ea175e3
Compare
EWS run on previous version of this PR (hash ea175e3) |
OBJC_CLASS UIImage; | ||
OBJC_CLASS UIViewController; | ||
OBJC_CLASS UIWindow; | ||
OBJC_CLASS UIView; | ||
OBJC_CLASS CALayer; | ||
OBJC_CLASS NSError; | ||
OBJC_CLASS WebAVPlayerController; | ||
OBJC_CLASS WKSPlayableViewControllerHost; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: mis-sorted
void setSpatialImmersive(bool) final; | ||
void swapFullscreenModesWith(VideoPresentationInterfaceIOS&) final; | ||
|
||
WKSLinearMediaPlayer *linearMediaPlayer() const; | ||
void ensurePlayableViewController(); | ||
|
||
RetainPtr<LMPlayableViewController> m_playerViewController; | ||
RetainPtr<WKSPlayableViewControllerHost> m_playerViewController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RetainPtr<WKSPlayableViewControllerHost> m_playerViewController; | |
RetainPtr<WKSPlayableViewControllerHost> m_playerViewControllerHost; |
@@ -186,7 +186,7 @@ class VideoPresentationManagerProxy | |||
#endif | |||
|
|||
#if ENABLE(LINEAR_MEDIA_PLAYER) | |||
LMPlayableViewController *playableViewController(PlaybackSessionContextIdentifier) const; | |||
WKSPlayableViewControllerHost *playableViewController(PlaybackSessionContextIdentifier) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WKSPlayableViewControllerHost *playableViewController(PlaybackSessionContextIdentifier) const; | |
WKSPlayableViewControllerHost *playableViewController(PlaybackSessionContextIdentifier) const; |
NS_SWIFT_UI_ACTOR | ||
@interface WKSPlayableViewControllerHost : NSObject | ||
|
||
@property (nonatomic, readonly) UIViewController *baseViewController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be OK to just call this viewController
or playableViewController
now that the class has a better name.
r=me I'm not 100% convinced this statement is factual:
... but I think the introduction of |
ea175e3
to
33e59b5
Compare
EWS run on current version of this PR (hash 33e59b5) |
…ayer https://bugs.webkit.org/show_bug.cgi?id=294823 rdar://154057962 Reviewed by Andy Estes. Address Swift 6 errors in WKSLinearMediaPlayer and related code. - If it walks like a duck and talks like a duck... it's not always a duck. In this case, AVKit has a public Swift class `PlayableViewController` and annotated with `@objc(LMPlayableViewController)`. This annotation makes the type compatible and indistuinguishable from an Objective C type. However, Swift types cannot be accessed by Objective-C in another framework; within their own framework, the Swift bridging header is used. AVKit attempted to work around this by creating an Objective-C interface that was essentially a forward declaration of `LMPlayableViewController`; this is an unsupported configuration as it removes all compile-time checking, which results in the Swift compiler being confused. To fix, the `LMPlayableViewController` type is now never used within WebKit; only the `PlayableViewController` type is used from within Swift WebKit code. Consequently, a new wrapper type is created that abstracts the `PlayableViewController` and exposes the needed symbols to Objective-C, so that the compiler can function properly. - Use `@objc @implementation` instead of `@_objcImplementation`. - Use `RealityKit` instead of the re-exported `RealityFoundation` module. - Adopt `@preconcurrency` when needed, to silence errors due to the underlying framework symbols not having proper annotations. * Source/WebCore/platform/ios/VideoPresentationInterfaceAVKit.h: * Source/WebCore/platform/ios/VideoPresentationInterfaceIOS.h: (WebCore::VideoPresentationInterfaceIOS::playableViewController): * Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.h: * Source/WebKit/Platform/ios/VideoPresentationInterfaceLMK.mm: (WebKit::VideoPresentationInterfaceLMK::setupFullscreen): (WebKit::VideoPresentationInterfaceLMK::enterExternalPlayback): (WebKit::VideoPresentationInterfaceLMK::playerViewController const): (WebKit::VideoPresentationInterfaceLMK::playableViewController): (WebKit::VideoPresentationInterfaceLMK::ensurePlayableViewController): * Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.h: * Source/WebKit/UIProcess/Cocoa/VideoPresentationManagerProxy.mm: (WebKit::VideoPresentationManagerProxy::playableViewController const): * Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenViewController.mm: (-[WKFullScreenViewController configureEnvironmentPickerOrFullscreenVideoButtonView]): * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaKitExtras.h: Removed. * Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaKitExtras.swift: Removed. * Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaKitSPI.h: Removed. * Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaPlayer.swift: (SwiftOnlyData.viewController): (WKSLinearMediaPlayer.makeViewController): (WKSLinearMediaPlayer.enterExternalPresentation(_:(any Error)?) -> Void:)): (WKSLinearMediaPlayer.exitExternalPresentation(_:(any Error)?) -> Void:)): (WKSLinearMediaPlayer.enterFullscreen(_:(any Error)?) -> Void:)): (WKSLinearMediaPlayer.exitFullscreen(_:(any Error)?) -> Void:)): (WKSLinearMediaPlayer.maybeCreateSpatialOrImmersiveEntity): (WKSLinearMediaPlayer.maybeClearSpatialOrImmersiveEntity): * Source/WebKit/WebKitSwift/LinearMediaKit/LinearMediaTypes.swift: (WKSPlayableViewControllerHost.baseViewController): (WKSPlayableViewControllerHost.automaticallyDockOnFullScreenPresentation): (WKSPlayableViewControllerHost.dismissFullScreenOnExitingDocking): (WKSPlayableViewControllerHost.environmentPickerButtonViewController): (WKSPlayableViewControllerHost.playable): (WKSPlayableViewControllerHost.prefersAutoDimming): * Source/WebKit/WebKitSwift/LinearMediaKit/WKSLinearMediaPlayer.h: * Source/WebKit/WebKitSwift/LinearMediaKit/WKSLinearMediaTypes.h: * Source/WebKit/WebKitSwift/WebKitSwift.h: Canonical link: https://commits.webkit.org/296600@main
33e59b5
to
facbe72
Compare
Committed 296600@main (facbe72): https://commits.webkit.org/296600@main Reviewed commits have been landed. Closing PR #47043 and removing active labels. |
facbe72
33e59b5
🧪 mac-AS-debug-wk2