Diff
Modified: trunk/Source/WebKit/ChangeLog (272604 => 272605)
--- trunk/Source/WebKit/ChangeLog 2021-02-09 21:01:48 UTC (rev 272604)
+++ trunk/Source/WebKit/ChangeLog 2021-02-09 21:17:47 UTC (rev 272605)
@@ -1,5 +1,25 @@
2021-02-09 Alex Christensen <[email protected]>
+ Use CompletionHandler instead of NowPlayingInfoCallback
+ https://bugs.webkit.org/show_bug.cgi?id=221617
+
+ Reviewed by Chris Dumez.
+
+ * UIProcess/API/Cocoa/WKWebViewTesting.mm:
+ (-[WKWebView _requestActiveNowPlayingSessionInfo:]):
+ * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+ (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::requestActiveNowPlayingSessionInfo): Deleted.
+ (WebKit::WebPageProxy::nowPlayingInfoCallback): Deleted.
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+ (WebKit::WebPage::requestActiveNowPlayingSessionInfo):
+ * WebProcess/WebPage/WebPage.messages.in:
+
+2021-02-09 Alex Christensen <[email protected]>
+
Synthesize range responses if needed in WebCoreNSURLSession
https://bugs.webkit.org/show_bug.cgi?id=221072
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm (272604 => 272605)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm 2021-02-09 21:01:48 UTC (rev 272604)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm 2021-02-09 21:17:47 UTC (rev 272605)
@@ -85,12 +85,9 @@
return;
}
- auto handler = makeBlockPtr(callback);
- auto localCallback = WebKit::NowPlayingInfoCallback::create([handler](bool active, bool registeredAsNowPlayingApplication, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier, WebKit::CallbackBase::Error) {
+ _page->requestActiveNowPlayingSessionInfo([handler = makeBlockPtr(callback)] (bool active, bool registeredAsNowPlayingApplication, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier) {
handler(active, registeredAsNowPlayingApplication, title, duration, elapsedTime, uniqueIdentifier);
});
-
- _page->requestActiveNowPlayingSessionInfo(WTFMove(localCallback));
}
- (BOOL)_scrollingUpdatesDisabledForTesting
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (272604 => 272605)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2021-02-09 21:01:48 UTC (rev 272604)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2021-02-09 21:17:47 UTC (rev 272605)
@@ -570,6 +570,11 @@
return SandboxExtension::HandleArray();
}
+void WebPageProxy::requestActiveNowPlayingSessionInfo(CompletionHandler<void(bool, bool, const String&, double, double, uint64_t)>&& callback)
+{
+ sendWithAsyncReply(Messages::WebPage::RequestActiveNowPlayingSessionInfo(), WTFMove(callback));
+}
+
} // namespace WebKit
#undef MESSAGE_CHECK_COMPLETION
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (272604 => 272605)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-02-09 21:01:48 UTC (rev 272604)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-02-09 21:17:47 UTC (rev 272605)
@@ -9237,32 +9237,6 @@
#endif
}
-#if PLATFORM(COCOA)
-void WebPageProxy::requestActiveNowPlayingSessionInfo(Ref<NowPlayingInfoCallback>&& callback)
-{
- if (!hasRunningProcess()) {
- callback->invalidate();
- return;
- }
-
- auto callbackID = callback->callbackID();
- m_callbacks.put(WTFMove(callback));
-
- send(Messages::WebPage::RequestActiveNowPlayingSessionInfo(callbackID));
-}
-
-void WebPageProxy::nowPlayingInfoCallback(bool hasActiveSession, bool registeredAsNowPlayingApplication, const String& title, double duration, double elapsedTime, uint64_t uniqueIdentifier, CallbackID callbackID)
-{
- auto callback = m_callbacks.take<NowPlayingInfoCallback>(callbackID);
- if (!callback) {
- // FIXME: Log error or assert.
- return;
- }
-
- callback->performCallbackWithReturnValue(hasActiveSession, registeredAsNowPlayingApplication, title, duration, elapsedTime, uniqueIdentifier);
-}
-#endif
-
void WebPageProxy::handleAutoplayEvent(WebCore::AutoplayEvent event, OptionSet<AutoplayEventFlags> flags)
{
m_uiClient->handleAutoplayEvent(*this, event, flags);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (272604 => 272605)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-02-09 21:01:48 UTC (rev 272604)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2021-02-09 21:17:47 UTC (rev 272605)
@@ -405,10 +405,6 @@
typedef GenericCallback<const Optional<WebCore::ApplicationManifest>&> ApplicationManifestCallback;
#endif
-#if PLATFORM(COCOA)
-typedef GenericCallback<bool, bool, String, double, double, uint64_t> NowPlayingInfoCallback;
-#endif
-
#if ENABLE(DATE_AND_TIME_INPUT_TYPES)
class WebDateTimePicker;
#endif
@@ -1465,8 +1461,7 @@
bool isPlayingVideoInEnhancedFullscreen() const;
#if PLATFORM(COCOA)
- void requestActiveNowPlayingSessionInfo(Ref<NowPlayingInfoCallback>&&);
- void nowPlayingInfoCallback(bool, bool, const String&, double, double, uint64_t, CallbackID);
+ void requestActiveNowPlayingSessionInfo(CompletionHandler<void(bool, bool, const String&, double, double, uint64_t)>&&);
#endif
#if PLATFORM(MAC)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (272604 => 272605)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-02-09 21:01:48 UTC (rev 272604)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2021-02-09 21:17:47 UTC (rev 272605)
@@ -190,9 +190,6 @@
#if PLATFORM(GTK)
PrintFinishedCallback(WebCore::ResourceError error, WebKit::CallbackID callbackID)
#endif
-#if PLATFORM(COCOA)
- NowPlayingInfoCallback(bool active, bool registeredAsNowPlayingApplication, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier, WebKit::CallbackID callbackID)
-#endif
PageScaleFactorDidChange(double scaleFactor)
PluginScaleFactorDidChange(double zoomFactor)
Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (272604 => 272605)
--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2021-02-09 21:01:48 UTC (rev 272604)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2021-02-09 21:17:47 UTC (rev 272605)
@@ -91,7 +91,7 @@
#endif
}
-void WebPage::requestActiveNowPlayingSessionInfo(CallbackID callbackID)
+void WebPage::requestActiveNowPlayingSessionInfo(CompletionHandler<void(bool, bool, const String&, double, double, uint64_t)>&& completionHandler)
{
bool hasActiveSession = false;
String title = emptyString();
@@ -108,7 +108,7 @@
registeredAsNowPlayingApplication = sharedManager->registeredAsNowPlayingApplication();
}
- send(Messages::WebPageProxy::NowPlayingInfoCallback(hasActiveSession, registeredAsNowPlayingApplication, title, duration, elapsedTime, uniqueIdentifier, callbackID));
+ completionHandler(hasActiveSession, registeredAsNowPlayingApplication, title, duration, elapsedTime, uniqueIdentifier);
}
void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (272604 => 272605)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-02-09 21:01:48 UTC (rev 272604)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2021-02-09 21:17:47 UTC (rev 272605)
@@ -1742,7 +1742,7 @@
#endif
#if PLATFORM(COCOA)
- void requestActiveNowPlayingSessionInfo(CallbackID);
+ void requestActiveNowPlayingSessionInfo(CompletionHandler<void(bool, bool, const String&, double, double, uint64_t)>&&);
RetainPtr<NSData> accessibilityRemoteTokenData() const;
void accessibilityTransferRemoteToken(RetainPtr<NSData>);
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (272604 => 272605)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2021-02-09 21:01:48 UTC (rev 272604)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2021-02-09 21:17:47 UTC (rev 272605)
@@ -519,7 +519,7 @@
#endif
#if PLATFORM(COCOA)
- RequestActiveNowPlayingSessionInfo(WebKit::CallbackID callbackID)
+ RequestActiveNowPlayingSessionInfo() -> (bool active, bool registeredAsNowPlayingApplication, String title, double duration, double elapsedTime, uint64_t uniqueIdentifier) Async
#endif
SetShouldDispatchFakeMouseMoveEvents(bool shouldDispatchFakeMouseMoveEvents)