Diff
Modified: trunk/Source/WebKit/ChangeLog (242677 => 242678)
--- trunk/Source/WebKit/ChangeLog 2019-03-10 03:26:10 UTC (rev 242677)
+++ trunk/Source/WebKit/ChangeLog 2019-03-10 04:34:19 UTC (rev 242678)
@@ -1,3 +1,21 @@
+2019-03-09 Chris Dumez <[email protected]>
+
+ Use modern async IPC with reply for device orientation permission
+ https://bugs.webkit.org/show_bug.cgi?id=195529
+
+ Reviewed by Ryosuke Niwa.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
+ (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted.
+ (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2019-03-09 Zalan Bujtas <[email protected]>
[ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (242677 => 242678)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-10 03:26:10 UTC (rev 242677)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-10 04:34:19 UTC (rev 242678)
@@ -7175,14 +7175,10 @@
}
#if ENABLE(DEVICE_ORIENTATION)
-void WebPageProxy::requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&& originData, uint64_t callbackID)
+void WebPageProxy::requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&& originData, CompletionHandler<void(bool)>&& completionHandler)
{
auto origin = API::SecurityOrigin::create(originData.securityOrigin());
- m_uiClient->shouldAllowDeviceOrientationAndMotionAccess(*this, origin.get(), [this, weakThis = makeWeakPtr(*this), callbackID](bool granted) {
- if (!weakThis || !isValid())
- return;
- m_process->send(Messages::WebPage::DidReceiveDeviceOrientationAndMotionAccessDecision(callbackID, granted), m_pageID);
- });
+ m_uiClient->shouldAllowDeviceOrientationAndMotionAccess(*this, origin.get(), WTFMove(completionHandler));
}
#endif
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (242677 => 242678)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-03-10 03:26:10 UTC (rev 242677)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-03-10 04:34:19 UTC (rev 242678)
@@ -1402,7 +1402,7 @@
#endif
#if ENABLE(DEVICE_ORIENTATION)
- void requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&&, uint64_t callbackID);
+ void requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&&, CompletionHandler<void(bool)>&&);
#endif
static WebPageProxy* nonEphemeralWebPageProxy();
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (242677 => 242678)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-03-10 03:26:10 UTC (rev 242677)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2019-03-10 04:34:19 UTC (rev 242678)
@@ -534,7 +534,7 @@
LoadSynchronousURLSchemeTask(struct WebKit::URLSchemeTaskParameters parameters) -> (WebCore::ResourceResponse response, WebCore::ResourceError error, IPC::DataReference data) Delayed
#if ENABLE(DEVICE_ORIENTATION)
- RequestDeviceOrientationAndMotionAccess(struct WebCore::SecurityOriginData origin, uint64_t callbackID);
+ RequestDeviceOrientationAndMotionAccess(struct WebCore::SecurityOriginData origin) -> (bool granted) Async
#endif
#if ENABLE(ATTACHMENT_ELEMENT)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (242677 => 242678)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-03-10 03:26:10 UTC (rev 242677)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-03-10 04:34:19 UTC (rev 242678)
@@ -6341,27 +6341,10 @@
#endif
#if ENABLE(DEVICE_ORIENTATION)
-static uint64_t nextDeviceOrientationAndMotionPermissionCallbackID()
+void WebPage::shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin& origin, CompletionHandler<void(bool)>&& completionHandler)
{
- static uint64_t nextCallbackID = 0;
- return ++nextCallbackID;
+ sendWithAsyncReply(Messages::WebPageProxy::RequestDeviceOrientationAndMotionAccess(origin.data()), WTFMove(completionHandler));
}
-
-void WebPage::shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin& origin, CompletionHandler<void(bool)>&& callback)
-{
- auto callbackID = nextDeviceOrientationAndMotionPermissionCallbackID();
- ASSERT(!m_deviceOrientationAndMotionPermissionCallbackMap.contains(callbackID));
- m_deviceOrientationAndMotionPermissionCallbackMap.add(callbackID, WTFMove(callback));
-
- send(Messages::WebPageProxy::RequestDeviceOrientationAndMotionAccess(origin.data(), callbackID));
-}
-
-void WebPage::didReceiveDeviceOrientationAndMotionAccessDecision(uint64_t callbackID, bool granted)
-{
- auto callback = m_deviceOrientationAndMotionPermissionCallbackMap.take(callbackID);
- ASSERT(callback);
- callback(granted);
-}
#endif
static ShareSheetCallbackID nextShareSheetCallbackID()
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (242677 => 242678)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-03-10 03:26:10 UTC (rev 242677)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-03-10 04:34:19 UTC (rev 242678)
@@ -1210,10 +1210,6 @@
void requestAdditionalItemsForDragSession(const WebCore::IntPoint& clientPosition, const WebCore::IntPoint& globalPosition);
#endif
-#if ENABLE(DEVICE_ORIENTATION)
- void didReceiveDeviceOrientationAndMotionAccessDecision(uint64_t callbackID, bool granted);
-#endif
-
#if !PLATFORM(COCOA) && !PLATFORM(WPE)
static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
#endif
@@ -1844,10 +1840,6 @@
HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
-#if ENABLE(DEVICE_ORIENTATION)
- HashMap<uint64_t, WTF::CompletionHandler<void(bool granted)>> m_deviceOrientationAndMotionPermissionCallbackMap;
-#endif
-
#if ENABLE(APPLICATION_MANIFEST)
HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (242677 => 242678)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-03-10 03:26:10 UTC (rev 242677)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-03-10 04:34:19 UTC (rev 242678)
@@ -363,10 +363,6 @@
# Notification
DidReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed)
-#if ENABLE(DEVICE_ORIENTATION)
- DidReceiveDeviceOrientationAndMotionAccessDecision(uint64_t callbackID, bool granted)
-#endif
-
# Printing.
BeginPrinting(uint64_t frameID, struct WebKit::PrintInfo printInfo)
EndPrinting()