⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242678 in webkit


Ignore:
Timestamp:
Mar 9, 2019, 8:34:19 PM (7 years ago)
Author:
Chris Dumez
Message:

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:
Location:
trunk/Source/WebKit
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r242675 r242678  
     12019-03-09  Chris Dumez  <cdumez@apple.com>
     2
     3        Use modern async IPC with reply for device orientation permission
     4        https://bugs.webkit.org/show_bug.cgi?id=195529
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * UIProcess/WebPageProxy.cpp:
     9        (WebKit::WebPageProxy::requestDeviceOrientationAndMotionAccess):
     10        * UIProcess/WebPageProxy.h:
     11        * UIProcess/WebPageProxy.messages.in:
     12        * WebProcess/WebPage/WebPage.cpp:
     13        (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
     14        (WebKit::nextDeviceOrientationAndMotionPermissionCallbackID): Deleted.
     15        (WebKit::WebPage::didReceiveDeviceOrientationAndMotionAccessDecision): Deleted.
     16        * WebProcess/WebPage/WebPage.h:
     17        * WebProcess/WebPage/WebPage.messages.in:
     18
    1192019-03-09  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r242664 r242678  
    71767176
    71777177#if ENABLE(DEVICE_ORIENTATION)
    7178 void WebPageProxy::requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&& originData, uint64_t callbackID)
     7178void WebPageProxy::requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&& originData, CompletionHandler<void(bool)>&& completionHandler)
    71797179{
    71807180    auto origin = API::SecurityOrigin::create(originData.securityOrigin());
    7181     m_uiClient->shouldAllowDeviceOrientationAndMotionAccess(*this, origin.get(), [this, weakThis = makeWeakPtr(*this), callbackID](bool granted) {
    7182         if (!weakThis || !isValid())
    7183             return;
    7184         m_process->send(Messages::WebPage::DidReceiveDeviceOrientationAndMotionAccessDecision(callbackID, granted), m_pageID);
    7185     });
     7181    m_uiClient->shouldAllowDeviceOrientationAndMotionAccess(*this, origin.get(), WTFMove(completionHandler));
    71867182}
    71877183#endif
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r242664 r242678  
    14031403
    14041404#if ENABLE(DEVICE_ORIENTATION)
    1405     void requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&&, uint64_t callbackID);
     1405    void requestDeviceOrientationAndMotionAccess(WebCore::SecurityOriginData&&, CompletionHandler<void(bool)>&&);
    14061406#endif
    14071407
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r242664 r242678  
    535535
    536536#if ENABLE(DEVICE_ORIENTATION)
    537     RequestDeviceOrientationAndMotionAccess(struct WebCore::SecurityOriginData origin, uint64_t callbackID);
     537    RequestDeviceOrientationAndMotionAccess(struct WebCore::SecurityOriginData origin) -> (bool granted) Async
    538538#endif
    539539
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r242664 r242678  
    63426342
    63436343#if ENABLE(DEVICE_ORIENTATION)
    6344 static uint64_t nextDeviceOrientationAndMotionPermissionCallbackID()
    6345 {
    6346     static uint64_t nextCallbackID = 0;
    6347     return ++nextCallbackID;
    6348 }
    6349 
    6350 void WebPage::shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin& origin, CompletionHandler<void(bool)>&& callback)
    6351 {
    6352     auto callbackID = nextDeviceOrientationAndMotionPermissionCallbackID();
    6353     ASSERT(!m_deviceOrientationAndMotionPermissionCallbackMap.contains(callbackID));
    6354     m_deviceOrientationAndMotionPermissionCallbackMap.add(callbackID, WTFMove(callback));
    6355 
    6356     send(Messages::WebPageProxy::RequestDeviceOrientationAndMotionAccess(origin.data(), callbackID));
    6357 }
    6358 
    6359 void WebPage::didReceiveDeviceOrientationAndMotionAccessDecision(uint64_t callbackID, bool granted)
    6360 {
    6361     auto callback = m_deviceOrientationAndMotionPermissionCallbackMap.take(callbackID);
    6362     ASSERT(callback);
    6363     callback(granted);
     6344void WebPage::shouldAllowDeviceOrientationAndMotionAccess(const WebCore::SecurityOrigin& origin, CompletionHandler<void(bool)>&& completionHandler)
     6345{
     6346    sendWithAsyncReply(Messages::WebPageProxy::RequestDeviceOrientationAndMotionAccess(origin.data()), WTFMove(completionHandler));
    63646347}
    63656348#endif
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r242664 r242678  
    12111211#endif
    12121212
    1213 #if ENABLE(DEVICE_ORIENTATION)
    1214     void didReceiveDeviceOrientationAndMotionAccessDecision(uint64_t callbackID, bool granted);
    1215 #endif
    1216 
    12171213#if !PLATFORM(COCOA) && !PLATFORM(WPE)
    12181214    static const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
     
    18451841    HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
    18461842
    1847 #if ENABLE(DEVICE_ORIENTATION)
    1848     HashMap<uint64_t, WTF::CompletionHandler<void(bool granted)>> m_deviceOrientationAndMotionPermissionCallbackMap;
    1849 #endif
    1850 
    18511843#if ENABLE(APPLICATION_MANIFEST)
    18521844    HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r242664 r242678  
    364364    DidReceiveNotificationPermissionDecision(uint64_t notificationID, bool allowed)
    365365
    366 #if ENABLE(DEVICE_ORIENTATION)
    367     DidReceiveDeviceOrientationAndMotionAccessDecision(uint64_t callbackID, bool granted)
    368 #endif
    369 
    370366    # Printing.
    371367    BeginPrinting(uint64_t frameID, struct WebKit::PrintInfo printInfo)
Note: See TracChangeset for help on using the changeset viewer.