Changeset 260764 in webkit


Ignore:
Timestamp:
Apr 27, 2020, 10:13:19 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Reduce use of WebPageProxy::VoidCallback
https://bugs.webkit.org/show_bug.cgi?id=210944

Patch by Alex Christensen <achristensen@webkit.org> on 2020-04-27
Reviewed by Darin Adler.

Use sendWithAsyncReply and CompletionHandler<void()> instead.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _executeEditCommand:argument:completion:]):

  • UIProcess/Cocoa/WebViewImpl.mm:

(WebKit::WebViewImpl::becomeFirstResponder):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::setInitialFocus):
(WebKit::WebPageProxy::executeEditCommand):

  • UIProcess/WebPageProxy.h:

(WebKit::WebPageProxy::focusNextFocusedElement):

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView pasteWithCompletionHandler:]):
(-[WKContentView moveByOffset:]):
(-[WKContentView _selectPositionAtPoint:stayingWithinFocusedElement:completionHandler:]):
(-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]):
(-[WKContentView moveSelectionAtBoundary:inDirection:completionHandler:]):
(-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
(-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
(-[WKContentView accessoryTab:]):
(-[WKContentView executeEditCommandWithCallback:]):

  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
(WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
(WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
(WebKit::WebPageProxy::selectPositionAtPoint):
(WebKit::WebPageProxy::moveSelectionByOffset):
(WebKit::WebPageProxy::focusNextFocusedElement):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::executeEditCommandWithCallback):
(WebKit::WebPage::setInitialFocus):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::moveSelectionByOffset):
(WebKit::WebPage::selectPositionAtPoint):
(WebKit::WebPage::selectPositionAtBoundaryWithDirection):
(WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
(WebKit::WebPage::selectTextWithGranularityAtPoint):
(WebKit::WebPage::focusNextFocusedElement):

Location:
trunk/Source/WebKit
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r260763 r260764  
     12020-04-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Reduce use of WebPageProxy::VoidCallback
     4        https://bugs.webkit.org/show_bug.cgi?id=210944
     5
     6        Reviewed by Darin Adler.
     7
     8        Use sendWithAsyncReply and CompletionHandler<void()> instead.
     9
     10        * UIProcess/API/Cocoa/WKWebView.mm:
     11        (-[WKWebView _executeEditCommand:argument:completion:]):
     12        * UIProcess/Cocoa/WebViewImpl.mm:
     13        (WebKit::WebViewImpl::becomeFirstResponder):
     14        * UIProcess/WebPageProxy.cpp:
     15        (WebKit::WebPageProxy::setInitialFocus):
     16        (WebKit::WebPageProxy::executeEditCommand):
     17        * UIProcess/WebPageProxy.h:
     18        (WebKit::WebPageProxy::focusNextFocusedElement):
     19        * UIProcess/ios/WKContentViewInteraction.mm:
     20        (-[WKContentView pasteWithCompletionHandler:]):
     21        (-[WKContentView moveByOffset:]):
     22        (-[WKContentView _selectPositionAtPoint:stayingWithinFocusedElement:completionHandler:]):
     23        (-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]):
     24        (-[WKContentView moveSelectionAtBoundary:inDirection:completionHandler:]):
     25        (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
     26        (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
     27        (-[WKContentView accessoryTab:]):
     28        (-[WKContentView executeEditCommandWithCallback:]):
     29        * UIProcess/ios/WebPageProxyIOS.mm:
     30        (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
     31        (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
     32        (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
     33        (WebKit::WebPageProxy::selectPositionAtPoint):
     34        (WebKit::WebPageProxy::moveSelectionByOffset):
     35        (WebKit::WebPageProxy::focusNextFocusedElement):
     36        * WebProcess/WebPage/WebPage.cpp:
     37        (WebKit::WebPage::executeEditCommandWithCallback):
     38        (WebKit::WebPage::setInitialFocus):
     39        * WebProcess/WebPage/WebPage.h:
     40        * WebProcess/WebPage/WebPage.messages.in:
     41        * WebProcess/WebPage/ios/WebPageIOS.mm:
     42        (WebKit::WebPage::moveSelectionByOffset):
     43        (WebKit::WebPage::selectPositionAtPoint):
     44        (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
     45        (WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
     46        (WebKit::WebPage::selectTextWithGranularityAtPoint):
     47        (WebKit::WebPage::focusNextFocusedElement):
     48
    1492020-04-27  Per Arne Vollan  <pvollan@apple.com>
    250
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r260739 r260764  
    16171617- (void)_executeEditCommand:(NSString *)command argument:(NSString *)argument completion:(void (^)(BOOL))completion
    16181618{
    1619     _page->executeEditCommand(command, argument, [capturedCompletionBlock = makeBlockPtr(completion)](WebKit::CallbackBase::Error error) {
     1619    _page->executeEditCommand(command, argument, [capturedCompletionBlock = makeBlockPtr(completion)] {
    16201620        if (capturedCompletionBlock)
    1621             capturedCompletionBlock(error == WebKit::CallbackBase::Error::None);
     1621            capturedCompletionBlock(YES);
    16221622    });
    16231623}
  • trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm

    r260739 r260764  
    15821582        if ([event type] == NSEventTypeKeyDown || [event type] == NSEventTypeKeyUp)
    15831583            keyboardEvent = event;
    1584         m_page->setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, false, { }), [](WebKit::CallbackBase::Error) { });
     1584        m_page->setInitialFocus(direction == NSSelectingNext, keyboardEvent != nil, NativeWebKeyboardEvent(keyboardEvent, false, false, { }), [] { });
    15851585    }
    15861586    return true;
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r260739 r260764  
    21662166}
    21672167
    2168 void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent, WTF::Function<void (CallbackBase::Error)>&& callbackFunction)
     2168void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& keyboardEvent, CompletionHandler<void()>&& callbackFunction)
    21692169{
    21702170    if (!hasRunningProcess()) {
    2171         callbackFunction(CallbackBase::Error::OwnerWasInvalidated);
    2172         return;
    2173     }
    2174 
    2175     auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::setInitialFocus"_s));
    2176     send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent, callbackID));
     2171        callbackFunction();
     2172        return;
     2173    }
     2174
     2175    sendWithAsyncReply(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::setInitialFocus"_s)] () mutable {
     2176        callbackFunction();
     2177    });
    21772178}
    21782179
     
    23002301}
    23012302
    2302 void WebPageProxy::executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&& callbackFunction)
     2303void WebPageProxy::executeEditCommand(const String& commandName, const String& argument, CompletionHandler<void()>&& callbackFunction)
    23032304{
    23042305    if (!hasRunningProcess()) {
    2305         callbackFunction(CallbackBase::Error::Unknown);
     2306        callbackFunction();
    23062307        return;
    23072308    }
     
    23102311        willPerformPasteCommand();
    23112312
    2312     auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::executeEditCommand"_s));
    2313     send(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, argument, callbackID));
     2313    sendWithAsyncReply(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, argument), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::executeEditCommand"_s)] () mutable {
     2314        callbackFunction();
     2315    });
    23142316}
    23152317   
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r260752 r260764  
    642642    void viewWillEndLiveResize();
    643643
    644     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, WTF::Function<void (CallbackBase::Error)>&&);
     644    void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CompletionHandler<void()>&&);
    645645   
    646646    void clearSelection();
     
    675675    void selectAll();
    676676    void executeEditCommand(const String& commandName, const String& argument = String());
     677    void executeEditCommand(const String& commandName, const String& argument, CompletionHandler<void()>&&);
    677678    void validateCommand(const String& commandName, WTF::Function<void (const String&, bool, int32_t, CallbackBase::Error)>&&);
    678679
     
    702703    bool isMediaStreamCaptureMuted() const { return m_mutedState & WebCore::MediaProducer::MediaStreamCaptureIsMuted; }
    703704    void setMediaStreamCaptureMuted(bool);
    704     void executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&&);
    705        
     705
    706706    void requestFontAttributesAtSelectionStart(Function<void(const WebCore::FontAttributes&, CallbackBase::Error)>&&);
    707707    void fontAttributesCallback(const WebCore::FontAttributes&, CallbackID);
     
    757757    void extendSelection(WebCore::TextGranularity);
    758758    void selectWordBackward();
    759     void moveSelectionByOffset(int32_t offset, WTF::Function<void (CallbackBase::Error)>&&);
    760     void selectTextWithGranularityAtPoint(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&&);
    761     void selectPositionAtPoint(const WebCore::IntPoint, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&&);
    762     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint, WebCore::TextGranularity, WebCore::SelectionDirection, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&&);
    763     void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, WTF::Function<void(CallbackBase::Error)>&&);
     759    void moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&&);
     760    void selectTextWithGranularityAtPoint(const WebCore::IntPoint, WebCore::TextGranularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
     761    void selectPositionAtPoint(const WebCore::IntPoint, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
     762    void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint, WebCore::TextGranularity, WebCore::SelectionDirection, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
     763    void moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity, WebCore::SelectionDirection, CompletionHandler<void()>&&);
    764764    void beginSelectionInDirection(WebCore::SelectionDirection, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);
    765765    void updateSelectionWithExtentPoint(const WebCore::IntPoint, bool isInteractingWithFocusedElement, RespectSelectionAnchor, WTF::Function<void(uint64_t, CallbackBase::Error)>&&);
     
    779779    void performActionOnElement(uint32_t action);
    780780    void saveImageToLibrary(const SharedMemory::Handle& imageHandle, uint64_t imageSize);
    781     void focusNextFocusedElement(bool isForward, WTF::Function<void (CallbackBase::Error)>&& = [] (auto) { });
     781    void focusNextFocusedElement(bool isForward, CompletionHandler<void()>&& = [] { });
    782782    void setFocusedElementValue(const String&);
    783783    void setFocusedElementValueAsNumber(double);
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r260663 r260764  
    28332833- (void)pasteWithCompletionHandler:(void (^)(void))completionHandler
    28342834{
    2835     _page->executeEditCommand("Paste"_s, { }, [completion = makeBlockPtr(completionHandler)] (auto) {
     2835    _page->executeEditCommand("Paste"_s, { }, [completion = makeBlockPtr(completionHandler)] {
    28362836        if (completion)
    28372837            completion();
     
    39213921    [self beginSelectionChange];
    39223922    RetainPtr<WKContentView> view = self;
    3923     _page->moveSelectionByOffset(offset, [view](WebKit::CallbackBase::Error) {
     3923    _page->moveSelectionByOffset(offset, [view] {
    39243924        [view endSelectionChange];
    39253925    });
     
    40124012    RetainPtr<WKContentView> view = self;
    40134013
    4014     _page->selectPositionAtPoint(WebCore::IntPoint(point), stayingWithinFocusedElement, [view, selectionHandler](WebKit::CallbackBase::Error error) {
     4014    _page->selectPositionAtPoint(WebCore::IntPoint(point), stayingWithinFocusedElement, [view, selectionHandler]() {
    40154015        selectionHandler();
    40164016        view->_usingGestureForSelection = NO;
     
    40254025    RetainPtr<WKContentView> view = self;
    40264026   
    4027     _page->selectPositionAtBoundaryWithDirection(WebCore::IntPoint(point), toWKTextGranularity(granularity), toWKSelectionDirection(direction), self._hasFocusedElement, [view, selectionHandler](WebKit::CallbackBase::Error error) {
     4027    _page->selectPositionAtBoundaryWithDirection(WebCore::IntPoint(point), toWKTextGranularity(granularity), toWKSelectionDirection(direction), self._hasFocusedElement, [view, selectionHandler]() {
    40284028        selectionHandler();
    40294029        view->_usingGestureForSelection = NO;
     
    40384038    RetainPtr<WKContentView> view = self;
    40394039   
    4040     _page->moveSelectionAtBoundaryWithDirection(toWKTextGranularity(granularity), toWKSelectionDirection(direction), [view, selectionHandler](WebKit::CallbackBase::Error error) {
     4040    _page->moveSelectionAtBoundaryWithDirection(toWKTextGranularity(granularity), toWKSelectionDirection(direction), [view, selectionHandler] {
    40414041        selectionHandler();
    40424042        view->_usingGestureForSelection = NO;
     
    40524052    RetainPtr<WKContentView> view = self;
    40534053
    4054     _page->selectTextWithGranularityAtPoint(WebCore::IntPoint(point), toWKTextGranularity(granularity), self._hasFocusedElement, [view, selectionHandler](WebKit::CallbackBase::Error error) {
     4054    _page->selectTextWithGranularityAtPoint(WebCore::IntPoint(point), toWKTextGranularity(granularity), self._hasFocusedElement, [view, selectionHandler] {
    40554055        selectionHandler();
    40564056        view->_usingGestureForSelection = NO;
     
    42734273{
    42744274    constexpr bool isKeyboardEventValid = false;
    4275     _page->setInitialFocus(selectingForward, isKeyboardEventValid, { }, [protectedSelf = retainPtr(self), completionHandler = makeBlockPtr(completionHandler)] (auto) {
     4275    _page->setInitialFocus(selectingForward, isKeyboardEventValid, { }, [protectedSelf = retainPtr(self), completionHandler = makeBlockPtr(completionHandler)] {
    42764276        completionHandler([protectedSelf becomeFirstResponder]);
    42774277    });
     
    43374337    _isChangingFocusUsingAccessoryTab = YES;
    43384338    [self beginSelectionChange];
    4339     _page->focusNextFocusedElement(isNext, [protectedSelf = retainPtr(self)] (WebKit::CallbackBase::Error) {
     4339    _page->focusNextFocusedElement(isNext, [protectedSelf = retainPtr(self)] {
    43404340        [protectedSelf endSelectionChange];
    43414341        [protectedSelf reloadInputViews];
     
    54085408    [self beginSelectionChange];
    54095409    RetainPtr<WKContentView> view = self;
    5410     _page->executeEditCommand(commandName, { }, [view](WebKit::CallbackBase::Error) {
     5410    _page->executeEditCommand(commandName, { }, [view] {
    54115411        [view endSelectionChange];
    54125412    });
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r260486 r260764  
    506506}
    507507
    508 void WebPageProxy::selectTextWithGranularityAtPoint(const WebCore::IntPoint point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&& callbackFunction)
    509 {
    510     if (!hasRunningProcess()) {
    511         callbackFunction(CallbackBase::Error::Unknown);
    512         return;
    513     }
    514    
    515     auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::selectTextWithGranularityAtPoint"_s));
    516     m_process->send(Messages::WebPage::SelectTextWithGranularityAtPoint(point, static_cast<uint32_t>(granularity), isInteractingWithFocusedElement, callbackID), m_webPageID);
    517 }
    518 
    519 void WebPageProxy::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint point, WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&& callbackFunction)
    520 {
    521     if (!hasRunningProcess()) {
    522         callbackFunction(CallbackBase::Error::Unknown);
    523         return;
    524     }
    525    
    526     auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::selectPositionAtBoundaryWithDirection"_s));
    527     m_process->send(Messages::WebPage::SelectPositionAtBoundaryWithDirection(point, static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction), isInteractingWithFocusedElement, callbackID), m_webPageID);
    528 }
    529 
    530 void WebPageProxy::moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, WTF::Function<void(CallbackBase::Error)>&& callbackFunction)
    531 {
    532     if (!hasRunningProcess()) {
    533         callbackFunction(CallbackBase::Error::Unknown);
    534         return;
    535     }
    536    
    537     auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::moveSelectionAtBoundaryWithDirection"_s));
    538     m_process->send(Messages::WebPage::MoveSelectionAtBoundaryWithDirection(static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction), callbackID), m_webPageID);
    539 }
    540    
    541 void WebPageProxy::selectPositionAtPoint(const WebCore::IntPoint point, bool isInteractingWithFocusedElement, WTF::Function<void(CallbackBase::Error)>&& callbackFunction)
    542 {
    543     if (!hasRunningProcess()) {
    544         callbackFunction(CallbackBase::Error::Unknown);
    545         return;
    546     }
    547    
    548     auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::selectPositionAtPoint"_s));
    549     m_process->send(Messages::WebPage::SelectPositionAtPoint(point, isInteractingWithFocusedElement, callbackID), m_webPageID);
     508void WebPageProxy::selectTextWithGranularityAtPoint(const WebCore::IntPoint point, WebCore::TextGranularity granularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& callbackFunction)
     509{
     510    if (!hasRunningProcess()) {
     511        callbackFunction();
     512        return;
     513    }
     514   
     515    sendWithAsyncReply(Messages::WebPage::SelectTextWithGranularityAtPoint(point, static_cast<uint32_t>(granularity), isInteractingWithFocusedElement), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::selectTextWithGranularityAtPoint"_s)] () mutable {
     516        callbackFunction();
     517    });
     518}
     519
     520void WebPageProxy::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint point, WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& callbackFunction)
     521{
     522    if (!hasRunningProcess()) {
     523        callbackFunction();
     524        return;
     525    }
     526   
     527    sendWithAsyncReply(Messages::WebPage::SelectPositionAtBoundaryWithDirection(point, static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction), isInteractingWithFocusedElement), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::selectPositionAtBoundaryWithDirection"_s)] () mutable {
     528        callbackFunction();
     529    });
     530}
     531
     532void WebPageProxy::moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity granularity, WebCore::SelectionDirection direction, CompletionHandler<void()>&& callbackFunction)
     533{
     534    if (!hasRunningProcess()) {
     535        callbackFunction();
     536        return;
     537    }
     538   
     539    sendWithAsyncReply(Messages::WebPage::MoveSelectionAtBoundaryWithDirection(static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction)), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::moveSelectionAtBoundaryWithDirection"_s)] () mutable {
     540        callbackFunction();
     541    });
     542}
     543   
     544void WebPageProxy::selectPositionAtPoint(const WebCore::IntPoint point, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& callbackFunction)
     545{
     546    if (!hasRunningProcess()) {
     547        callbackFunction();
     548        return;
     549    }
     550   
     551    sendWithAsyncReply(Messages::WebPage::SelectPositionAtPoint(point, isInteractingWithFocusedElement), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::selectPositionAtPoint"_s)] () mutable {
     552        callbackFunction();
     553    });
    550554}
    551555
     
    796800}
    797801
    798 void WebPageProxy::moveSelectionByOffset(int32_t offset, WTF::Function<void (CallbackBase::Error)>&& callbackFunction)
    799 {
    800     if (!hasRunningProcess()) {
    801         callbackFunction(CallbackBase::Error::Unknown);
    802         return;
    803     }
    804    
    805     auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::moveSelectionByOffset"_s));
    806     m_process->send(Messages::WebPage::MoveSelectionByOffset(offset, callbackID), m_webPageID);
     802void WebPageProxy::moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&& callbackFunction)
     803{
     804    if (!hasRunningProcess()) {
     805        callbackFunction();
     806        return;
     807    }
     808   
     809    sendWithAsyncReply(Messages::WebPage::MoveSelectionByOffset(offset), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::moveSelectionByOffset"_s)] () mutable {
     810        callbackFunction();
     811    });
    807812}
    808813
     
    10511056}
    10521057
    1053 void WebPageProxy::focusNextFocusedElement(bool isForward, WTF::Function<void(CallbackBase::Error)>&& callbackFunction)
    1054 {
    1055     if (!hasRunningProcess()) {
    1056         callbackFunction(CallbackBase::Error::Unknown);
    1057         return;
    1058     }
    1059    
    1060     auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivity("WebPageProxy::focusNextFocusedElement"_s));
    1061     process().send(Messages::WebPage::FocusNextFocusedElement(isForward, callbackID), m_webPageID);
     1058void WebPageProxy::focusNextFocusedElement(bool isForward, CompletionHandler<void()>&& callbackFunction)
     1059{
     1060    if (!hasRunningProcess()) {
     1061        callbackFunction();
     1062        return;
     1063    }
     1064   
     1065    sendWithAsyncReply(Messages::WebPage::FocusNextFocusedElement(isForward), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::focusNextFocusedElement"_s)] () mutable {
     1066        callbackFunction();
     1067    });
    10621068}
    10631069
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r260753 r260764  
    11201120}
    11211121
    1122 void WebPage::executeEditCommandWithCallback(const String& commandName, const String& argument, CallbackID callbackID)
     1122void WebPage::executeEditCommandWithCallback(const String& commandName, const String& argument, CompletionHandler<void()>&& completionHandler)
    11231123{
    11241124    executeEditCommand(commandName, argument);
    1125     send(Messages::WebPageProxy::VoidCallback(callbackID));
     1125    completionHandler();
    11261126}
    11271127
     
    31433143}
    31443144
    3145 void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event, CallbackID callbackID)
     3145void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event, CompletionHandler<void()>&& completionHandler)
    31463146{
    31473147    if (!m_page)
    3148         return;
     3148        return completionHandler();
    31493149
    31503150    SetForScope<bool> userIsInteractingChange { m_userIsInteracting, true };
     
    31573157        platformEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown);
    31583158        m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, &KeyboardEvent::create(platformEvent, &frame.windowProxy()).get());
    3159 
    3160         send(Messages::WebPageProxy::VoidCallback(callbackID));
     3159        completionHandler();
    31613160        return;
    31623161    }
    31633162
    31643163    m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, nullptr);
    3165     send(Messages::WebPageProxy::VoidCallback(callbackID));
     3164    completionHandler();
    31663165}
    31673166
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r260753 r260764  
    642642    void disabledAdaptationsDidChange(const OptionSet<WebCore::DisabledAdaptations>&);
    643643    void viewportPropertiesDidChange(const WebCore::ViewportArguments&);
    644     void executeEditCommandWithCallback(const String&, const String& argument, CallbackID);
     644    void executeEditCommandWithCallback(const String&, const String& argument, CompletionHandler<void()>&&);
    645645    void selectAll();
    646646
     
    690690    void extendSelection(uint32_t granularity);
    691691    void selectWordBackward();
    692     void moveSelectionByOffset(int32_t offset, CallbackID);
    693     void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement, CallbackID);
    694     void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, CallbackID);
    695     void moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CallbackID);
    696     void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CallbackID);
     692    void moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&&);
     693    void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
     694    void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
     695    void moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CompletionHandler<void()>&&);
     696    void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, CompletionHandler<void()>&&);
    697697    void beginSelectionInDirection(uint32_t direction, CallbackID);
    698698    void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithFocusedElement, RespectSelectionAnchor, CallbackID);
     
    711711    void stopInteraction();
    712712    void performActionOnElement(uint32_t action);
    713     void focusNextFocusedElement(bool isForward, CallbackID);
     713    void focusNextFocusedElement(bool isForward, CompletionHandler<void()>&&);
    714714    void autofillLoginCredentials(const String&, const String&);
    715715    void setFocusedElementValue(const String&);
     
    14301430    void goToBackForwardItem(uint64_t navigationID, const WebCore::BackForwardItemIdentifier&, WebCore::FrameLoadType, WebCore::ShouldTreatAsContinuingLoad, Optional<WebsitePoliciesData>&&);
    14311431    void tryRestoreScrollPosition();
    1432     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
     1432    void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CompletionHandler<void()>&&);
    14331433    void updateIsInWindow(bool isInitialState = false);
    14341434    void visibilityDidChange();
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r260739 r260764  
    2222
    2323messages -> WebPage LegacyReceiver {
    24     SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event, WebKit::CallbackID callbackID)
     24    SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event) -> () Async
    2525    SetActivityState(OptionSet<WebCore::ActivityState::Flag> activityState, WebKit::ActivityStateChangeID activityStateChangeID, Vector<WebKit::CallbackID> callbackIDs)
    2626    SetLayerHostingMode(enum:uint8_t WebKit::LayerHostingMode layerHostingMode)
     
    4444    ViewWillEndLiveResize()
    4545
    46     ExecuteEditCommandWithCallback(String name, String argument, WebKit::CallbackID callbackID)
     46    ExecuteEditCommandWithCallback(String name, String argument) -> () Async
    4747    KeyEvent(WebKit::WebKeyboardEvent event)
    4848    MouseEvent(WebKit::WebMouseEvent event)
     
    6969    ExtendSelection(uint32_t granularity)
    7070    SelectWordBackward()
    71     MoveSelectionByOffset(int32_t offset, WebKit::CallbackID callbackID)
    72     SelectTextWithGranularityAtPoint(WebCore::IntPoint point, uint32_t granularity, bool isInteractingWithFocusedElement, WebKit::CallbackID callbackID)
    73     SelectPositionAtBoundaryWithDirection(WebCore::IntPoint point, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, WebKit::CallbackID callbackID)
    74     MoveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, WebKit::CallbackID callbackID)
    75     SelectPositionAtPoint(WebCore::IntPoint point, bool isInteractingWithFocusedElement, WebKit::CallbackID callbackID)
     71    MoveSelectionByOffset(int32_t offset) -> () Async
     72    SelectTextWithGranularityAtPoint(WebCore::IntPoint point, uint32_t granularity, bool isInteractingWithFocusedElement) -> () Async
     73    SelectPositionAtBoundaryWithDirection(WebCore::IntPoint point, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement) -> () Async
     74    MoveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction) -> () Async
     75    SelectPositionAtPoint(WebCore::IntPoint point, bool isInteractingWithFocusedElement) -> () Async
    7676    BeginSelectionInDirection(uint32_t direction, WebKit::CallbackID callbackID)
    7777    UpdateSelectionWithExtentPoint(WebCore::IntPoint point, bool isInteractingWithFocusedElement, enum:bool WebKit::RespectSelectionAnchor respectSelectionAnchor, WebKit::CallbackID callbackID)
     
    9090    StopInteraction()
    9191    PerformActionOnElement(uint32_t action)
    92     FocusNextFocusedElement(bool isForward, WebKit::CallbackID callbackID)
     92    FocusNextFocusedElement(bool isForward) -> () Async
    9393    SetFocusedElementValue(String value)
    9494    AutofillLoginCredentials(String username, String password)
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r260759 r260764  
    18371837}
    18381838
    1839 void WebPage::moveSelectionByOffset(int32_t offset, CallbackID callbackID)
     1839void WebPage::moveSelectionByOffset(int32_t offset, CompletionHandler<void()>&& completionHandler)
    18401840{
    18411841    Frame& frame = m_page->focusController().focusedOrMainFrame();
     
    18531853    if (position.isNotNull() && startPosition != position)
    18541854        frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered);
    1855     send(Messages::WebPageProxy::VoidCallback(callbackID));
     1855    completionHandler();
    18561856}
    18571857   
     
    20742074}
    20752075
    2076 void WebPage::selectPositionAtPoint(const WebCore::IntPoint& point, bool isInteractingWithFocusedElement, CallbackID callbackID)
     2076void WebPage::selectPositionAtPoint(const WebCore::IntPoint& point, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& completionHandler)
    20772077{
    20782078    SetForScope<bool> userIsInteractingChange { m_userIsInteracting, true };
     
    20852085    if (position.isNotNull())
    20862086        frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), position.affinity(), WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered);
    2087     send(Messages::WebPageProxy::VoidCallback(callbackID));
    2088 }
    2089 
    2090 void WebPage::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint& point, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, CallbackID callbackID)
     2087    completionHandler();
     2088}
     2089
     2090void WebPage::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint& point, uint32_t granularity, uint32_t direction, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& completionHandler)
    20912091{
    20922092    auto& frame = m_page->focusController().focusedOrMainFrame();
     
    20982098            frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered);
    20992099    }
    2100     send(Messages::WebPageProxy::VoidCallback(callbackID));
    2101 }
    2102 
    2103 void WebPage::moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CallbackID callbackID)
     2100    completionHandler();
     2101}
     2102
     2103void WebPage::moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CompletionHandler<void()>&& completionHandler)
    21042104{
    21052105    Frame& frame = m_page->focusController().focusedOrMainFrame();
     
    21122112            frame.selection().setSelectedRange(Range::create(*frame.document(), position, position).ptr(), isForward? UPSTREAM : DOWNSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered);
    21132113    }
    2114     send(Messages::WebPageProxy::VoidCallback(callbackID));
     2114    completionHandler();
    21152115}
    21162116
     
    21582158}
    21592159
    2160 void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithFocusedElement, CallbackID callbackID)
     2160void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithFocusedElement, CompletionHandler<void()>&& completionHandler)
    21612161{
    21622162    setFocusedFrameBeforeSelectingTextAtLocation(point);
     
    21672167        frame.selection().setSelectedRange(range.get(), UPSTREAM, WebCore::FrameSelection::ShouldCloseTyping::Yes, UserTriggered);
    21682168    m_initialSelection = range;
    2169     send(Messages::WebPageProxy::VoidCallback(callbackID));
     2169    completionHandler();
    21702170}
    21712171
     
    30693069}
    30703070
    3071 void WebPage::focusNextFocusedElement(bool isForward, CallbackID callbackID)
     3071void WebPage::focusNextFocusedElement(bool isForward, CompletionHandler<void()>&& completionHandler)
    30723072{
    30733073    Element* nextElement = nextAssistableElement(m_focusedElement.get(), *m_page, isForward);
     
    30763076        nextElement->focus();
    30773077    m_userIsInteracting = false;
    3078     send(Messages::WebPageProxy::VoidCallback(callbackID));
     3078    completionHandler();
    30793079}
    30803080
Note: See TracChangeset for help on using the changeset viewer.