Changeset 243326 in webkit


Ignore:
Timestamp:
Mar 21, 2019 2:04:40 PM (5 years ago)
Author:
achristensen@apple.com
Message:

Stop using LegacySync messages in WebPage
https://bugs.webkit.org/show_bug.cgi?id=196057

Reviewed by Chris Dumez.

  • WebProcess/WebPage/WebPage.h:

(WebKit::WebPage::markLayersVolatile):

  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/gtk/WebPageGtk.cpp:

(WebKit::WebPage::getCenterForZoomGesture):

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::readSelectionFromPasteboard):
(WebKit::WebPage::getStringSelectionForPasteboard):
(WebKit::WebPage::getDataSelectionForPasteboard):
(WebKit::WebPage::shouldDelayWindowOrderingEvent):
(WebKit::WebPage::acceptsFirstMouse):

  • WebProcess/WebPage/mac/WebPageMac.mm:

(WebKit::WebPage::replaceSelectionWithPasteboardData):
(WebKit::WebPage::readSelectionFromPasteboard):
(WebKit::WebPage::getStringSelectionForPasteboard):
(WebKit::WebPage::getDataSelectionForPasteboard):
(WebKit::WebPage::shouldDelayWindowOrderingEvent):
(WebKit::WebPage::acceptsFirstMouse):

Location:
trunk/Source/WebKit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243325 r243326  
     12019-03-21  Alex Christensen  <achristensen@webkit.org>
     2
     3        Stop using LegacySync messages in WebPage
     4        https://bugs.webkit.org/show_bug.cgi?id=196057
     5
     6        Reviewed by Chris Dumez.
     7
     8        * WebProcess/WebPage/WebPage.h:
     9        (WebKit::WebPage::markLayersVolatile):
     10        * WebProcess/WebPage/WebPage.messages.in:
     11        * WebProcess/WebPage/gtk/WebPageGtk.cpp:
     12        (WebKit::WebPage::getCenterForZoomGesture):
     13        * WebProcess/WebPage/ios/WebPageIOS.mm:
     14        (WebKit::WebPage::readSelectionFromPasteboard):
     15        (WebKit::WebPage::getStringSelectionForPasteboard):
     16        (WebKit::WebPage::getDataSelectionForPasteboard):
     17        (WebKit::WebPage::shouldDelayWindowOrderingEvent):
     18        (WebKit::WebPage::acceptsFirstMouse):
     19        * WebProcess/WebPage/mac/WebPageMac.mm:
     20        (WebKit::WebPage::replaceSelectionWithPasteboardData):
     21        (WebKit::WebPage::readSelectionFromPasteboard):
     22        (WebKit::WebPage::getStringSelectionForPasteboard):
     23        (WebKit::WebPage::getDataSelectionForPasteboard):
     24        (WebKit::WebPage::shouldDelayWindowOrderingEvent):
     25        (WebKit::WebPage::acceptsFirstMouse):
     26
    1272019-03-21  Alex Christensen  <achristensen@webkit.org>
    228
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r243195 r243326  
    706706    void unfreezeLayerTree(LayerTreeFreezeReason);
    707707
    708     void markLayersVolatile(WTF::Function<void (bool)>&& completionHandler = { });
     708    void markLayersVolatile(Function<void(bool)>&& completionHandler = { });
    709709    void cancelMarkLayersVolatile();
    710710
     
    755755
    756756#if PLATFORM (GTK) && HAVE(GTK_GESTURES)
    757     void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);
     757    void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, CompletionHandler<void(WebCore::IntPoint&&)>&&);
    758758#endif
    759759
     
    783783    void confirmCompositionAsync();
    784784
    785     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
    786     void getStringSelectionForPasteboard(WTF::String& stringValue);
    787     void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
    788     void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
    789     void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
     785    void readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&&);
     786    void getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&&);
     787    void getDataSelectionForPasteboard(const String pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&&);
     788    void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&&);
     789    void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&&);
    790790    bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
    791791#endif
     
    11231123#endif
    11241124
    1125     void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
     1125    void showShareSheet(WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&& callback);
    11261126    void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
    11271127   
     
    18141814
    18151815    WebCore::Timer m_layerVolatilityTimer;
    1816     Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
     1816    Vector<Function<void(bool)>> m_markLayersAsVolatileCompletionHandlers;
    18171817    bool m_isSuspendedUnderLock { false };
    18181818
     
    18691869    HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
    18701870
    1871     HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
    1872     HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
     1871    HashMap<uint64_t, Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
     1872    HashMap<ShareSheetCallbackID, Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
    18731873
    18741874#if ENABLE(APPLICATION_MANIFEST)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r243012 r243326  
    408408
    409409#if PLATFORM (GTK) && HAVE(GTK_GESTURES)
    410     GetCenterForZoomGesture(WebCore::IntPoint centerInViewCoordinates) -> (WebCore::IntPoint center) LegacySync
     410    GetCenterForZoomGesture(WebCore::IntPoint centerInViewCoordinates) -> (WebCore::IntPoint center) Delayed
    411411#endif
    412412
     
    418418    SetMainFrameIsScrollable(bool isScrollable)
    419419    RegisterUIProcessAccessibilityTokens(IPC::DataReference elemenToken, IPC::DataReference windowToken)
    420     GetStringSelectionForPasteboard() -> (String stringValue) LegacySync
    421     GetDataSelectionForPasteboard(String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) LegacySync
    422     ReadSelectionFromPasteboard(String pasteboardName) -> (bool result) LegacySync
     420    GetStringSelectionForPasteboard() -> (String stringValue) Delayed
     421    GetDataSelectionForPasteboard(String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Delayed
     422    ReadSelectionFromPasteboard(String pasteboardName) -> (bool result) Delayed
    423423
    424424#if ENABLE(SERVICE_CONTROLS)
     
    426426#endif
    427427
    428     ShouldDelayWindowOrderingEvent(WebKit::WebMouseEvent event) -> (bool result) LegacySync
    429     AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result) LegacySync
     428    ShouldDelayWindowOrderingEvent(WebKit::WebMouseEvent event) -> (bool result) Delayed
     429    AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result) Delayed
    430430
    431431    SetTextAsync(String text)
  • trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp

    r241721 r243326  
    177177
    178178#if HAVE(GTK_GESTURES)
    179 void WebPage::getCenterForZoomGesture(const IntPoint& centerInViewCoordinates, IntPoint& result)
    180 {
    181     result = mainFrameView()->rootViewToContents(centerInViewCoordinates);
     179void WebPage::getCenterForZoomGesture(const IntPoint& centerInViewCoordinates, CompletionHandler<void(WebCore::IntPoint&&)>&& completionHandler)
     180{
     181    IntPoint result = mainFrameView()->rootViewToContents(centerInViewCoordinates);
    182182    double scale = m_page->pageScaleFactor();
    183183    result.scale(1 / scale, 1 / scale);
     184    completionHandler(WTFMove(result));
    184185}
    185186#endif
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r243102 r243326  
    480480}
    481481
    482 void WebPage::readSelectionFromPasteboard(const String&, bool&)
     482void WebPage::readSelectionFromPasteboard(const String&, CompletionHandler<void(bool&&)>&& completionHandler)
    483483{
    484484    notImplemented();
    485 }
    486 
    487 void WebPage::getStringSelectionForPasteboard(String&)
     485    completionHandler(false);
     486}
     487
     488void WebPage::getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&& completionHandler)
    488489{
    489490    notImplemented();
    490 }
    491 
    492 void WebPage::getDataSelectionForPasteboard(const String, SharedMemory::Handle&, uint64_t&)
     491    completionHandler({ });
     492}
     493
     494void WebPage::getDataSelectionForPasteboard(const String, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler)
    493495{
    494496    notImplemented();
     497    completionHandler({ }, 0);
    495498}
    496499
     
    507510}
    508511
    509 void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool&)
     512void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&& completionHandler)
    510513{
    511514    notImplemented();
    512 }
    513 
    514 void WebPage::acceptsFirstMouse(int, const WebKit::WebMouseEvent&, bool&)
     515    completionHandler(false);
     516}
     517
     518void WebPage::acceptsFirstMouse(int, const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&& completionHandler)
    515519{
    516520    notImplemented();
     521    completionHandler(false);
    517522}
    518523
  • trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm

    r242320 r243326  
    505505        WebPasteboardOverrides::sharedPasteboardOverrides().addOverride(replaceSelectionPasteboardName(), type, data.vector());
    506506
    507     bool result;
    508     readSelectionFromPasteboard(replaceSelectionPasteboardName(), result);
     507    readSelectionFromPasteboard(replaceSelectionPasteboardName(), [](bool) { });
    509508
    510509    for (auto& type : types)
     
    530529}
    531530
    532 void WebPage::readSelectionFromPasteboard(const String& pasteboardName, bool& result)
     531void WebPage::readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&& completionHandler)
     532{
     533    auto& frame = m_page->focusController().focusedOrMainFrame();
     534    if (frame.selection().isNone())
     535        return completionHandler(false);
     536    frame.editor().readSelectionFromPasteboard(pasteboardName);
     537    completionHandler(true);
     538}
     539
     540void WebPage::getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&& completionHandler)
    533541{
    534542    Frame& frame = m_page->focusController().focusedOrMainFrame();
    535     if (frame.selection().isNone()) {
    536         result = false;
    537         return;
    538     }
    539     frame.editor().readSelectionFromPasteboard(pasteboardName);
    540     result = true;
    541 }
    542 
    543 void WebPage::getStringSelectionForPasteboard(String& stringValue)
    544 {
    545     Frame& frame = m_page->focusController().focusedOrMainFrame();
    546 
    547     if (PluginView* pluginView = focusedPluginViewForFrame(frame)) {
     543
     544    if (auto* pluginView = focusedPluginViewForFrame(frame)) {
    548545        String selection = pluginView->getSelectionString();
    549         if (!selection.isNull()) {
    550             stringValue = selection;
    551             return;
    552         }
     546        if (!selection.isNull())
     547            return completionHandler(WTFMove(selection));
    553548    }
    554549
    555550    if (frame.selection().isNone())
    556         return;
    557 
    558     stringValue = frame.editor().stringSelectionForPasteboard();
    559 }
    560 
    561 void WebPage::getDataSelectionForPasteboard(const String pasteboardType, SharedMemory::Handle& handle, uint64_t& size)
    562 {
    563     Frame& frame = m_page->focusController().focusedOrMainFrame();
     551        return completionHandler({ });
     552
     553    completionHandler(frame.editor().stringSelectionForPasteboard());
     554}
     555
     556void WebPage::getDataSelectionForPasteboard(const String pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler)
     557{
     558    auto& frame = m_page->focusController().focusedOrMainFrame();
    564559    if (frame.selection().isNone())
    565         return;
     560        return completionHandler({ }, 0);
    566561
    567562    RefPtr<SharedBuffer> buffer = frame.editor().dataSelectionForPasteboard(pasteboardType);
    568     if (!buffer) {
    569         size = 0;
    570         return;
    571     }
    572     size = buffer->size();
     563    if (!buffer)
     564        return completionHandler({ }, 0);
     565    uint64_t size = buffer->size();
    573566    RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::allocate(size);
    574567    memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
     568    SharedMemory::Handle handle;
    575569    sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
     570    completionHandler(WTFMove(handle), size);
    576571}
    577572
     
    590585}
    591586
    592 void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent& event, bool& result)
    593 {
    594     Frame& frame = m_page->focusController().focusedOrMainFrame();
    595 
     587void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent& event, CompletionHandler<void(bool)>&& completionHandler)
     588{
     589    auto& frame = m_page->focusController().focusedOrMainFrame();
     590
     591    bool result = false;
    596592#if ENABLE(DRAG_SUPPORT)
    597593    HitTestResult hitResult = frame.eventHandler().hitTestResultAtPoint(frame.view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active);
    598594    if (hitResult.isSelected())
    599595        result = frame.eventHandler().eventMayStartDrag(platform(event));
    600     else
    601596#endif
    602         result = false;
    603 }
    604 
    605 void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event, bool& result)
    606 {
    607     result = false;
    608 
     597    completionHandler(result);
     598}
     599
     600void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event, CompletionHandler<void(bool)>&& completionHandler)
     601{
    609602    if (WebProcess::singleton().parentProcessConnection()->inSendSync()) {
    610603        // In case we're already inside a sendSync message, it's possible that the page is in a
    611604        // transitionary state, so any hit-testing could cause crashes  so we just return early in that case.
    612         return;
    613     }
    614 
    615     Frame& frame = m_page->focusController().focusedOrMainFrame();
     605        return completionHandler(false);
     606    }
     607
     608    auto& frame = m_page->focusController().focusedOrMainFrame();
    616609
    617610    HitTestResult hitResult = frame.eventHandler().hitTestResultAtPoint(frame.view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active);
    618611    frame.eventHandler().setActivationEventNumber(eventNumber);
     612    bool result = false;
    619613#if ENABLE(DRAG_SUPPORT)
    620614    if (hitResult.isSelected())
     
    623617#endif
    624618        result = !!hitResult.scrollbar();
     619    completionHandler(result);
    625620}
    626621
Note: See TracChangeset for help on using the changeset viewer.