Assert that callback ID is not 0 or -1 during encoding and decoding
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Jun 2017 03:03:54 +0000 (03:03 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Jun 2017 03:03:54 +0000 (03:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=173803

Reviewed by Brady Eidson.

To diagnosing the hang inside Safari (<rdar://problem/32841256>), add assertions for the callback ID
to be not 0 or -1 during encoding and decoding of IPC messages since the latest analysis seems to
indicate the hang is caused by the hash map getting corrupted by the insertion of 0 (empty value).

Wrapped the uint64_t in CallbackID and OptionalCallbackID to add assertions.

* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
* Shared/CallbackID.h: Added.
(WebKit::CallbackID::CallbackID):
(WebKit::CallbackID::operator==):
(WebKit::CallbackID::toInteger):
(WebKit::CallbackID::isValid):
(WebKit::CallbackID::isValidCallbackID): A callback ID is valid when it's neither 0 nor -1.
(WebKit::CallbackID::fromInteger): Create a CallbackID object from potentially unsafe value.
(WebKit::CallbackID::generateID): Generates the next callback ID. Moved from CallbackBase.
(WebKit::CallbackID::encode): Added. Assert that it's neither 0 nor -1.
(WebKit::CallbackID::decode): Ditto.
(WTF::CallbackIDHash::hash):
(WTF::CallbackIDHash::equal):
(WTF::HashTraits<WebKit::CallbackID>::emptyValue):
(WTF::HashTraits<WebKit::CallbackID>::constructDeletedValue):
(WTF::HashTraits<WebKit::CallbackID>::isDeletedValue):
* Shared/OptionalCallbackID.h: Added. Unlike CallbackID, callback ID here can be 0.
(WebKit::OptionalCallbackID::OptionalCallbackID):
(WebKit::OptionalCallbackID::toInteger):
(WebKit::OptionalCallbackID::callbackID): Returns a valid CallbackID object. The caller of
this function must have verified that the ID is neither 0 or -1 before calling this function.
(WebKit::OptionalCallbackID::operator bool):
(WebKit::OptionalCallbackID::isValid):
(WebKit::OptionalCallbackID::isValidCallbackID):
(WebKit::OptionalCallbackID::encode): Since OptionalCallbackID can be 0, only assert that it's not -1.
(WebKit::OptionalCallbackID::decode): Ditto.
* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.h:
* UIProcess/GenericCallback.h:
(WebKit::CallbackBase::callbackID): Returns a CallbackID object instead of uint64_t.
(WebKit::CallbackBase::CallbackBase):
(WebKit::CallbackBase::generateCallbackID): Deleted.
(WebKit::CallbackMap::put): Returns a callback ID. Also added a version that doesn't take activity token
as used in WebCookieManagerProxy
(WebKit::CallbackMap::take): Takes a callback ID.
* UIProcess/WebCookieManagerProxy.cpp: Updated the code as callback maps are merged.
(WebKit::WebCookieManagerProxy::processPoolDestroyed):
(WebKit::WebCookieManagerProxy::processDidClose):
(WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
(WebKit::WebCookieManagerProxy::didGetHostnamesWithCookies):
(WebKit::WebCookieManagerProxy::deleteCookie):
(WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
(WebKit::WebCookieManagerProxy::setCookie):
(WebKit::WebCookieManagerProxy::setCookies):
(WebKit::WebCookieManagerProxy::getAllCookies):
(WebKit::WebCookieManagerProxy::getCookies):
(WebKit::WebCookieManagerProxy::didSetCookies):
(WebKit::WebCookieManagerProxy::didGetCookies):
(WebKit::WebCookieManagerProxy::didDeleteCookies):
(WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy):
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebCookieManagerProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setInitialFocus):
(WebKit::WebPageProxy::validateCommand):
(WebKit::WebPageProxy::runJavaScriptInMainFrame):
(WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
(WebKit::WebPageProxy::getSourceForFrame):
(WebKit::WebPageProxy::getContentsAsString):
(WebKit::WebPageProxy::getBytecodeProfile):
(WebKit::WebPageProxy::getSamplingProfilerOutput):
(WebKit::WebPageProxy::getContentsAsMHTMLData):
(WebKit::WebPageProxy::getSelectionOrContentsAsString):
(WebKit::WebPageProxy::getSelectionAsWebArchiveData):
(WebKit::WebPageProxy::getMainResourceDataOfFrame):
(WebKit::WebPageProxy::getResourceDataFromFrame):
(WebKit::WebPageProxy::getWebArchiveOfFrame):
(WebKit::WebPageProxy::forceRepaint):
(WebKit::WebPageProxy::clearLoadDependentCallbacks):
(WebKit::WebPageProxy::voidCallback):
(WebKit::WebPageProxy::dataCallback):
(WebKit::WebPageProxy::imageCallback):
(WebKit::WebPageProxy::stringCallback):
(WebKit::WebPageProxy::invalidateStringCallback):
(WebKit::WebPageProxy::scriptValueCallback):
(WebKit::WebPageProxy::computedPagesCallback):
(WebKit::WebPageProxy::validateCommandCallback):
(WebKit::WebPageProxy::unsignedCallback):
(WebKit::WebPageProxy::editingRangeCallback):
(WebKit::WebPageProxy::machSendRightCallback):
(WebKit::WebPageProxy::rectForCharacterRangeCallback):
(WebKit::WebPageProxy::printFinishedCallback):
(WebKit::WebPageProxy::computePagesForPrinting):
(WebKit::WebPageProxy::drawRectToImage):
(WebKit::WebPageProxy::drawPagesToPDF):
(WebKit::WebPageProxy::drawPagesForPrinting):
(WebKit::WebPageProxy::getMarkedRangeAsync):
(WebKit::WebPageProxy::getSelectedRangeAsync):
(WebKit::WebPageProxy::characterIndexForPointAsync):
(WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
(WebKit::WebPageProxy::takeSnapshot):
(WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
(WebKit::WebPageProxy::getLoadDecisionForIcon):
(WebKit::WebPageProxy::finishedLoadingIcon):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::gestureCallback):
(WebKit::WebPageProxy::touchesCallback):
(WebKit::WebPageProxy::autocorrectionDataCallback):
(WebKit::WebPageProxy::selectionContextCallback):
(WebKit::WebPageProxy::autocorrectionContextCallback):
(WebKit::WebPageProxy::selectionRectsCallback):
(WebKit::WebPageProxy::selectWithGesture):
(WebKit::WebPageProxy::updateSelectionWithTouches):
(WebKit::WebPageProxy::requestAutocorrectionData):
(WebKit::WebPageProxy::applyAutocorrection):
(WebKit::WebPageProxy::executeEditCommand):
(WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
(WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
(WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
(WebKit::WebPageProxy::selectPositionAtPoint):
(WebKit::WebPageProxy::beginSelectionInDirection):
(WebKit::WebPageProxy::updateSelectionWithExtentPoint):
(WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
(WebKit::WebPageProxy::requestDictationContext):
(WebKit::WebPageProxy::requestAutocorrectionContext):
(WebKit::WebPageProxy::getSelectionContext):
(WebKit::WebPageProxy::selectWithTwoTouches):
(WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
(WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
(WebKit::WebPageProxy::moveSelectionByOffset):
(WebKit::WebPageProxy::focusNextAssistedNode):
(WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
(WebKit::WebPageProxy::drawToPDFCallback):
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
(-[WKPrintingView _askPageToComputePageRects]):
(-[WKPrintingView _drawPreview:]):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
(WebKit::WebPageProxy::attributedStringForCharacterRangeCallback):
(WebKit::WebPageProxy::fontAtSelection):
(WebKit::WebPageProxy::fontAtSelectionCallback):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::getHostnamesWithCookies):
(WebKit::WebCookieManager::deleteCookie):
(WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
(WebKit::WebCookieManager::getAllCookies):
(WebKit::WebCookieManager::getCookies):
(WebKit::WebCookieManager::setCookie):
(WebKit::WebCookieManager::setCookies):
(WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
(WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
* WebProcess/Cookies/WebCookieManager.h:
* WebProcess/Cookies/WebCookieManager.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
(WebKit::WebFrameLoaderClient::finishedLoadingIcon):
* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
(WebKit::AcceleratedDrawingArea::forceRepaintAsync):
(WebKit::AcceleratedDrawingArea::activityStateDidChange):
* WebProcess/WebPage/AcceleratedDrawingArea.h:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::forceRepaintAsync):
(WebKit::CoordinatedLayerTreeHost::renderNextFrame):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::forceRepaintAsync):
(WebKit::DrawingArea::activityStateDidChange):
(WebKit::DrawingArea::addTransactionCallbackID):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/LayerTreeHost.h:
(WebKit::LayerTreeHost::forceRepaintAsync):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::reinitializeWebPage):
(WebKit::WebPage::takeSnapshot):
(WebKit::WebPage::validateCommand):
(WebKit::WebPage::setInitialFocus):
(WebKit::WebPage::setActivityState):
(WebKit::WebPage::runJavaScriptInMainFrame):
(WebKit::WebPage::getContentsAsString):
(WebKit::WebPage::getContentsAsMHTMLData):
(WebKit::WebPage::getRenderTreeExternalRepresentation):
(WebKit::WebPage::getSelectionAsWebArchiveData):
(WebKit::WebPage::getSelectionOrContentsAsString):
(WebKit::WebPage::getSourceForFrame):
(WebKit::WebPage::getMainResourceDataOfFrame):
(WebKit::WebPage::getResourceDataFromFrame):
(WebKit::WebPage::getWebArchiveOfFrame):
(WebKit::WebPage::forceRepaint):
(WebKit::WebPage::computePagesForPrinting):
(WebKit::WebPage::drawRectToImage):
(WebKit::WebPage::drawPagesToPDF):
(WebKit::WebPage::drawPagesForPrinting):
(WebKit::WebPage::didFinishPrintOperation):
(WebKit::WebPage::getMarkedRangeAsync):
(WebKit::WebPage::getSelectedRangeAsync):
(WebKit::WebPage::characterIndexForPointAsync):
(WebKit::WebPage::firstRectForCharacterRangeAsync):
(WebKit::WebPage::getBytecodeProfile):
(WebKit::WebPage::getSamplingProfilerOutput):
(WebKit::WebPage::didGetLoadDecisionForIcon):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
(WebKit::WebPrintOperationGtk::WebPrintOperationGtk):
* WebProcess/WebPage/gtk/WebPrintOperationGtk.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getSelectionContext):
(WebKit::WebPage::selectWithGesture):
(WebKit::WebPage::updateSelectionWithTouches):
(WebKit::WebPage::selectWithTwoTouches):
(WebKit::WebPage::moveSelectionByOffset):
(WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
(WebKit::WebPage::getRectsAtSelectionOffsetWithText):
(WebKit::WebPage::selectPositionAtPoint):
(WebKit::WebPage::selectPositionAtBoundaryWithDirection):
(WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
(WebKit::WebPage::selectTextWithGranularityAtPoint):
(WebKit::WebPage::beginSelectionInDirection):
(WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
(WebKit::WebPage::updateSelectionWithExtentPoint):
(WebKit::WebPage::requestDictationContext):
(WebKit::WebPage::requestAutocorrectionData):
(WebKit::WebPage::applyAutocorrection):
(WebKit::WebPage::executeEditCommandWithCallback):
(WebKit::WebPage::requestAutocorrectionContext):
(WebKit::WebPage::focusNextAssistedNode):
(WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
(WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
(WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
(WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
(WebKit::WebPage::fontAtSelection):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218985 268f45cc-cd09-0410-ab3c-d52691b4dbfc

38 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp
Source/WebKit2/Shared/CallbackID.h [new file with mode: 0644]
Source/WebKit2/Shared/OptionalCallbackID.h [new file with mode: 0644]
Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h
Source/WebKit2/UIProcess/GenericCallback.h
Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
Source/WebKit2/UIProcess/WebCookieManagerProxy.h
Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
Source/WebKit2/UIProcess/mac/WKPrintingView.mm
Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp
Source/WebKit2/WebProcess/Cookies/WebCookieManager.h
Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp
Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h
Source/WebKit2/WebProcess/WebPage/DrawingArea.h
Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp
Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.h
Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

index e158080..d28a79d 100644 (file)
@@ -1,3 +1,254 @@
+2017-06-29  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Assert that callback ID is not 0 or -1 during encoding and decoding
+        https://bugs.webkit.org/show_bug.cgi?id=173803
+
+        Reviewed by Brady Eidson.
+
+        To diagnosing the hang inside Safari (<rdar://problem/32841256>), add assertions for the callback ID
+        to be not 0 or -1 during encoding and decoding of IPC messages since the latest analysis seems to
+        indicate the hang is caused by the hash map getting corrupted by the insertion of 0 (empty value).
+
+        Wrapped the uint64_t in CallbackID and OptionalCallbackID to add assertions.
+
+        * NetworkProcess/soup/NetworkProcessSoup.cpp:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcess):
+        * Shared/CallbackID.h: Added.
+        (WebKit::CallbackID::CallbackID):
+        (WebKit::CallbackID::operator==):
+        (WebKit::CallbackID::toInteger):
+        (WebKit::CallbackID::isValid):
+        (WebKit::CallbackID::isValidCallbackID): A callback ID is valid when it's neither 0 nor -1.
+        (WebKit::CallbackID::fromInteger): Create a CallbackID object from potentially unsafe value.
+        (WebKit::CallbackID::generateID): Generates the next callback ID. Moved from CallbackBase.
+        (WebKit::CallbackID::encode): Added. Assert that it's neither 0 nor -1.
+        (WebKit::CallbackID::decode): Ditto.
+        (WTF::CallbackIDHash::hash):
+        (WTF::CallbackIDHash::equal):
+        (WTF::HashTraits<WebKit::CallbackID>::emptyValue):
+        (WTF::HashTraits<WebKit::CallbackID>::constructDeletedValue):
+        (WTF::HashTraits<WebKit::CallbackID>::isDeletedValue):
+        * Shared/OptionalCallbackID.h: Added. Unlike CallbackID, callback ID here can be 0.
+        (WebKit::OptionalCallbackID::OptionalCallbackID):
+        (WebKit::OptionalCallbackID::toInteger):
+        (WebKit::OptionalCallbackID::callbackID): Returns a valid CallbackID object. The caller of
+        this function must have verified that the ID is neither 0 or -1 before calling this function.
+        (WebKit::OptionalCallbackID::operator bool):
+        (WebKit::OptionalCallbackID::isValid):
+        (WebKit::OptionalCallbackID::isValidCallbackID):
+        (WebKit::OptionalCallbackID::encode): Since OptionalCallbackID can be 0, only assert that it's not -1.
+        (WebKit::OptionalCallbackID::decode): Ditto.
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        * UIProcess/GenericCallback.h:
+        (WebKit::CallbackBase::callbackID): Returns a CallbackID object instead of uint64_t.
+        (WebKit::CallbackBase::CallbackBase):
+        (WebKit::CallbackBase::generateCallbackID): Deleted.
+        (WebKit::CallbackMap::put): Returns a callback ID. Also added a version that doesn't take activity token
+        as used in WebCookieManagerProxy
+        (WebKit::CallbackMap::take): Takes a callback ID.
+        * UIProcess/WebCookieManagerProxy.cpp: Updated the code as callback maps are merged.
+        (WebKit::WebCookieManagerProxy::processPoolDestroyed):
+        (WebKit::WebCookieManagerProxy::processDidClose):
+        (WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
+        (WebKit::WebCookieManagerProxy::didGetHostnamesWithCookies):
+        (WebKit::WebCookieManagerProxy::deleteCookie):
+        (WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
+        (WebKit::WebCookieManagerProxy::setCookie):
+        (WebKit::WebCookieManagerProxy::setCookies):
+        (WebKit::WebCookieManagerProxy::getAllCookies):
+        (WebKit::WebCookieManagerProxy::getCookies):
+        (WebKit::WebCookieManagerProxy::didSetCookies):
+        (WebKit::WebCookieManagerProxy::didGetCookies):
+        (WebKit::WebCookieManagerProxy::didDeleteCookies):
+        (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
+        (WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
+        (WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
+        (WebKit::WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy):
+        * UIProcess/WebCookieManagerProxy.h:
+        * UIProcess/WebCookieManagerProxy.messages.in:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setInitialFocus):
+        (WebKit::WebPageProxy::validateCommand):
+        (WebKit::WebPageProxy::runJavaScriptInMainFrame):
+        (WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
+        (WebKit::WebPageProxy::getSourceForFrame):
+        (WebKit::WebPageProxy::getContentsAsString):
+        (WebKit::WebPageProxy::getBytecodeProfile):
+        (WebKit::WebPageProxy::getSamplingProfilerOutput):
+        (WebKit::WebPageProxy::getContentsAsMHTMLData):
+        (WebKit::WebPageProxy::getSelectionOrContentsAsString):
+        (WebKit::WebPageProxy::getSelectionAsWebArchiveData):
+        (WebKit::WebPageProxy::getMainResourceDataOfFrame):
+        (WebKit::WebPageProxy::getResourceDataFromFrame):
+        (WebKit::WebPageProxy::getWebArchiveOfFrame):
+        (WebKit::WebPageProxy::forceRepaint):
+        (WebKit::WebPageProxy::clearLoadDependentCallbacks):
+        (WebKit::WebPageProxy::voidCallback):
+        (WebKit::WebPageProxy::dataCallback):
+        (WebKit::WebPageProxy::imageCallback):
+        (WebKit::WebPageProxy::stringCallback):
+        (WebKit::WebPageProxy::invalidateStringCallback):
+        (WebKit::WebPageProxy::scriptValueCallback):
+        (WebKit::WebPageProxy::computedPagesCallback):
+        (WebKit::WebPageProxy::validateCommandCallback):
+        (WebKit::WebPageProxy::unsignedCallback):
+        (WebKit::WebPageProxy::editingRangeCallback):
+        (WebKit::WebPageProxy::machSendRightCallback):
+        (WebKit::WebPageProxy::rectForCharacterRangeCallback):
+        (WebKit::WebPageProxy::printFinishedCallback):
+        (WebKit::WebPageProxy::computePagesForPrinting):
+        (WebKit::WebPageProxy::drawRectToImage):
+        (WebKit::WebPageProxy::drawPagesToPDF):
+        (WebKit::WebPageProxy::drawPagesForPrinting):
+        (WebKit::WebPageProxy::getMarkedRangeAsync):
+        (WebKit::WebPageProxy::getSelectedRangeAsync):
+        (WebKit::WebPageProxy::characterIndexForPointAsync):
+        (WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
+        (WebKit::WebPageProxy::takeSnapshot):
+        (WebKit::WebPageProxy::installActivityStateChangeCompletionHandler):
+        (WebKit::WebPageProxy::getLoadDecisionForIcon):
+        (WebKit::WebPageProxy::finishedLoadingIcon):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::gestureCallback):
+        (WebKit::WebPageProxy::touchesCallback):
+        (WebKit::WebPageProxy::autocorrectionDataCallback):
+        (WebKit::WebPageProxy::selectionContextCallback):
+        (WebKit::WebPageProxy::autocorrectionContextCallback):
+        (WebKit::WebPageProxy::selectionRectsCallback):
+        (WebKit::WebPageProxy::selectWithGesture):
+        (WebKit::WebPageProxy::updateSelectionWithTouches):
+        (WebKit::WebPageProxy::requestAutocorrectionData):
+        (WebKit::WebPageProxy::applyAutocorrection):
+        (WebKit::WebPageProxy::executeEditCommand):
+        (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
+        (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
+        (WebKit::WebPageProxy::moveSelectionAtBoundaryWithDirection):
+        (WebKit::WebPageProxy::selectPositionAtPoint):
+        (WebKit::WebPageProxy::beginSelectionInDirection):
+        (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
+        (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
+        (WebKit::WebPageProxy::requestDictationContext):
+        (WebKit::WebPageProxy::requestAutocorrectionContext):
+        (WebKit::WebPageProxy::getSelectionContext):
+        (WebKit::WebPageProxy::selectWithTwoTouches):
+        (WebKit::WebPageProxy::requestRectsForGranularityWithSelectionOffset):
+        (WebKit::WebPageProxy::requestRectsAtSelectionOffsetWithText):
+        (WebKit::WebPageProxy::moveSelectionByOffset):
+        (WebKit::WebPageProxy::focusNextAssistedNode):
+        (WebKit::WebPageProxy::computePagesForPrintingAndDrawToPDF):
+        (WebKit::WebPageProxy::drawToPDFCallback):
+        * UIProcess/mac/WKPrintingView.mm:
+        (-[WKPrintingView _preparePDFDataForPrintingOnSecondaryThread]):
+        (-[WKPrintingView _askPageToComputePageRects]):
+        (-[WKPrintingView _drawPreview:]):
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::attributedSubstringForCharacterRangeAsync):
+        (WebKit::WebPageProxy::attributedStringForCharacterRangeCallback):
+        (WebKit::WebPageProxy::fontAtSelection):
+        (WebKit::WebPageProxy::fontAtSelectionCallback):
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/Cookies/WebCookieManager.cpp:
+        (WebKit::WebCookieManager::getHostnamesWithCookies):
+        (WebKit::WebCookieManager::deleteCookie):
+        (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
+        (WebKit::WebCookieManager::getAllCookies):
+        (WebKit::WebCookieManager::getCookies):
+        (WebKit::WebCookieManager::setCookie):
+        (WebKit::WebCookieManager::setCookies):
+        (WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
+        (WebKit::WebCookieManager::getHTTPCookieAcceptPolicy):
+        * WebProcess/Cookies/WebCookieManager.h:
+        * WebProcess/Cookies/WebCookieManager.messages.in:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::getLoadDecisionForIcon):
+        (WebKit::WebFrameLoaderClient::finishedLoadingIcon):
+        * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
+        (WebKit::AcceleratedDrawingArea::forceRepaintAsync):
+        (WebKit::AcceleratedDrawingArea::activityStateDidChange):
+        * WebProcess/WebPage/AcceleratedDrawingArea.h:
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+        (WebKit::CoordinatedLayerTreeHost::forceRepaintAsync):
+        (WebKit::CoordinatedLayerTreeHost::renderNextFrame):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::forceRepaintAsync):
+        (WebKit::DrawingArea::activityStateDidChange):
+        (WebKit::DrawingArea::addTransactionCallbackID):
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        * WebProcess/WebPage/LayerTreeHost.h:
+        (WebKit::LayerTreeHost::forceRepaintAsync):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::reinitializeWebPage):
+        (WebKit::WebPage::takeSnapshot):
+        (WebKit::WebPage::validateCommand):
+        (WebKit::WebPage::setInitialFocus):
+        (WebKit::WebPage::setActivityState):
+        (WebKit::WebPage::runJavaScriptInMainFrame):
+        (WebKit::WebPage::getContentsAsString):
+        (WebKit::WebPage::getContentsAsMHTMLData):
+        (WebKit::WebPage::getRenderTreeExternalRepresentation):
+        (WebKit::WebPage::getSelectionAsWebArchiveData):
+        (WebKit::WebPage::getSelectionOrContentsAsString):
+        (WebKit::WebPage::getSourceForFrame):
+        (WebKit::WebPage::getMainResourceDataOfFrame):
+        (WebKit::WebPage::getResourceDataFromFrame):
+        (WebKit::WebPage::getWebArchiveOfFrame):
+        (WebKit::WebPage::forceRepaint):
+        (WebKit::WebPage::computePagesForPrinting):
+        (WebKit::WebPage::drawRectToImage):
+        (WebKit::WebPage::drawPagesToPDF):
+        (WebKit::WebPage::drawPagesForPrinting):
+        (WebKit::WebPage::didFinishPrintOperation):
+        (WebKit::WebPage::getMarkedRangeAsync):
+        (WebKit::WebPage::getSelectedRangeAsync):
+        (WebKit::WebPage::characterIndexForPointAsync):
+        (WebKit::WebPage::firstRectForCharacterRangeAsync):
+        (WebKit::WebPage::getBytecodeProfile):
+        (WebKit::WebPage::getSamplingProfilerOutput):
+        (WebKit::WebPage::didGetLoadDecisionForIcon):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
+        (WebKit::WebPrintOperationGtk::WebPrintOperationGtk):
+        * WebProcess/WebPage/gtk/WebPrintOperationGtk.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getSelectionContext):
+        (WebKit::WebPage::selectWithGesture):
+        (WebKit::WebPage::updateSelectionWithTouches):
+        (WebKit::WebPage::selectWithTwoTouches):
+        (WebKit::WebPage::moveSelectionByOffset):
+        (WebKit::WebPage::getRectsForGranularityWithSelectionOffset):
+        (WebKit::WebPage::getRectsAtSelectionOffsetWithText):
+        (WebKit::WebPage::selectPositionAtPoint):
+        (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
+        (WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
+        (WebKit::WebPage::selectTextWithGranularityAtPoint):
+        (WebKit::WebPage::beginSelectionInDirection):
+        (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
+        (WebKit::WebPage::updateSelectionWithExtentPoint):
+        (WebKit::WebPage::requestDictationContext):
+        (WebKit::WebPage::requestAutocorrectionData):
+        (WebKit::WebPage::applyAutocorrection):
+        (WebKit::WebPage::executeEditCommandWithCallback):
+        (WebKit::WebPage::requestAutocorrectionContext):
+        (WebKit::WebPage::focusNextAssistedNode):
+        (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
+        (WebKit::RemoteLayerTreeDrawingArea::addTransactionCallbackID):
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
+        (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
+        (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::attributedSubstringForCharacterRangeAsync):
+        (WebKit::WebPage::fontAtSelection):
+
 2017-06-29  Andy Estes  <aestes@apple.com>
 
         [iOS] Don't confuse coordinate spaces when computing the size of PDF snapshots
index 3d2de91..5a9a03b 100644 (file)
@@ -126,7 +126,7 @@ void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreati
         supplement<WebCookieManager>()->setCookiePersistentStorage(parameters.cookiePersistentStoragePath,
             parameters.cookiePersistentStorageType);
     }
-    supplement<WebCookieManager>()->setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy, 0);
+    supplement<WebCookieManager>()->setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy, OptionalCallbackID());
 
     if (!parameters.languages.isEmpty())
         userPreferredLanguagesChanged(parameters.languages);
diff --git a/Source/WebKit2/Shared/CallbackID.h b/Source/WebKit2/Shared/CallbackID.h
new file mode 100644 (file)
index 0000000..2a311d9
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/HashTraits.h>
+#include <wtf/RunLoop.h>
+
+namespace WTF {
+
+struct CallbackIDHash;
+
+}
+
+namespace WebKit {
+
+class CallbackID {
+public:
+    ALWAYS_INLINE explicit CallbackID()
+    { }
+
+    ALWAYS_INLINE CallbackID(const CallbackID& otherID)
+        : m_id(otherID.m_id)
+    {
+        ASSERT(HashTraits<uint64_t>::emptyValue() != m_id && !HashTraits<uint64_t>::isDeletedValue(m_id));
+    }
+
+    bool operator==(const CallbackID& other) const { return m_id == other.m_id; }
+
+    uint64_t toInteger() const { return m_id; }
+    ALWAYS_INLINE bool isValid() const { return isValidCallbackID(m_id); }
+    static ALWAYS_INLINE bool isValidCallbackID(uint64_t rawId)
+    {
+        return HashTraits<uint64_t>::emptyValue() != rawId && !HashTraits<uint64_t>::isDeletedValue(rawId);
+    }
+
+    static ALWAYS_INLINE CallbackID fromInteger(uint64_t rawId)
+    {
+        RELEASE_ASSERT(isValidCallbackID(rawId));
+        return CallbackID(rawId);
+    }
+
+    static CallbackID generateID()
+    {
+        ASSERT(RunLoop::isMain());
+        static uint64_t uniqueCallbackID = 1;
+        return CallbackID(uniqueCallbackID++);
+    }
+
+    template<class Encoder> void encode(Encoder& encoder) const
+    {
+        RELEASE_ASSERT(isValid());
+        encoder << m_id;
+    }
+
+    template<class Decoder> static bool decode(Decoder& decoder, CallbackID& callbackID)
+    {
+        auto result = decoder.decode(callbackID.m_id);
+        RELEASE_ASSERT(callbackID.isValid());
+        return result;
+    }
+
+private:
+    ALWAYS_INLINE explicit CallbackID(uint64_t newID)
+        : m_id(newID)
+    {
+        ASSERT(newID != HashTraits<uint64_t>::emptyValue());
+    }
+
+    friend class CallbackMap;
+    template <typename CallbackType> friend class SpecificCallbackMap;
+    friend class OptionalCallbackID;
+    friend struct WTF::CallbackIDHash;
+    friend struct HashTraits<WebKit::CallbackID>;
+
+    uint64_t m_id { HashTraits<uint64_t>::emptyValue() };
+};
+
+}
+
+namespace WTF {
+
+struct CallbackIDHash {
+    static unsigned hash(const WebKit::CallbackID& callbackID) { return intHash(callbackID.m_id); }
+    static bool equal(const WebKit::CallbackID& a, const WebKit::CallbackID& b) { return a.m_id == b.m_id; }
+    static const bool safeToCompareToEmptyOrDeleted = true;
+};
+template<> struct HashTraits<WebKit::CallbackID> : GenericHashTraits<WebKit::CallbackID> {
+    static WebKit::CallbackID emptyValue() { return WebKit::CallbackID(); }
+    static void constructDeletedValue(WebKit::CallbackID& slot) { slot = WebKit::CallbackID(std::numeric_limits<uint64_t>::max()); }
+    static bool isDeletedValue(const WebKit::CallbackID& slot) { return slot.m_id == std::numeric_limits<uint64_t>::max(); }
+};
+template<> struct DefaultHash<WebKit::CallbackID> {
+    typedef CallbackIDHash Hash;
+};
+
+}
diff --git a/Source/WebKit2/Shared/OptionalCallbackID.h b/Source/WebKit2/Shared/OptionalCallbackID.h
new file mode 100644 (file)
index 0000000..794e72e
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CallbackID.h"
+#include <wtf/HashTraits.h>
+#include <wtf/RunLoop.h>
+
+namespace WebKit {
+
+class OptionalCallbackID {
+public:
+    explicit OptionalCallbackID() { }
+
+    ALWAYS_INLINE explicit OptionalCallbackID(const CallbackID& otherID)
+        : m_id(otherID.m_id)
+    {
+    }
+
+    ALWAYS_INLINE OptionalCallbackID(const OptionalCallbackID& otherID)
+        : m_id(otherID.m_id)
+    {
+        ASSERT(!HashTraits<uint64_t>::isDeletedValue(m_id));
+    }
+
+    uint64_t toInteger() { return m_id; }
+    CallbackID callbackID()
+    {
+        RELEASE_ASSERT(CallbackID::isValidCallbackID(m_id));
+        return CallbackID(m_id);
+    }
+
+    operator bool() { return m_id; }
+
+    ALWAYS_INLINE bool isValid() const { return isValidCallbackID(m_id); }
+    static ALWAYS_INLINE bool isValidCallbackID(uint64_t rawId)
+    {
+        return !HashTraits<uint64_t>::isDeletedValue(rawId);
+    }
+
+    template<class Encoder> void encode(Encoder& encoder) const
+    {
+        RELEASE_ASSERT(isValid());
+        encoder << m_id;
+    }
+
+    template<class Decoder> static bool decode(Decoder& decoder, OptionalCallbackID& callbackID)
+    {
+        auto result = decoder.decode(callbackID.m_id);
+        RELEASE_ASSERT(callbackID.isValid());
+        return result;
+    }
+
+private:
+    uint64_t m_id { HashTraits<uint64_t>::emptyValue() };
+};
+
+}
index 0aa4fb1..2a45fa2 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef RemoteLayerTreeTransaction_h
 #define RemoteLayerTreeTransaction_h
 
+#include "GenericCallback.h"
 #include "PlatformCAAnimationRemote.h"
 #include "RemoteLayerBackingStore.h"
 #include <WebCore/Color.h>
@@ -261,7 +262,7 @@ public:
     uint64_t transactionID() const { return m_transactionID; }
     void setTransactionID(uint64_t transactionID) { m_transactionID = transactionID; }
 
-    typedef uint64_t TransactionCallbackID;
+    typedef CallbackID TransactionCallbackID;
     const Vector<TransactionCallbackID>& callbackIDs() const { return m_callbackIDs; }
     void setCallbackIDs(Vector<TransactionCallbackID>&& callbackIDs) { m_callbackIDs = WTFMove(callbackIDs); }
 
index f610817..ebb6d92 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "APIError.h"
 #include "APISerializedScriptValue.h"
+#include "CallbackID.h"
 #include "ProcessThrottler.h"
 #include "ShareableBitmap.h"
 #include "WKAPICast.h"
@@ -34,7 +35,6 @@
 #include <wtf/HashMap.h>
 #include <wtf/MainThread.h>
 #include <wtf/RefCounted.h>
-#include <wtf/RunLoop.h>
 #include <wtf/Threading.h>
 
 namespace WebKit {
@@ -52,7 +52,7 @@ public:
     {
     }
 
-    uint64_t callbackID() const { return m_callbackID; }
+    CallbackID callbackID() const { return m_callbackID; }
 
     template<class T>
     T* as()
@@ -71,21 +71,14 @@ protected:
 
     explicit CallbackBase(Type type, const ProcessThrottler::BackgroundActivityToken& activityToken)
         : m_type(type)
-        , m_callbackID(generateCallbackID())
+        , m_callbackID(CallbackID::generateID())
         , m_activityToken(activityToken)
     {
     }
 
 private:
-    static uint64_t generateCallbackID()
-    {
-        ASSERT(RunLoop::isMain());
-        static uint64_t uniqueCallbackID = 1;
-        return uniqueCallbackID++;
-    }
-
     Type m_type;
-    uint64_t m_callbackID;
+    CallbackID m_callbackID;
     ProcessThrottler::BackgroundActivityToken m_activityToken;
 };
 
@@ -180,13 +173,13 @@ void invalidateCallbackMap(HashMap<uint64_t, T>& callbackMap, CallbackBase::Erro
 
 class CallbackMap {
 public:
-    uint64_t put(Ref<CallbackBase>&& callback)
+    CallbackID put(Ref<CallbackBase>&& callback)
     {
         RELEASE_ASSERT(RunLoop::isMain());
-        uint64_t callbackID = callback->callbackID();
-        RELEASE_ASSERT(callbackID);
-        RELEASE_ASSERT(!m_map.contains(callbackID));
-        m_map.set(callbackID, WTFMove(callback));
+        auto callbackID = callback->callbackID();
+        RELEASE_ASSERT(callbackID.isValid());
+        RELEASE_ASSERT(!m_map.contains(callbackID.m_id));
+        m_map.set(callbackID.m_id, WTFMove(callback));
         return callbackID;
     }
 
@@ -201,18 +194,26 @@ public:
     };
 
     template<typename... T>
-    uint64_t put(Function<void(T...)>&& function, const ProcessThrottler::BackgroundActivityToken& activityToken)
+    CallbackID put(Function<void(T...)>&& function, const ProcessThrottler::BackgroundActivityToken& activityToken)
     {
         auto callback = GenericCallbackType<sizeof...(T), T...>::type::create(WTFMove(function), activityToken);
         return put(WTFMove(callback));
     }
 
+    // FIXME: <webkit.org/b/174007> WebCookieManagerProxy should pass in BackgroundActivityToken
+    template<typename... T>
+    CallbackID put(Function<void(T...)>&& function)
+    {
+        auto callback = GenericCallbackType<sizeof...(T), T...>::type::create(WTFMove(function));
+        return put(WTFMove(callback));
+    }
+
     template<class T>
-    RefPtr<T> take(uint64_t callbackID)
+    RefPtr<T> take(CallbackID callbackID)
     {
-        RELEASE_ASSERT(callbackID);
+        RELEASE_ASSERT(callbackID.isValid());
         RELEASE_ASSERT(RunLoop::isMain());
-        auto base = m_map.take(callbackID);
+        auto base = m_map.take(callbackID.m_id);
         if (!base)
             return nullptr;
 
index 55790e2..3f67896 100644 (file)
@@ -29,6 +29,7 @@
 #include "APIArray.h"
 #include "APISecurityOrigin.h"
 #include "NetworkProcessMessages.h"
+#include "OptionalCallbackID.h"
 #include "WebCookieManagerMessages.h"
 #include "WebCookieManagerProxyMessages.h"
 #include "WebProcessPool.h"
@@ -72,10 +73,7 @@ void WebCookieManagerProxy::initializeClient(const WKCookieManagerClientBase* cl
 
 void WebCookieManagerProxy::processPoolDestroyed()
 {
-    invalidateCallbackMap(m_arrayCallbacks, CallbackBase::Error::OwnerWasInvalidated);
-    invalidateCallbackMap(m_httpCookieAcceptPolicyCallbacks, CallbackBase::Error::OwnerWasInvalidated);
-    invalidateCallbackMap(m_voidCallbacks, CallbackBase::Error::OwnerWasInvalidated);
-    invalidateCallbackMap(m_getCookiesCallbacks, CallbackBase::Error::OwnerWasInvalidated);
+    m_callbacks.invalidate(CallbackBase::Error::OwnerWasInvalidated);
 
     Vector<Observer*> observers;
     for (auto& observerSet : m_cookieObservers.values()) {
@@ -91,18 +89,12 @@ void WebCookieManagerProxy::processPoolDestroyed()
 
 void WebCookieManagerProxy::processDidClose(WebProcessProxy*)
 {
-    invalidateCallbackMap(m_arrayCallbacks, CallbackBase::Error::ProcessExited);
-    invalidateCallbackMap(m_httpCookieAcceptPolicyCallbacks, CallbackBase::Error::ProcessExited);
-    invalidateCallbackMap(m_voidCallbacks, CallbackBase::Error::ProcessExited);
-    invalidateCallbackMap(m_getCookiesCallbacks, CallbackBase::Error::ProcessExited);
+    m_callbacks.invalidate(CallbackBase::Error::ProcessExited);
 }
 
 void WebCookieManagerProxy::processDidClose(NetworkProcessProxy*)
 {
-    invalidateCallbackMap(m_arrayCallbacks, CallbackBase::Error::ProcessExited);
-    invalidateCallbackMap(m_httpCookieAcceptPolicyCallbacks, CallbackBase::Error::ProcessExited);
-    invalidateCallbackMap(m_voidCallbacks, CallbackBase::Error::ProcessExited);
-    invalidateCallbackMap(m_getCookiesCallbacks, CallbackBase::Error::ProcessExited);
+    m_callbacks.invalidate(CallbackBase::Error::ProcessExited);
 }
 
 void WebCookieManagerProxy::refWebContextSupplement()
@@ -117,16 +109,13 @@ void WebCookieManagerProxy::derefWebContextSupplement()
 
 void WebCookieManagerProxy::getHostnamesWithCookies(SessionID sessionID, Function<void (API::Array*, CallbackBase::Error)>&& callbackFunction)
 {
-    auto callback = ArrayCallback::create(WTFMove(callbackFunction));
-    uint64_t callbackID = callback->callbackID();
-    m_arrayCallbacks.set(callbackID, WTFMove(callback));
-
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::GetHostnamesWithCookies(sessionID, callbackID));
 }
 
-void WebCookieManagerProxy::didGetHostnamesWithCookies(const Vector<String>& hostnames, uint64_t callbackID)
+void WebCookieManagerProxy::didGetHostnamesWithCookies(const Vector<String>& hostnames, WebKit::CallbackID callbackID)
 {
-    RefPtr<ArrayCallback> callback = m_arrayCallbacks.take(callbackID);
+    auto callback = m_callbacks.take<ArrayCallback>(callbackID);
     if (!callback) {
         // FIXME: Log error or assert.
         return;
@@ -147,71 +136,53 @@ void WebCookieManagerProxy::deleteAllCookies(SessionID sessionID)
 
 void WebCookieManagerProxy::deleteCookie(SessionID sessionID, const Cookie& cookie, Function<void (CallbackBase::Error)>&& callbackFunction)
 {
-    auto callback = VoidCallback::create(WTFMove(callbackFunction));
-    uint64_t callbackID = callback->callbackID();
-    m_voidCallbacks.set(callbackID, WTFMove(callback));
-
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteCookie(sessionID, cookie, callbackID));
 }
 
 void WebCookieManagerProxy::deleteAllCookiesModifiedSince(SessionID sessionID, std::chrono::system_clock::time_point time, Function<void (CallbackBase::Error)>&& callbackFunction)
 {
-    auto callback = VoidCallback::create(WTFMove(callbackFunction));
-    uint64_t callbackID = callback->callbackID();
-    m_voidCallbacks.set(callbackID, WTFMove(callback));
-
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteAllCookiesModifiedSince(sessionID, time, callbackID));
 }
 
 void WebCookieManagerProxy::setCookie(SessionID sessionID, const Cookie& cookie, Function<void (CallbackBase::Error)>&& callbackFunction)
 {
-    auto callback = VoidCallback::create(WTFMove(callbackFunction));
-    uint64_t callbackID = callback->callbackID();
-    m_voidCallbacks.set(callbackID, WTFMove(callback));
-
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::SetCookie(sessionID, cookie, callbackID));
 }
 
 void WebCookieManagerProxy::setCookies(SessionID sessionID, const Vector<Cookie>& cookies, const URL& url, const URL& mainDocumentURL, Function<void (CallbackBase::Error)>&& callbackFunction)
 {
-    auto callback = VoidCallback::create(WTFMove(callbackFunction));
-    uint64_t callbackID = callback->callbackID();
-    m_voidCallbacks.set(callbackID, WTFMove(callback));
-
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::SetCookies(sessionID, cookies, url, mainDocumentURL, callbackID));
 }
 
 void WebCookieManagerProxy::getAllCookies(SessionID sessionID, Function<void (const Vector<Cookie>&, CallbackBase::Error)>&& callbackFunction)
 {
-    auto callback = GetCookiesCallback::create(WTFMove(callbackFunction));
-    uint64_t callbackID = callback->callbackID();
-    m_getCookiesCallbacks.set(callbackID, WTFMove(callback));
-
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::GetAllCookies(sessionID, callbackID));
 }
 
 void WebCookieManagerProxy::getCookies(SessionID sessionID, const URL& url, Function<void (const Vector<Cookie>&, CallbackBase::Error)>&& callbackFunction)
 {
-    auto callback = GetCookiesCallback::create(WTFMove(callbackFunction));
-    uint64_t callbackID = callback->callbackID();
-    m_getCookiesCallbacks.set(callbackID, WTFMove(callback));
-
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::GetCookies(sessionID, url, callbackID));
 }
 
-void WebCookieManagerProxy::didSetCookies(uint64_t callbackID)
+void WebCookieManagerProxy::didSetCookies(WebKit::CallbackID callbackID)
 {
-    m_voidCallbacks.take(callbackID)->performCallback();
+    m_callbacks.take<VoidCallback>(callbackID)->performCallback();
 }
 
-void WebCookieManagerProxy::didGetCookies(const Vector<Cookie>& cookies, uint64_t callbackID)
+void WebCookieManagerProxy::didGetCookies(const Vector<Cookie>& cookies, WebKit::CallbackID callbackID)
 {
-    m_getCookiesCallbacks.take(callbackID)->performCallbackWithReturnValue(cookies);
+    m_callbacks.take<GetCookiesCallback>(callbackID)->performCallbackWithReturnValue(cookies);
 }
 
-void WebCookieManagerProxy::didDeleteCookies(uint64_t callbackID)
+void WebCookieManagerProxy::didDeleteCookies(WebKit::CallbackID callbackID)
 {
-    m_voidCallbacks.take(callbackID)->performCallback();
+    m_callbacks.take<VoidCallback>(callbackID)->performCallback();
 }
 
 void WebCookieManagerProxy::startObservingCookieChanges(SessionID sessionID)
@@ -284,33 +255,26 @@ void WebCookieManagerProxy::setHTTPCookieAcceptPolicy(SessionID, HTTPCookieAccep
     // The policy is not sent to newly created processes (only Soup does that via setInitialHTTPCookieAcceptPolicy()). This is not a serious problem, because:
     // - When testing, we only have one WebProcess and one NetworkProcess, and WebKitTestRunner never restarts them;
     // - When not testing, Cocoa has the policy persisted, and thus new processes use it (even for ephemeral sessions).
-    processPool()->sendToAllProcesses(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy, 0));
-
-    auto callback = VoidCallback::create(WTFMove(callbackFunction));
-    uint64_t callbackID = callback->callbackID();
-    m_voidCallbacks.set(callbackID, WTFMove(callback));
+    processPool()->sendToAllProcesses(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy, OptionalCallbackID()));
 
-    processPool()->sendToNetworkingProcess(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy, callbackID));
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
+    processPool()->sendToNetworkingProcess(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy, OptionalCallbackID(callbackID)));
 }
 
 void WebCookieManagerProxy::getHTTPCookieAcceptPolicy(SessionID, Function<void (HTTPCookieAcceptPolicy, CallbackBase::Error)>&& callbackFunction)
 {
-    auto callback = HTTPCookieAcceptPolicyCallback::create(WTFMove(callbackFunction));
-
-    uint64_t callbackID = callback->callbackID();
-    m_httpCookieAcceptPolicyCallbacks.set(callbackID, WTFMove(callback));
-
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction));
     processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::GetHTTPCookieAcceptPolicy(callbackID));
 }
 
-void WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID)
+void WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::CallbackID callbackID)
 {
-    m_httpCookieAcceptPolicyCallbacks.take(callbackID)->performCallbackWithReturnValue(policy);
+    m_callbacks.take<HTTPCookieAcceptPolicyCallback>(callbackID)->performCallbackWithReturnValue(policy);
 }
 
-void WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy(uint64_t callbackID)
+void WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy(WebKit::CallbackID callbackID)
 {
-    m_voidCallbacks.take(callbackID)->performCallback();
+    m_callbacks.take<VoidCallback>(callbackID)->performCallback();
 }
 
 void WebCookieManagerProxy::setCookieStoragePartitioningEnabled(bool enabled)
index 82af770..37f2637 100644 (file)
@@ -107,13 +107,13 @@ public:
 private:
     WebCookieManagerProxy(WebProcessPool*);
 
-    void didGetHostnamesWithCookies(const Vector<String>&, uint64_t callbackID);
-    void didGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID);
+    void didGetHostnamesWithCookies(const Vector<String>&, WebKit::CallbackID);
+    void didGetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::CallbackID);
 
-    void didSetHTTPCookieAcceptPolicy(uint64_t callbackID);
-    void didSetCookies(uint64_t callbackID);
-    void didGetCookies(const Vector<WebCore::Cookie>&, uint64_t callbackID);
-    void didDeleteCookies(uint64_t callbackID);
+    void didSetHTTPCookieAcceptPolicy(WebKit::CallbackID);
+    void didSetCookies(WebKit::CallbackID);
+    void didGetCookies(const Vector<WebCore::Cookie>&, WebKit::CallbackID);
+    void didDeleteCookies(WebKit::CallbackID);
 
     void cookiesDidChange(WebCore::SessionID);
 
@@ -131,10 +131,7 @@ private:
     void persistHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
 #endif
 
-    HashMap<uint64_t, RefPtr<ArrayCallback>> m_arrayCallbacks;
-    HashMap<uint64_t, RefPtr<HTTPCookieAcceptPolicyCallback>> m_httpCookieAcceptPolicyCallbacks;
-    HashMap<uint64_t, RefPtr<VoidCallback>> m_voidCallbacks;
-    HashMap<uint64_t, RefPtr<GetCookiesCallback>> m_getCookiesCallbacks;
+    CallbackMap m_callbacks;
 
     HashMap<WebCore::SessionID, WTF::Function<void ()>> m_legacyCookieObservers;
     HashMap<WebCore::SessionID, HashSet<Observer*>> m_cookieObservers;
index dccbcf2..a5d77b9 100644 (file)
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 messages -> WebCookieManagerProxy {
-    DidGetHostnamesWithCookies(Vector<String> hostnames, uint64_t callbackID);
-    DidGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID);
+    DidGetHostnamesWithCookies(Vector<String> hostnames, WebKit::CallbackID callbackID);
+    DidGetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::CallbackID callbackID);
 
-    DidSetHTTPCookieAcceptPolicy(uint64_t callbackID);
-    DidDeleteCookies(uint64_t callbackID);
-    DidSetCookies(uint64_t callbackID);
-    DidGetCookies(Vector<WebCore::Cookie> cookies, uint64_t callbackID);
+    DidSetHTTPCookieAcceptPolicy(WebKit::CallbackID callbackID);
+    DidDeleteCookies(WebKit::CallbackID callbackID);
+    DidSetCookies(WebKit::CallbackID callbackID);
+    DidGetCookies(Vector<WebCore::Cookie> cookies, WebKit::CallbackID callbackID);
 
     CookiesDidChange(WebCore::SessionID sessionID)
 }
index 8491f24..b86df18 100644 (file)
@@ -67,6 +67,7 @@
 #include "NetworkProcessMessages.h"
 #include "NotificationPermissionRequest.h"
 #include "NotificationPermissionRequestManager.h"
+#include "OptionalCallbackID.h"
 #include "PageClient.h"
 #include "PluginInformation.h"
 #include "PluginProcessManager.h"
@@ -1607,7 +1608,7 @@ void WebPageProxy::setInitialFocus(bool forward, bool isKeyboardEventValid, cons
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent, callbackID), m_pageID);
 }
 
@@ -1632,7 +1633,7 @@ void WebPageProxy::validateCommand(const String& commandName, WTF::Function<void
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
 }
 
@@ -2838,7 +2839,7 @@ void WebPageProxy::runJavaScriptInMainFrame(const String& script, WTF::Function<
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::RunJavaScriptInMainFrame(script, callbackID), m_pageID);
 }
 
@@ -2849,7 +2850,7 @@ void WebPageProxy::getRenderTreeExternalRepresentation(WTF::Function<void (const
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetRenderTreeExternalRepresentation(callbackID), m_pageID);
 }
 
@@ -2860,7 +2861,7 @@ void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, WTF::Function<void (c
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_loadDependentStringCallbackIDs.add(callbackID);
     m_process->send(Messages::WebPage::GetSourceForFrame(frame->frameID(), callbackID), m_pageID);
 }
@@ -2872,7 +2873,7 @@ void WebPageProxy::getContentsAsString(WTF::Function<void (const String&, Callba
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_loadDependentStringCallbackIDs.add(callbackID);
     m_process->send(Messages::WebPage::GetContentsAsString(callbackID), m_pageID);
 }
@@ -2884,7 +2885,7 @@ void WebPageProxy::getBytecodeProfile(WTF::Function<void (const String&, Callbac
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_loadDependentStringCallbackIDs.add(callbackID);
     m_process->send(Messages::WebPage::GetBytecodeProfile(callbackID), m_pageID);
 }
@@ -2896,7 +2897,7 @@ void WebPageProxy::getSamplingProfilerOutput(WTF::Function<void (const String&,
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_loadDependentStringCallbackIDs.add(callbackID);
     m_process->send(Messages::WebPage::GetSamplingProfilerOutput(callbackID), m_pageID);
 }
@@ -2922,7 +2923,7 @@ void WebPageProxy::getContentsAsMHTMLData(Function<void (API::Data*, CallbackBas
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetContentsAsMHTMLData(callbackID), m_pageID);
 }
 #endif
@@ -2934,7 +2935,7 @@ void WebPageProxy::getSelectionOrContentsAsString(WTF::Function<void (const Stri
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetSelectionOrContentsAsString(callbackID), m_pageID);
 }
 
@@ -2945,7 +2946,7 @@ void WebPageProxy::getSelectionAsWebArchiveData(Function<void (API::Data*, Callb
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetSelectionAsWebArchiveData(callbackID), m_pageID);
 }
 
@@ -2956,7 +2957,7 @@ void WebPageProxy::getMainResourceDataOfFrame(WebFrameProxy* frame, Function<voi
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetMainResourceDataOfFrame(frame->frameID(), callbackID), m_pageID);
 }
 
@@ -2967,7 +2968,7 @@ void WebPageProxy::getResourceDataFromFrame(WebFrameProxy* frame, API::URL* reso
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetResourceDataFromFrame(frame->frameID(), resourceURL->string(), callbackID), m_pageID);
 }
 
@@ -2978,7 +2979,7 @@ void WebPageProxy::getWebArchiveOfFrame(WebFrameProxy* frame, Function<void (API
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetWebArchiveOfFrame(frame->frameID(), callbackID), m_pageID);
 }
 
@@ -3011,7 +3012,7 @@ void WebPageProxy::forceRepaint(RefPtr<VoidCallback>&& callback)
         });
     };
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(didForceRepaintCallback), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(didForceRepaintCallback), m_process->throttler().backgroundActivityToken());
     m_drawingArea->waitForBackingStoreUpdateOnNextPaint();
     m_process->send(Messages::WebPage::ForceRepaint(callbackID), m_pageID); 
 }
@@ -3247,7 +3248,7 @@ void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const Securi
 
 void WebPageProxy::clearLoadDependentCallbacks()
 {
-    HashSet<uint64_t> loadDependentStringCallbackIDs = WTFMove(m_loadDependentStringCallbackIDs);
+    HashSet<CallbackID> loadDependentStringCallbackIDs = WTFMove(m_loadDependentStringCallbackIDs);
     for (auto& callbackID : loadDependentStringCallbackIDs) {
         if (auto callback = m_callbacks.take<StringCallback>(callbackID))
             callback->invalidate();
@@ -5004,7 +5005,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
     }
 }
 
-void WebPageProxy::voidCallback(uint64_t callbackID)
+void WebPageProxy::voidCallback(CallbackID callbackID)
 {
     auto callback = m_callbacks.take<VoidCallback>(callbackID);
     if (!callback) {
@@ -5015,7 +5016,7 @@ void WebPageProxy::voidCallback(uint64_t callbackID)
     callback->performCallback();
 }
 
-void WebPageProxy::dataCallback(const IPC::DataReference& dataReference, uint64_t callbackID)
+void WebPageProxy::dataCallback(const IPC::DataReference& dataReference, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<DataCallback>(callbackID);
     if (!callback) {
@@ -5026,7 +5027,7 @@ void WebPageProxy::dataCallback(const IPC::DataReference& dataReference, uint64_
     callback->performCallbackWithReturnValue(API::Data::create(dataReference.data(), dataReference.size()).ptr());
 }
 
-void WebPageProxy::imageCallback(const ShareableBitmap::Handle& bitmapHandle, uint64_t callbackID)
+void WebPageProxy::imageCallback(const ShareableBitmap::Handle& bitmapHandle, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<ImageCallback>(callbackID);
     if (!callback) {
@@ -5037,7 +5038,7 @@ void WebPageProxy::imageCallback(const ShareableBitmap::Handle& bitmapHandle, ui
     callback->performCallbackWithReturnValue(bitmapHandle);
 }
 
-void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackID)
+void WebPageProxy::stringCallback(const String& resultString, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<StringCallback>(callbackID);
     if (!callback) {
@@ -5051,7 +5052,7 @@ void WebPageProxy::stringCallback(const String& resultString, uint64_t callbackI
     callback->performCallbackWithReturnValue(resultString.impl());
 }
 
-void WebPageProxy::invalidateStringCallback(uint64_t callbackID)
+void WebPageProxy::invalidateStringCallback(CallbackID callbackID)
 {
     auto callback = m_callbacks.take<StringCallback>(callbackID);
     if (!callback) {
@@ -5065,7 +5066,7 @@ void WebPageProxy::invalidateStringCallback(uint64_t callbackID)
     callback->invalidate();
 }
 
-void WebPageProxy::scriptValueCallback(const IPC::DataReference& dataReference, bool hadException, const ExceptionDetails& details, uint64_t callbackID)
+void WebPageProxy::scriptValueCallback(const IPC::DataReference& dataReference, bool hadException, const ExceptionDetails& details, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<ScriptValueCallback>(callbackID);
     if (!callback) {
@@ -5085,7 +5086,7 @@ void WebPageProxy::scriptValueCallback(const IPC::DataReference& dataReference,
     callback->performCallbackWithReturnValue(API::SerializedScriptValue::adopt(WTFMove(data)).ptr(), hadException, details);
 }
 
-void WebPageProxy::computedPagesCallback(const Vector<IntRect>& pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
+void WebPageProxy::computedPagesCallback(const Vector<IntRect>& pageRects, double totalScaleFactorForPrinting, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<ComputedPagesCallback>(callbackID);
     if (!callback) {
@@ -5096,7 +5097,7 @@ void WebPageProxy::computedPagesCallback(const Vector<IntRect>& pageRects, doubl
     callback->performCallbackWithReturnValue(pageRects, totalScaleFactorForPrinting);
 }
 
-void WebPageProxy::validateCommandCallback(const String& commandName, bool isEnabled, int state, uint64_t callbackID)
+void WebPageProxy::validateCommandCallback(const String& commandName, bool isEnabled, int state, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<ValidateCommandCallback>(callbackID);
     if (!callback) {
@@ -5107,7 +5108,7 @@ void WebPageProxy::validateCommandCallback(const String& commandName, bool isEna
     callback->performCallbackWithReturnValue(commandName.impl(), isEnabled, state);
 }
 
-void WebPageProxy::unsignedCallback(uint64_t result, uint64_t callbackID)
+void WebPageProxy::unsignedCallback(uint64_t result, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<UnsignedCallback>(callbackID);
     if (!callback) {
@@ -5119,7 +5120,7 @@ void WebPageProxy::unsignedCallback(uint64_t result, uint64_t callbackID)
     callback->performCallbackWithReturnValue(result);
 }
 
-void WebPageProxy::editingRangeCallback(const EditingRange& range, uint64_t callbackID)
+void WebPageProxy::editingRangeCallback(const EditingRange& range, CallbackID callbackID)
 {
     MESSAGE_CHECK(range.isValid());
 
@@ -5134,7 +5135,7 @@ void WebPageProxy::editingRangeCallback(const EditingRange& range, uint64_t call
 }
 
 #if PLATFORM(COCOA)
-void WebPageProxy::machSendRightCallback(const MachSendRight& sendRight, uint64_t callbackID)
+void WebPageProxy::machSendRightCallback(const MachSendRight& sendRight, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<MachSendRightCallback>(callbackID);
     if (!callback)
@@ -5196,7 +5197,7 @@ void WebPageProxy::logScrollingEvent(uint32_t eventType, MonotonicTime timestamp
     }
 }
 
-void WebPageProxy::rectForCharacterRangeCallback(const IntRect& rect, const EditingRange& actualRange, uint64_t callbackID)
+void WebPageProxy::rectForCharacterRangeCallback(const IntRect& rect, const EditingRange& actualRange, CallbackID callbackID)
 {
     MESSAGE_CHECK(actualRange.isValid());
 
@@ -5211,7 +5212,7 @@ void WebPageProxy::rectForCharacterRangeCallback(const IntRect& rect, const Edit
 }
 
 #if PLATFORM(GTK)
-void WebPageProxy::printFinishedCallback(const ResourceError& printError, uint64_t callbackID)
+void WebPageProxy::printFinishedCallback(const ResourceError& printError, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<PrintFinishedCallback>(callbackID);
     if (!callback) {
@@ -5965,7 +5966,7 @@ void WebPageProxy::computePagesForPrinting(WebFrameProxy* frame, const PrintInfo
         return;
     }
 
-    uint64_t callbackID = callback->callbackID();
+    auto callbackID = callback->callbackID();
     m_callbacks.put(WTFMove(callback));
     m_isInPrintingMode = true;
     m_process->send(Messages::WebPage::ComputePagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, printingSendOptions(m_isPerformingDOMPrintOperation));
@@ -5979,7 +5980,7 @@ void WebPageProxy::drawRectToImage(WebFrameProxy* frame, const PrintInfo& printI
         return;
     }
     
-    uint64_t callbackID = callback->callbackID();
+    auto callbackID = callback->callbackID();
     m_callbacks.put(WTFMove(callback));
     m_process->send(Messages::WebPage::DrawRectToImage(frame->frameID(), printInfo, rect, imageSize, callbackID), m_pageID, printingSendOptions(m_isPerformingDOMPrintOperation));
 }
@@ -5991,7 +5992,7 @@ void WebPageProxy::drawPagesToPDF(WebFrameProxy* frame, const PrintInfo& printIn
         return;
     }
     
-    uint64_t callbackID = callback->callbackID();
+    auto callbackID = callback->callbackID();
     m_callbacks.put(WTFMove(callback));
     m_process->send(Messages::WebPage::DrawPagesToPDF(frame->frameID(), printInfo, first, count, callbackID), m_pageID, printingSendOptions(m_isPerformingDOMPrintOperation));
 }
@@ -6003,7 +6004,7 @@ void WebPageProxy::drawPagesForPrinting(WebFrameProxy* frame, const PrintInfo& p
         return;
     }
 
-    uint64_t callbackID = callback->callbackID();
+    auto callbackID = callback->callbackID();
     m_callbacks.put(WTFMove(callback));
     m_isInPrintingMode = true;
     m_process->send(Messages::WebPage::DrawPagesForPrinting(frame->frameID(), printInfo, callbackID), m_pageID, printingSendOptions(m_isPerformingDOMPrintOperation));
@@ -6300,7 +6301,7 @@ void WebPageProxy::getMarkedRangeAsync(WTF::Function<void (EditingRange, Callbac
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     process().send(Messages::WebPage::GetMarkedRangeAsync(callbackID), m_pageID);
 }
 
@@ -6311,7 +6312,7 @@ void WebPageProxy::getSelectedRangeAsync(WTF::Function<void (EditingRange, Callb
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     process().send(Messages::WebPage::GetSelectedRangeAsync(callbackID), m_pageID);
 }
 
@@ -6322,7 +6323,7 @@ void WebPageProxy::characterIndexForPointAsync(const WebCore::IntPoint& point, W
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     process().send(Messages::WebPage::CharacterIndexForPointAsync(point, callbackID), m_pageID);
 }
 
@@ -6333,7 +6334,7 @@ void WebPageProxy::firstRectForCharacterRangeAsync(const EditingRange& range, WT
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     process().send(Messages::WebPage::FirstRectForCharacterRangeAsync(range, callbackID), m_pageID);
 }
 
@@ -6377,7 +6378,7 @@ void WebPageProxy::takeSnapshot(IntRect rect, IntSize bitmapSize, SnapshotOption
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::TakeSnapshot(rect, bitmapSize, options, callbackID), m_pageID);
 }
 
@@ -6600,7 +6601,7 @@ void WebPageProxy::installActivityStateChangeCompletionHandler(WTF::Function<voi
     auto voidCallback = VoidCallback::create([completionHandler = WTFMove(completionHandler)] (CallbackBase::Error) {
         completionHandler();
     }, m_process->throttler().backgroundActivityToken());
-    uint64_t callbackID = m_callbacks.put(WTFMove(voidCallback));
+    auto callbackID = m_callbacks.put(WTFMove(voidCallback));
     m_nextActivityStateChangeCallbacks.append(callbackID);
 }
 
@@ -6750,7 +6751,7 @@ void WebPageProxy::didRestoreScrollPosition()
     m_pageClient.didRestoreScrollPosition();
 }
 
-void WebPageProxy::getLoadDecisionForIcon(const WebCore::LinkIcon& icon, uint64_t loadIdentifier)
+void WebPageProxy::getLoadDecisionForIcon(const WebCore::LinkIcon& icon, CallbackID loadIdentifier)
 {
     m_iconLoadingClient->getLoadDecisionForIcon(icon, [this, protectedThis = RefPtr<WebPageProxy>(this), loadIdentifier](WTF::Function<void (API::Data*, CallbackBase::Error)>&& callbackFunction) {
         if (!isValid()) {
@@ -6760,15 +6761,15 @@ void WebPageProxy::getLoadDecisionForIcon(const WebCore::LinkIcon& icon, uint64_
         }
 
         bool decision = (bool)callbackFunction;
-        uint64_t newCallbackIdentifier = decision ? m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken()) : 0;
+        auto newCallbackIdentifier = decision ? OptionalCallbackID(m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken())) : OptionalCallbackID();
 
         m_process->send(Messages::WebPage::DidGetLoadDecisionForIcon(decision, loadIdentifier, newCallbackIdentifier), m_pageID);
     });
 }
 
-void WebPageProxy::finishedLoadingIcon(uint64_t callbackIdentifier, const IPC::DataReference& data)
+void WebPageProxy::finishedLoadingIcon(CallbackID callbackID, const IPC::DataReference& data)
 {
-    dataCallback(data, callbackIdentifier);
+    dataCallback(data, callbackID);
 }
 
 void WebPageProxy::setResourceCachingDisabled(bool disabled)
index fabd6a5..3fb24c4 100644 (file)
@@ -936,7 +936,7 @@ public:
     void drawPagesToPDF(WebFrameProxy*, const PrintInfo&, uint32_t first, uint32_t count, Ref<DataCallback>&&);
 #if PLATFORM(IOS)
     uint32_t computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo&, DrawToPDFCallback::CallbackFunction&&);
-    void drawToPDFCallback(const IPC::DataReference& pdfData, uint64_t callbackID);
+    void drawToPDFCallback(const IPC::DataReference& pdfData, WebKit::CallbackID);
 #endif
 #elif PLATFORM(GTK)
     void drawPagesForPrinting(WebFrameProxy*, const PrintInfo&, Ref<PrintFinishedCallback>&&);
@@ -1159,8 +1159,8 @@ public:
 
     void didRestoreScrollPosition();
 
-    void getLoadDecisionForIcon(const WebCore::LinkIcon&, uint64_t callbackID);
-    void finishedLoadingIcon(uint64_t callbackIdentifier, const IPC::DataReference&);
+    void getLoadDecisionForIcon(const WebCore::LinkIcon&, WebKit::CallbackID);
+    void finishedLoadingIcon(WebKit::CallbackID, const IPC::DataReference&);
 
     void setFocus(bool focused);
     void setWindowFrame(const WebCore::FloatRect&);
@@ -1449,36 +1449,36 @@ private:
 
     void didReceiveEvent(uint32_t opaqueType, bool handled);
 
-    void voidCallback(uint64_t);
-    void dataCallback(const IPC::DataReference&, uint64_t);
-    void imageCallback(const ShareableBitmap::Handle&, uint64_t);
-    void stringCallback(const String&, uint64_t);
-    void invalidateStringCallback(uint64_t);
-    void scriptValueCallback(const IPC::DataReference&, bool hadException, const WebCore::ExceptionDetails&, uint64_t);
-    void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, uint64_t);
-    void validateCommandCallback(const String&, bool, int, uint64_t);
-    void unsignedCallback(uint64_t, uint64_t);
-    void editingRangeCallback(const EditingRange&, uint64_t);
+    void voidCallback(CallbackID);
+    void dataCallback(const IPC::DataReference&, CallbackID);
+    void imageCallback(const ShareableBitmap::Handle&, CallbackID);
+    void stringCallback(const String&, CallbackID);
+    void invalidateStringCallback(CallbackID);
+    void scriptValueCallback(const IPC::DataReference&, bool hadException, const WebCore::ExceptionDetails&, CallbackID);
+    void computedPagesCallback(const Vector<WebCore::IntRect>&, double totalScaleFactorForPrinting, CallbackID);
+    void validateCommandCallback(const String&, bool, int, CallbackID);
+    void unsignedCallback(uint64_t, CallbackID);
+    void editingRangeCallback(const EditingRange&, CallbackID);
 #if PLATFORM(COCOA)
-    void machSendRightCallback(const WebCore::MachSendRight&, uint64_t);
+    void machSendRightCallback(const WebCore::MachSendRight&, CallbackID);
 #endif
-    void rectForCharacterRangeCallback(const WebCore::IntRect&, const EditingRange&, uint64_t);
+    void rectForCharacterRangeCallback(const WebCore::IntRect&, const EditingRange&, CallbackID);
 #if PLATFORM(MAC)
-    void attributedStringForCharacterRangeCallback(const AttributedString&, const EditingRange&, uint64_t);
-    void fontAtSelectionCallback(const String&, double, bool, uint64_t);
+    void attributedStringForCharacterRangeCallback(const AttributedString&, const EditingRange&, CallbackID);
+    void fontAtSelectionCallback(const String&, double, bool, CallbackID);
 #endif
 #if PLATFORM(IOS)
-    void gestureCallback(const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, uint64_t);
-    void touchesCallback(const WebCore::IntPoint&, uint32_t, uint32_t, uint64_t);
-    void autocorrectionDataCallback(const Vector<WebCore::FloatRect>&, const String&, float, uint64_t, uint64_t);
-    void autocorrectionContextCallback(const String&, const String&, const String&, const String&, uint64_t, uint64_t, uint64_t);
-    void selectionContextCallback(const String&, const String&, const String&, uint64_t);
+    void gestureCallback(const WebCore::IntPoint&, uint32_t gestureType, uint32_t gestureState, uint32_t flags, CallbackID);
+    void touchesCallback(const WebCore::IntPoint&, uint32_t touches, uint32_t flags, CallbackID);
+    void autocorrectionDataCallback(const Vector<WebCore::FloatRect>&, const String& fontName, float fontSize, uint64_t fontTraits, CallbackID);
+    void autocorrectionContextCallback(const String& beforeText, const String& markedText, const String& selectedText, const String& afterText, uint64_t location, uint64_t length, CallbackID);
+    void selectionContextCallback(const String& selectedText, const String& beforeText, const String& afterText, CallbackID);
     void interpretKeyEvent(const EditorState&, bool isCharEvent, bool& handled);
     void showPlaybackTargetPicker(bool hasVideo, const WebCore::IntRect& elementRect);
-    void selectionRectsCallback(const Vector<WebCore::SelectionRect>&, uint64_t);
+    void selectionRectsCallback(const Vector<WebCore::SelectionRect>&, CallbackID);
 #endif
 #if PLATFORM(GTK)
-    void printFinishedCallback(const WebCore::ResourceError&, uint64_t);
+    void printFinishedCallback(const WebCore::ResourceError&, CallbackID);
 #endif
 
     void focusedFrameChanged(uint64_t frameID);
@@ -1699,7 +1699,7 @@ private:
 #endif
 
     CallbackMap m_callbacks;
-    HashSet<uint64_t> m_loadDependentStringCallbackIDs;
+    HashSet<CallbackID> m_loadDependentStringCallbackIDs;
 
     HashSet<WebEditCommandProxy*> m_editCommandSet;
 
@@ -1959,7 +1959,7 @@ private:
     WebPreferencesStore::ValueMap m_configurationPreferenceValues;
     WebCore::ActivityState::Flags m_potentiallyChangedActivityStateFlags { WebCore::ActivityState::NoFlags };
     bool m_activityStateChangeWantsSynchronousReply { false };
-    Vector<uint64_t> m_nextActivityStateChangeCallbacks;
+    Vector<CallbackID> m_nextActivityStateChangeCallbacks;
 
     WebCore::MediaProducer::MediaStateFlags m_mediaState { WebCore::MediaProducer::IsNotPlaying };
 
index ec002e2..4243897 100644 (file)
@@ -154,27 +154,27 @@ messages -> WebPageProxy {
     WillSubmitForm(uint64_t frameID, uint64_t sourceFrameID, Vector<std::pair<String, String>> textFieldValues, uint64_t listenerID, WebKit::UserData userData)
 
     # Callback messages
-    VoidCallback(uint64_t callbackID)
-    DataCallback(IPC::DataReference resultData, uint64_t callbackID)
-    ImageCallback(WebKit::ShareableBitmap::Handle bitmapHandle, uint64_t callbackID)
-    StringCallback(String resultString, uint64_t callbackID)
-    InvalidateStringCallback(uint64_t callbackID)
-    ScriptValueCallback(IPC::DataReference resultData, bool hadException, struct WebCore::ExceptionDetails details, uint64_t callbackID)
-    ComputedPagesCallback(Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting, uint64_t callbackID)
-    ValidateCommandCallback(String command, bool isEnabled, int32_t state, uint64_t callbackID)
-    EditingRangeCallback(struct WebKit::EditingRange range, uint64_t callbackID)
-    UnsignedCallback(uint64_t result, uint64_t callbackID)
-    RectForCharacterRangeCallback(WebCore::IntRect rect, struct WebKit::EditingRange actualRange, uint64_t callbackID)
+    VoidCallback(WebKit::CallbackID callbackID)
+    DataCallback(IPC::DataReference resultData, WebKit::CallbackID callbackID)
+    ImageCallback(WebKit::ShareableBitmap::Handle bitmapHandle, WebKit::CallbackID callbackID)
+    StringCallback(String resultString, WebKit::CallbackID callbackID)
+    InvalidateStringCallback(WebKit::CallbackID callbackID)
+    ScriptValueCallback(IPC::DataReference resultData, bool hadException, struct WebCore::ExceptionDetails details, WebKit::CallbackID callbackID)
+    ComputedPagesCallback(Vector<WebCore::IntRect> pageRects, double totalScaleFactorForPrinting, WebKit::CallbackID callbackID)
+    ValidateCommandCallback(String command, bool isEnabled, int32_t state, WebKit::CallbackID callbackID)
+    EditingRangeCallback(struct WebKit::EditingRange range, WebKit::CallbackID callbackID)
+    UnsignedCallback(uint64_t result, WebKit::CallbackID callbackID)
+    RectForCharacterRangeCallback(WebCore::IntRect rect, struct WebKit::EditingRange actualRange, WebKit::CallbackID callbackID)
 #if PLATFORM(MAC)
-    AttributedStringForCharacterRangeCallback(struct WebKit::AttributedString string, struct WebKit::EditingRange actualRange, uint64_t callbackID)
-    FontAtSelectionCallback(String fontName, double fontSize, bool selectioHasMultipleFonts, uint64_t callbackID)
+    AttributedStringForCharacterRangeCallback(struct WebKit::AttributedString string, struct WebKit::EditingRange actualRange, WebKit::CallbackID callbackID)
+    FontAtSelectionCallback(String fontName, double fontSize, bool selectioHasMultipleFonts, WebKit::CallbackID callbackID)
 #endif
 #if PLATFORM(IOS)
-    GestureCallback(WebCore::IntPoint point, uint32_t gestureType, uint32_t gestureState, uint32_t flags, uint64_t callbackID)
-    TouchesCallback(WebCore::IntPoint point, uint32_t touches, uint32_t flags, uint64_t callbackID)
-    AutocorrectionDataCallback(Vector<WebCore::FloatRect> textRects, String fontName, double fontSize, uint64_t traits, uint64_t callbackID)
-    AutocorrectionContextCallback(String beforeText, String markedText, String selectedText, String afterText, uint64_t location, uint64_t length, uint64_t callbackID)
-    SelectionContextCallback(String selectedText, String beforeText, String afterText, uint64_t callbackID)
+    GestureCallback(WebCore::IntPoint point, uint32_t gestureType, uint32_t gestureState, uint32_t flags, WebKit::CallbackID callbackID)
+    TouchesCallback(WebCore::IntPoint point, uint32_t touches, uint32_t flags, WebKit::CallbackID callbackID)
+    AutocorrectionDataCallback(Vector<WebCore::FloatRect> textRects, String fontName, double fontSize, uint64_t traits, WebKit::CallbackID callbackID)
+    AutocorrectionContextCallback(String beforeText, String markedText, String selectedText, String afterText, uint64_t location, uint64_t length, WebKit::CallbackID callbackID)
+    SelectionContextCallback(String selectedText, String beforeText, String afterText, WebKit::CallbackID callbackID)
     InterpretKeyEvent(struct WebKit::EditorState state, bool isCharEvent) -> (bool handled)
     DidReceivePositionInformation(struct WebKit::InteractionInformationAtPosition information)
     SaveImageToLibrary(WebKit::SharedMemory::Handle handle, uint64_t size)
@@ -184,17 +184,17 @@ messages -> WebPageProxy {
     DidNotHandleTapAsClick(WebCore::IntPoint point)
     DidCompleteSyntheticClick()
     DisableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID)
-    DrawToPDFCallback(IPC::DataReference pdfData, uint64_t callbackID)
-    SelectionRectsCallback(Vector<WebCore::SelectionRect> selectionRects, uint64_t callbackID);
+    DrawToPDFCallback(IPC::DataReference pdfData, WebKit::CallbackID callbackID)
+    SelectionRectsCallback(Vector<WebCore::SelectionRect> selectionRects, WebKit::CallbackID callbackID);
 #endif
 #if ENABLE(DATA_DETECTION)
     SetDataDetectionResult(struct WebKit::DataDetectionResult dataDetectionResult)
 #endif
 #if PLATFORM(GTK)
-    PrintFinishedCallback(WebCore::ResourceError error, uint64_t callbackID)
+    PrintFinishedCallback(WebCore::ResourceError error, WebKit::CallbackID callbackID)
 #endif
 #if PLATFORM(COCOA)
-    MachSendRightCallback(WebCore::MachSendRight sendRight, uint64_t callbackID)
+    MachSendRightCallback(WebCore::MachSendRight sendRight, WebKit::CallbackID callbackID)
 #endif
 
     PageScaleFactorDidChange(double scaleFactor)
@@ -482,8 +482,8 @@ messages -> WebPageProxy {
 
     DidRestoreScrollPosition()
 
-    GetLoadDecisionForIcon(struct WebCore::LinkIcon icon, uint64_t callbackID)
-    FinishedLoadingIcon(uint64_t callbackIdentifier, IPC::DataReference data);
+    GetLoadDecisionForIcon(struct WebCore::LinkIcon icon, WebKit::CallbackID callbackID)
+    FinishedLoadingIcon(WebKit::CallbackID callbackID, IPC::DataReference data);
 
 #if PLATFORM(MAC)
     DidHandleAcceptedCandidate()
index 78f6a8f..c1ba764 100644 (file)
@@ -131,7 +131,7 @@ void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint&)
     notImplemented();
 }
 
-void WebPageProxy::gestureCallback(const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags, uint64_t callbackID)
+void WebPageProxy::gestureCallback(const WebCore::IntPoint& point, uint32_t gestureType, uint32_t gestureState, uint32_t flags, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<GestureCallback>(callbackID);
     if (!callback) {
@@ -142,7 +142,7 @@ void WebPageProxy::gestureCallback(const WebCore::IntPoint& point, uint32_t gest
     callback->performCallbackWithReturnValue(point, gestureType, gestureState, flags);
 }
 
-void WebPageProxy::touchesCallback(const WebCore::IntPoint& point, uint32_t touches, uint32_t flags, uint64_t callbackID)
+void WebPageProxy::touchesCallback(const WebCore::IntPoint& point, uint32_t touches, uint32_t flags, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<TouchesCallback>(callbackID);
     if (!callback) {
@@ -153,7 +153,7 @@ void WebPageProxy::touchesCallback(const WebCore::IntPoint& point, uint32_t touc
     callback->performCallbackWithReturnValue(point, touches, flags);
 }
 
-void WebPageProxy::autocorrectionDataCallback(const Vector<WebCore::FloatRect>& rects, const String& fontName, float fontSize, uint64_t fontTraits, uint64_t callbackID)
+void WebPageProxy::autocorrectionDataCallback(const Vector<WebCore::FloatRect>& rects, const String& fontName, float fontSize, uint64_t fontTraits, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<AutocorrectionDataCallback>(callbackID);
     if (!callback) {
@@ -164,7 +164,7 @@ void WebPageProxy::autocorrectionDataCallback(const Vector<WebCore::FloatRect>&
     callback->performCallbackWithReturnValue(rects, fontName, fontSize, fontTraits);
 }
 
-void WebPageProxy::selectionContextCallback(const String& selectedText, const String& beforeText, const String& afterText, uint64_t callbackID)
+void WebPageProxy::selectionContextCallback(const String& selectedText, const String& beforeText, const String& afterText, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<SelectionContextCallback>(callbackID);
     if (!callback) {
@@ -175,7 +175,7 @@ void WebPageProxy::selectionContextCallback(const String& selectedText, const St
     callback->performCallbackWithReturnValue(selectedText, beforeText, afterText);
 }
 
-void WebPageProxy::autocorrectionContextCallback(const String& beforeText, const String& markedText, const String& selectedText, const String& afterText, uint64_t location, uint64_t length, uint64_t callbackID)
+void WebPageProxy::autocorrectionContextCallback(const String& beforeText, const String& markedText, const String& selectedText, const String& afterText, uint64_t location, uint64_t length, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<AutocorrectionContextCallback>(callbackID);
     if (!callback) {
@@ -186,7 +186,7 @@ void WebPageProxy::autocorrectionContextCallback(const String& beforeText, const
     callback->performCallbackWithReturnValue(beforeText, markedText, selectedText, afterText, location, length);
 }
 
-void WebPageProxy::selectionRectsCallback(const Vector<WebCore::SelectionRect>& selectionRects, uint64_t callbackID)
+void WebPageProxy::selectionRectsCallback(const Vector<WebCore::SelectionRect>& selectionRects, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<SelectionRectsCallback>(callbackID);
     if (!callback) {
@@ -430,7 +430,7 @@ void WebPageProxy::selectWithGesture(const WebCore::IntPoint point, WebCore::Tex
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::SelectWithGesture(point, (uint32_t)granularity, gestureType, gestureState, isInteractingWithAssistedNode, callbackID), m_pageID);
 }
 
@@ -441,7 +441,7 @@ void WebPageProxy::updateSelectionWithTouches(const WebCore::IntPoint point, uin
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::UpdateSelectionWithTouches(point, touches, baseIsStart, callbackID), m_pageID);
 }
     
@@ -462,7 +462,7 @@ void WebPageProxy::requestAutocorrectionData(const String& textForAutocorrection
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::RequestAutocorrectionData(textForAutocorrection, callbackID), m_pageID);
 }
 
@@ -473,7 +473,7 @@ void WebPageProxy::applyAutocorrection(const String& correction, const String& o
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::ApplyAutocorrection(correction, originalText, callbackID), m_pageID);
 }
 
@@ -484,7 +484,7 @@ void WebPageProxy::executeEditCommand(const String& commandName, WTF::Function<v
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, callbackID), m_pageID);
 }
 
@@ -502,7 +502,7 @@ void WebPageProxy::selectTextWithGranularityAtPoint(const WebCore::IntPoint poin
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::SelectTextWithGranularityAtPoint(point, static_cast<uint32_t>(granularity), isInteractingWithAssistedNode, callbackID), m_pageID);
 }
 
@@ -513,7 +513,7 @@ void WebPageProxy::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::SelectPositionAtBoundaryWithDirection(point, static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction), isInteractingWithAssistedNode, callbackID), m_pageID);
 }
 
@@ -524,7 +524,7 @@ void WebPageProxy::moveSelectionAtBoundaryWithDirection(WebCore::TextGranularity
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::MoveSelectionAtBoundaryWithDirection(static_cast<uint32_t>(granularity), static_cast<uint32_t>(direction), callbackID), m_pageID);
 }
     
@@ -535,7 +535,7 @@ void WebPageProxy::selectPositionAtPoint(const WebCore::IntPoint point, bool isI
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::SelectPositionAtPoint(point, isInteractingWithAssistedNode, callbackID), m_pageID);
 }
 
@@ -546,7 +546,7 @@ void WebPageProxy::beginSelectionInDirection(WebCore::SelectionDirection directi
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::BeginSelectionInDirection(direction, callbackID), m_pageID);
 }
 
@@ -557,7 +557,7 @@ void WebPageProxy::updateSelectionWithExtentPoint(const WebCore::IntPoint point,
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::UpdateSelectionWithExtentPoint(point, isInteractingWithAssistedNode, callbackID), m_pageID);
     
 }
@@ -569,7 +569,7 @@ void WebPageProxy::updateSelectionWithExtentPointAndBoundary(const WebCore::IntP
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::UpdateSelectionWithExtentPointAndBoundary(point, granularity, isInteractingWithAssistedNode, callbackID), m_pageID);
     
 }
@@ -581,7 +581,7 @@ void WebPageProxy::requestDictationContext(WTF::Function<void (const String&, co
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::RequestDictationContext(callbackID), m_pageID);
 }
 
@@ -592,7 +592,7 @@ void WebPageProxy::requestAutocorrectionContext(WTF::Function<void (const String
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::RequestAutocorrectionContext(callbackID), m_pageID);
 }
 
@@ -608,7 +608,7 @@ void WebPageProxy::getSelectionContext(WTF::Function<void(const String&, const S
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetSelectionContext(callbackID), m_pageID);
 }
 
@@ -624,7 +624,7 @@ void WebPageProxy::selectWithTwoTouches(const WebCore::IntPoint from, const WebC
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::SelectWithTwoTouches(from, to, gestureType, gestureState, callbackID), m_pageID);
 }
 
@@ -720,7 +720,7 @@ void WebPageProxy::requestRectsForGranularityWithSelectionOffset(WebCore::TextGr
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetRectsForGranularityWithSelectionOffset(static_cast<uint32_t>(granularity), offset, callbackID), m_pageID);
 }
 
@@ -731,7 +731,7 @@ void WebPageProxy::requestRectsAtSelectionOffsetWithText(int32_t offset, const S
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::GetRectsAtSelectionOffsetWithText(offset, text, callbackID), m_pageID);
 }
 
@@ -742,7 +742,7 @@ void WebPageProxy::moveSelectionByOffset(int32_t offset, WTF::Function<void (Cal
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     m_process->send(Messages::WebPage::MoveSelectionByOffset(offset, callbackID), m_pageID);
 }
 
@@ -959,7 +959,7 @@ void WebPageProxy::focusNextAssistedNode(bool isForward, WTF::Function<void (Cal
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     process().send(Messages::WebPage::FocusNextAssistedNode(isForward, callbackID), m_pageID);
 }
 
@@ -1037,13 +1037,13 @@ uint32_t WebPageProxy::computePagesForPrintingAndDrawToPDF(uint64_t frameID, con
     }
 
     uint32_t pageCount = 0;
-    uint64_t callbackID = m_callbacks.put(WTFMove(callback), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callback), m_process->throttler().backgroundActivityToken());
     using Message = Messages::WebPage::ComputePagesForPrintingAndDrawToPDF;
     process().sendSync(Message(frameID, printInfo, callbackID), Message::Reply(pageCount), m_pageID);
     return pageCount;
 }
 
-void WebPageProxy::drawToPDFCallback(const IPC::DataReference& pdfData, uint64_t callbackID)
+void WebPageProxy::drawToPDFCallback(const IPC::DataReference& pdfData, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<DrawToPDFCallback>(callbackID);
     RELEASE_ASSERT(callback);
index dc8da5a..2a590bf 100644 (file)
@@ -281,10 +281,10 @@ static void pageDidDrawToImage(const ShareableBitmap::Handle& imageHandle, IPCCa
             view->_printingCallbackCondition.notifyOne();
         }
     });
-    _expectedPrintCallback = callback->callbackID();
+    _expectedPrintCallback = callback->callbackID().toInteger();
 
     context->view = self;
-    context->callbackID = callback->callbackID();
+    context->callbackID = callback->callbackID().toInteger();
 
     _webFrame->page()->drawPagesToPDF(_webFrame.get(), printInfo, firstPage - 1, lastPage - firstPage + 1, WTFMove(callback));
 }
@@ -344,7 +344,7 @@ static void pageDidComputePageRects(const Vector<WebCore::IntRect>& pageRects, d
         std::unique_ptr<IPCCallbackContext> contextDeleter(context);
         pageDidComputePageRects(pageRects, totalScaleFactorForPrinting, context);
     });
-    _expectedComputedPagesCallback = callback->callbackID();
+    _expectedComputedPagesCallback = callback->callbackID().toInteger();
     context->view = self;
     context->callbackID = _expectedComputedPagesCallback;
 
@@ -521,11 +521,11 @@ static CFStringRef linkDestinationName(PDFDocument *document, PDFDestination *de
                     std::unique_ptr<IPCCallbackContext> contextDeleter(context);
                     pageDidDrawToImage(imageHandle, context);
                 });
-                _latestExpectedPreviewCallback = callback->callbackID();
+                _latestExpectedPreviewCallback = callback->callbackID().toInteger();
                 _expectedPreviewCallbacks.add(_latestExpectedPreviewCallback, scaledPrintingRect);
 
                 context->view = self;
-                context->callbackID = callback->callbackID();
+                context->callbackID = callback->callbackID().toInteger();
 
                 _webFrame->page()->drawRectToImage(_webFrame.get(), PrintInfo([_printOperation printInfo]), scaledPrintingRect, imageSize, WTFMove(callback));
                 return;
index 0c5a9f6..3987b45 100644 (file)
@@ -182,12 +182,12 @@ void WebPageProxy::attributedSubstringForCharacterRangeAsync(const EditingRange&
         return;
     }
 
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
 
     process().send(Messages::WebPage::AttributedSubstringForCharacterRangeAsync(range, callbackID), m_pageID);
 }
 
-void WebPageProxy::attributedStringForCharacterRangeCallback(const AttributedString& string, const EditingRange& actualRange, uint64_t callbackID)
+void WebPageProxy::attributedStringForCharacterRangeCallback(const AttributedString& string, const EditingRange& actualRange, CallbackID callbackID)
 {
     MESSAGE_CHECK(actualRange.isValid());
 
@@ -208,12 +208,12 @@ void WebPageProxy::fontAtSelection(WTF::Function<void (const String&, double, bo
         return;
     }
     
-    uint64_t callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
+    auto callbackID = m_callbacks.put(WTFMove(callbackFunction), m_process->throttler().backgroundActivityToken());
     
     process().send(Messages::WebPage::FontAtSelection(callbackID), m_pageID);
 }
 
-void WebPageProxy::fontAtSelectionCallback(const String& fontName, double fontSize, bool selectionHasMultipleFonts, uint64_t callbackID)
+void WebPageProxy::fontAtSelectionCallback(const String& fontName, double fontSize, bool selectionHasMultipleFonts, CallbackID callbackID)
 {
     auto callback = m_callbacks.take<FontAtSelectionCallback>(callbackID);
     if (!callback) {
index cbf2e28..66203cb 100644 (file)
                99C81D561C20DFBE005C4C82 /* AutomationClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutomationClient.mm; sourceTree = "<group>"; };
                99C81D5B1C20E817005C4C82 /* APIAutomationClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIAutomationClient.h; sourceTree = "<group>"; };
                99E714C11C1249E600665B3A /* _WKAutomationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKAutomationDelegate.h; sourceTree = "<group>"; };
+               9BC59D6C1EFCCCB6001E8D09 /* CallbackID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallbackID.h; sourceTree = "<group>"; };
+               9BC59D6D1EFCDC6D001E8D09 /* OptionalCallbackID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionalCallbackID.h; sourceTree = "<group>"; };
                9F54F88E16488E87007DF81A /* ChildProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ChildProcessMac.mm; sourceTree = "<group>"; };
                9F54F8941648AE0E007DF81A /* PluginProcessManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessManagerMac.mm; sourceTree = "<group>"; };
                9FB5F392169E6A80002C25BF /* WKContextPrivateMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKContextPrivateMac.mm; path = mac/WKContextPrivateMac.mm; sourceTree = "<group>"; };
                                4F601430155C5A32001FBDE0 /* BlockingResponseMap.h */,
                                BCF18637167D071E00A1A85A /* CacheModel.cpp */,
                                BC3065F91259344E00E71278 /* CacheModel.h */,
+                               9BC59D6C1EFCCCB6001E8D09 /* CallbackID.h */,
+                               9BC59D6D1EFCDC6D001E8D09 /* OptionalCallbackID.h */,
                                1A2D956E12848564001EB962 /* ChildProcess.cpp */,
                                1A2D956D12848564001EB962 /* ChildProcess.h */,
                                5164C0941B05B757004F102A /* ChildProcess.messages.in */,
index 7543a29..1213d3a 100644 (file)
@@ -54,7 +54,7 @@ WebCookieManager::WebCookieManager(ChildProcess* process)
     m_process->addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), *this);
 }
 
-void WebCookieManager::getHostnamesWithCookies(SessionID sessionID, uint64_t callbackID)
+void WebCookieManager::getHostnamesWithCookies(SessionID sessionID, CallbackID callbackID)
 {
     HashSet<String> hostnames;
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
@@ -79,7 +79,7 @@ void WebCookieManager::deleteAllCookies(SessionID sessionID)
         WebCore::deleteAllCookies(*storageSession);
 }
 
-void WebCookieManager::deleteCookie(SessionID sessionID, const Cookie& cookie, uint64_t callbackID)
+void WebCookieManager::deleteCookie(SessionID sessionID, const Cookie& cookie, CallbackID callbackID)
 {
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         storageSession->deleteCookie(cookie);
@@ -87,16 +87,15 @@ void WebCookieManager::deleteCookie(SessionID sessionID, const Cookie& cookie, u
     m_process->send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
 }
 
-void WebCookieManager::deleteAllCookiesModifiedSince(SessionID sessionID, std::chrono::system_clock::time_point time, uint64_t callbackID)
+void WebCookieManager::deleteAllCookiesModifiedSince(SessionID sessionID, std::chrono::system_clock::time_point time, CallbackID callbackID)
 {
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         WebCore::deleteAllCookiesModifiedSince(*storageSession, time);
 
-    if (callbackID)
-        m_process->send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
+    m_process->send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
 }
 
-void WebCookieManager::getAllCookies(SessionID sessionID, uint64_t callbackID)
+void WebCookieManager::getAllCookies(SessionID sessionID, CallbackID callbackID)
 {
     Vector<Cookie> cookies;
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
@@ -105,7 +104,7 @@ void WebCookieManager::getAllCookies(SessionID sessionID, uint64_t callbackID)
     m_process->send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
 }
 
-void WebCookieManager::getCookies(SessionID sessionID, const URL& url, uint64_t callbackID)
+void WebCookieManager::getCookies(SessionID sessionID, const URL& url, CallbackID callbackID)
 {
     Vector<Cookie> cookies;
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
@@ -114,22 +113,20 @@ void WebCookieManager::getCookies(SessionID sessionID, const URL& url, uint64_t
     m_process->send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
 }
 
-void WebCookieManager::setCookie(WebCore::SessionID sessionID, const Cookie& cookie, uint64_t callbackID)
+void WebCookieManager::setCookie(WebCore::SessionID sessionID, const Cookie& cookie, CallbackID callbackID)
 {
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         storageSession->setCookie(cookie);
 
-    if (callbackID)
-        m_process->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
+    m_process->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
 }
 
-void WebCookieManager::setCookies(WebCore::SessionID sessionID, const Vector<Cookie>& cookies, const URL& url, const URL& mainDocumentURL, uint64_t callbackID)
+void WebCookieManager::setCookies(WebCore::SessionID sessionID, const Vector<Cookie>& cookies, const URL& url, const URL& mainDocumentURL, CallbackID callbackID)
 {
     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
         storageSession->setCookies(cookies, url, mainDocumentURL);
 
-    if (callbackID)
-        m_process->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
+    m_process->send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
 }
 
 void WebCookieManager::notifyCookiesDidChange(SessionID sessionID)
@@ -153,15 +150,15 @@ void WebCookieManager::stopObservingCookieChanges(SessionID sessionID)
         WebCore::stopObservingCookieChanges(*storageSession);
 }
 
-void WebCookieManager::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy, uint64_t callbackID)
+void WebCookieManager::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy, OptionalCallbackID callbackID)
 {
     platformSetHTTPCookieAcceptPolicy(policy);
 
     if (callbackID)
-        m_process->send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID), 0);
+        m_process->send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID.callbackID()), 0);
 }
 
-void WebCookieManager::getHTTPCookieAcceptPolicy(uint64_t callbackID)
+void WebCookieManager::getHTTPCookieAcceptPolicy(CallbackID callbackID)
 {
     m_process->send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0);
 }
index 12ae591..844f7a3 100644 (file)
 
 #pragma once
 
+#include "CallbackID.h"
 #include "HTTPCookieAcceptPolicy.h"
 #include "MessageReceiver.h"
 #include "NetworkProcessSupplement.h"
+#include "OptionalCallbackID.h"
 #include "WebProcessSupplement.h"
 #include <WebCore/SessionID.h>
 #include <chrono>
@@ -56,7 +58,7 @@ public:
 
     static const char* supplementName();
 
-    void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy, uint64_t callbackID);
+    void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy, OptionalCallbackID);
 
 #if USE(SOUP)
     void setCookiePersistentStorage(const String& storagePath, uint32_t storageType);
@@ -68,20 +70,20 @@ private:
     // IPC::MessageReceiver
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
 
-    void getHostnamesWithCookies(WebCore::SessionID, uint64_t callbackID);
+    void getHostnamesWithCookies(WebCore::SessionID, CallbackID);
 
-    void deleteCookie(WebCore::SessionID, const WebCore::Cookie&, uint64_t callbackID);
+    void deleteCookie(WebCore::SessionID, const WebCore::Cookie&, CallbackID);
     void deleteCookiesForHostname(WebCore::SessionID, const String&);
     void deleteAllCookies(WebCore::SessionID);
-    void deleteAllCookiesModifiedSince(WebCore::SessionID, std::chrono::system_clock::time_point, uint64_t callbackID);
+    void deleteAllCookiesModifiedSince(WebCore::SessionID, std::chrono::system_clock::time_point, CallbackID);
 
-    void setCookie(WebCore::SessionID, const WebCore::Cookie&, uint64_t callbackID);
-    void setCookies(WebCore::SessionID, const Vector<WebCore::Cookie>&, const WebCore::URL&, const WebCore::URL& mainDocumentURL, uint64_t callbackID);
-    void getAllCookies(WebCore::SessionID, uint64_t callbackID);
-    void getCookies(WebCore::SessionID, const WebCore::URL&, uint64_t callbackID);
+    void setCookie(WebCore::SessionID, const WebCore::Cookie&, CallbackID);
+    void setCookies(WebCore::SessionID, const Vector<WebCore::Cookie>&, const WebCore::URL&, const WebCore::URL& mainDocumentURL, CallbackID);
+    void getAllCookies(WebCore::SessionID, CallbackID);
+    void getCookies(WebCore::SessionID, const WebCore::URL&, CallbackID);
 
     void platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
-    void getHTTPCookieAcceptPolicy(uint64_t callbackID);
+    void getHTTPCookieAcceptPolicy(CallbackID);
     HTTPCookieAcceptPolicy platformGetHTTPCookieAcceptPolicy();
 
     void startObservingCookieChanges(WebCore::SessionID);
index 0a58555..5feefa7 100644 (file)
  */
  
  messages -> WebCookieManager {
-    void GetHostnamesWithCookies(WebCore::SessionID sessionID, uint64_t callbackID)
+    void GetHostnamesWithCookies(WebCore::SessionID sessionID, WebKit::CallbackID callbackID)
     void DeleteCookiesForHostname(WebCore::SessionID sessionID, String hostname)
     void DeleteAllCookies(WebCore::SessionID sessionID)
 
-    void SetCookie(WebCore::SessionID sessionID, struct WebCore::Cookie cookie, uint64_t callbackID)
-    void SetCookies(WebCore::SessionID sessionID, Vector<WebCore::Cookie> cookies, WebCore::URL url, WebCore::URL mainDocumentURL, uint64_t callbackID)
-    void GetAllCookies(WebCore::SessionID sessionID, uint64_t callbackID)
-    void GetCookies(WebCore::SessionID sessionID, WebCore::URL url, uint64_t callbackID)
-    void DeleteCookie(WebCore::SessionID sessionID, struct WebCore::Cookie cookie, uint64_t callbackID)
-    void DeleteAllCookiesModifiedSince(WebCore::SessionID sessionID, std::chrono::system_clock::time_point time, uint64_t callbackID)
+    void SetCookie(WebCore::SessionID sessionID, struct WebCore::Cookie cookie, WebKit::CallbackID callbackID)
+    void SetCookies(WebCore::SessionID sessionID, Vector<WebCore::Cookie> cookies, WebCore::URL url, WebCore::URL mainDocumentURL, WebKit::CallbackID callbackID)
+    void GetAllCookies(WebCore::SessionID sessionID, WebKit::CallbackID callbackID)
+    void GetCookies(WebCore::SessionID sessionID, WebCore::URL url, WebKit::CallbackID callbackID)
+    void DeleteCookie(WebCore::SessionID sessionID, struct WebCore::Cookie cookie, WebKit::CallbackID callbackID)
+    void DeleteAllCookiesModifiedSince(WebCore::SessionID sessionID, std::chrono::system_clock::time_point time, WebKit::CallbackID callbackID)
 
-    void SetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID)
-    void GetHTTPCookieAcceptPolicy(uint64_t callbackID)
+    void SetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::OptionalCallbackID callbackID)
+    void GetHTTPCookieAcceptPolicy(WebKit::CallbackID callbackID)
     
     void StartObservingCookieChanges(WebCore::SessionID sessionID)
     void StopObservingCookieChanges(WebCore::SessionID sessionID)
index 149abab..85b84e7 100644 (file)
@@ -1815,16 +1815,17 @@ bool WebFrameLoaderClient::useIconLoadingClient()
 void WebFrameLoaderClient::getLoadDecisionForIcon(const LinkIcon& icon, uint64_t callbackID)
 {
     if (WebPage* webPage { m_frame->page() })
-        webPage->send(Messages::WebPageProxy::GetLoadDecisionForIcon(icon, callbackID));
+        webPage->send(Messages::WebPageProxy::GetLoadDecisionForIcon(icon, CallbackID::fromInteger(callbackID)));
 }
 
 void WebFrameLoaderClient::finishedLoadingIcon(uint64_t callbackIdentifier, SharedBuffer* data)
 {
+    auto callbackID = CallbackID::fromInteger(callbackIdentifier);
     if (WebPage* webPage { m_frame->page() }) {
         if (data)
-            webPage->send(Messages::WebPageProxy::FinishedLoadingIcon(callbackIdentifier, { reinterpret_cast<const uint8_t*>(data->data()), data->size() }));
+            webPage->send(Messages::WebPageProxy::FinishedLoadingIcon(callbackID, { reinterpret_cast<const uint8_t*>(data->data()), data->size() }));
         else
-            webPage->send(Messages::WebPageProxy::FinishedLoadingIcon(callbackIdentifier, { nullptr, 0 }));
+            webPage->send(Messages::WebPageProxy::FinishedLoadingIcon(callbackID, { nullptr, 0 }));
     }
 }
 
index bf53e6c..8e831ce 100644 (file)
@@ -138,7 +138,7 @@ void AcceleratedDrawingArea::forceRepaint()
     }
 }
 
-bool AcceleratedDrawingArea::forceRepaintAsync(uint64_t callbackID)
+bool AcceleratedDrawingArea::forceRepaintAsync(CallbackID callbackID)
 {
     return m_layerTreeHost && m_layerTreeHost->forceRepaintAsync(callbackID);
 }
@@ -457,7 +457,7 @@ void AcceleratedDrawingArea::deviceOrPageScaleFactorChanged()
 }
 #endif
 
-void AcceleratedDrawingArea::activityStateDidChange(ActivityState::Flags changed, bool, const Vector<uint64_t>&)
+void AcceleratedDrawingArea::activityStateDidChange(ActivityState::Flags changed, bool, const Vector<CallbackID>&)
 {
     if (changed & ActivityState::IsVisible) {
         if (m_webPage.isVisible())
index 2f1913e..3b64947 100644 (file)
@@ -48,7 +48,7 @@ protected:
     bool layerTreeStateIsFrozen() const override { return m_layerTreeStateIsFrozen; }
     LayerTreeHost* layerTreeHost() const override { return m_layerTreeHost.get(); }
     void forceRepaint() override;
-    bool forceRepaintAsync(uint64_t callbackID) override;
+    bool forceRepaintAsync(CallbackID) override;
 
     void setPaintingEnabled(bool) override;
     void updatePreferences(const WebPreferencesStore&) override;
@@ -68,7 +68,7 @@ protected:
     void destroyNativeSurfaceHandleForCompositing(bool&) override;
 #endif
 
-    void activityStateDidChange(WebCore::ActivityState::Flags, bool /* wantsDidUpdateActivityState */, const Vector<uint64_t>& /* callbackIDs */) override;
+    void activityStateDidChange(WebCore::ActivityState::Flags, bool /* wantsDidUpdateActivityState */, const Vector<CallbackID>& /* callbackIDs */) override;
     void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
 
     void layerHostDidFlushLayers() override;
index 7290aff..729eeb4 100644 (file)
@@ -127,14 +127,14 @@ void CoordinatedLayerTreeHost::forceRepaint()
     m_coordinator.flushPendingLayerChanges();
 }
 
-bool CoordinatedLayerTreeHost::forceRepaintAsync(uint64_t callbackID)
+bool CoordinatedLayerTreeHost::forceRepaintAsync(CallbackID callbackID)
 {
     scheduleLayerFlush();
 
     // We want a clean repaint, meaning that if we're currently waiting for the renderer
     // to finish an update, we'll have to schedule another flush when it's done.
     ASSERT(!m_forceRepaintAsync.callbackID);
-    m_forceRepaintAsync.callbackID = callbackID;
+    m_forceRepaintAsync.callbackID = OptionalCallbackID(callbackID);
     m_forceRepaintAsync.needsFreshFlush = m_scheduledWhileWaitingForRenderer;
     return true;
 }
@@ -167,8 +167,8 @@ void CoordinatedLayerTreeHost::renderNextFrame()
         // aren't needed. If they are, the callback will be executed when this function
         // is called after the next update.
         if (!m_forceRepaintAsync.needsFreshFlush) {
-            m_webPage.send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsync.callbackID));
-            m_forceRepaintAsync = { };
+            m_webPage.send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsync.callbackID.callbackID()));
+            m_forceRepaintAsync = { OptionalCallbackID() , false };
         } else
             m_forceRepaintAsync.needsFreshFlush = false;
     }
index e2c9fa2..74bb5d3 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "CompositingCoordinator.h"
 #include "LayerTreeHost.h"
+#include "OptionalCallbackID.h"
 #include <wtf/RunLoop.h>
 
 namespace WebCore {
@@ -51,7 +52,7 @@ protected:
     void invalidate() override;
 
     void forceRepaint() override;
-    bool forceRepaintAsync(uint64_t callbackID) override;
+    bool forceRepaintAsync(CallbackID) override;
     void sizeDidChange(const WebCore::IntSize& newSize) override;
 
     void deviceOrPageScaleFactorChanged() override;
@@ -85,7 +86,7 @@ private:
     bool m_isWaitingForRenderer { true };
     bool m_scheduledWhileWaitingForRenderer { false };
     struct {
-        uint64_t callbackID { 0 };
+        OptionalCallbackID callbackID;
         bool needsFreshFlush { false };
     } m_forceRepaintAsync;
     RunLoop::Timer<CoordinatedLayerTreeHost> m_layerFlushTimer;
index 9085756..a7da382 100644 (file)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "CallbackID.h"
 #include "DrawingAreaInfo.h"
 #include "LayerTreeContext.h"
 #include "MessageReceiver.h"
@@ -78,7 +79,7 @@ public:
     // FIXME: These should be pure virtual.
     virtual void pageBackgroundTransparencyChanged() { }
     virtual void forceRepaint() { }
-    virtual bool forceRepaintAsync(uint64_t /*callbackID*/) { return false; }
+    virtual bool forceRepaintAsync(CallbackID) { return false; }
     virtual void setLayerTreeStateIsFrozen(bool) { }
     virtual bool layerTreeStateIsFrozen() const { return false; }
     virtual LayerTreeHost* layerTreeHost() const { return 0; }
@@ -116,7 +117,7 @@ public:
 
     virtual void dispatchAfterEnsuringUpdatedScrollPosition(WTF::Function<void ()>&&);
 
-    virtual void activityStateDidChange(WebCore::ActivityState::Flags, bool /* wantsDidUpdateActivityState */, const Vector<uint64_t>& /* callbackIDs */) { }
+    virtual void activityStateDidChange(WebCore::ActivityState::Flags, bool /* wantsDidUpdateActivityState */, const Vector<CallbackID>&) { }
     virtual void setLayerHostingMode(LayerHostingMode) { }
 
     virtual bool markLayersVolatileImmediatelyIfPossible() { return true; }
@@ -174,7 +175,7 @@ private:
     virtual void adjustTransientZoom(double scale, WebCore::FloatPoint origin) { }
     virtual void commitTransientZoom(double scale, WebCore::FloatPoint origin) { }
 
-    virtual void addTransactionCallbackID(uint64_t callbackID) { ASSERT_NOT_REACHED(); }
+    virtual void addTransactionCallbackID(WebKit::CallbackID) { ASSERT_NOT_REACHED(); }
 #endif
 
 #if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW)
index b076f34..6f58fe8 100644 (file)
@@ -37,7 +37,7 @@ messages -> DrawingArea {
     AcceleratedAnimationDidStart(uint64_t layerID, String key, double startTime)
     AcceleratedAnimationDidEnd(uint64_t layerID, String key)
     
-    AddTransactionCallbackID(uint64_t callbackID)
+    AddTransactionCallbackID(WebKit::CallbackID callbackID)
 #endif
 
 #if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW)
index 2f57111..e2c0733 100644 (file)
@@ -28,6 +28,7 @@
 
 #if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
 
+#include "CallbackID.h"
 #include "LayerTreeContext.h"
 #include <WebCore/DisplayRefreshMonitor.h>
 #include <WebCore/PlatformScreen.h>
@@ -71,7 +72,7 @@ public:
     virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) { };
     virtual void scrollNonCompositedContents(const WebCore::IntRect&) { };
     virtual void forceRepaint() = 0;
-    virtual bool forceRepaintAsync(uint64_t /*callbackID*/) { return false; }
+    virtual bool forceRepaintAsync(CallbackID) { return false; }
     virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
     virtual void pageBackgroundTransparencyChanged() = 0;
 
index 3786c85..6962081 100644 (file)
@@ -600,7 +600,7 @@ void WebPage::enableEnumeratingAllNetworkInterfaces()
 void WebPage::reinitializeWebPage(WebPageCreationParameters&& parameters)
 {
     if (m_activityState != parameters.activityState)
-        setActivityState(parameters.activityState, false, Vector<uint64_t>());
+        setActivityState(parameters.activityState, false, Vector<CallbackID>());
     if (m_layerHostingMode != parameters.layerHostingMode)
         setLayerHostingMode(parameters.layerHostingMode);
 }
@@ -1915,7 +1915,7 @@ void WebPage::setFooterBannerHeightForTesting(int height)
 
 #endif // !PLATFORM(IOS)
 
-void WebPage::takeSnapshot(IntRect snapshotRect, IntSize bitmapSize, uint32_t options, uint64_t callbackID)
+void WebPage::takeSnapshot(IntRect snapshotRect, IntSize bitmapSize, uint32_t options, CallbackID callbackID)
 {
     SnapshotOptions snapshotOptions = static_cast<SnapshotOptions>(options);
     snapshotOptions |= SnapshotOptionsShareable;
@@ -2416,7 +2416,7 @@ void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent)
     send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(keyboardEvent.type()), handled));
 }
 
-void WebPage::validateCommand(const String& commandName, uint64_t callbackID)
+void WebPage::validateCommand(const String& commandName, CallbackID callbackID)
 {
     bool isEnabled = false;
     int32_t state = 0;
@@ -2619,7 +2619,7 @@ void WebPage::viewWillEndLiveResize()
         view->willEndLiveResize();
 }
 
-void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event, uint64_t callbackID)
+void WebPage::setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent& event, CallbackID callbackID)
 {
     if (!m_page)
         return;
@@ -2684,7 +2684,7 @@ void WebPage::visibilityDidChange()
     }
 }
 
-void WebPage::setActivityState(ActivityState::Flags activityState, bool wantsDidUpdateActivityState, const Vector<uint64_t>& callbackIDs)
+void WebPage::setActivityState(ActivityState::Flags activityState, bool wantsDidUpdateActivityState, const Vector<CallbackID>& callbackIDs)
 {
     ActivityState::Flags changed = m_activityState ^ activityState;
     m_activityState = activityState;
@@ -2835,7 +2835,7 @@ KeyboardUIMode WebPage::keyboardUIMode()
     return static_cast<KeyboardUIMode>((fullKeyboardAccessEnabled ? KeyboardAccessFull : KeyboardAccessDefault) | (m_tabToLinks ? KeyboardAccessTabsToLinks : 0));
 }
 
-void WebPage::runJavaScriptInMainFrame(const String& script, uint64_t callbackID)
+void WebPage::runJavaScriptInMainFrame(const String& script, CallbackID callbackID)
 {
     // NOTE: We need to be careful when running scripts that the objects we depend on don't
     // disappear during script execution.
@@ -2856,14 +2856,14 @@ void WebPage::runJavaScriptInMainFrame(const String& script, uint64_t callbackID
     send(Messages::WebPageProxy::ScriptValueCallback(dataReference, hadException, details, callbackID));
 }
 
-void WebPage::getContentsAsString(uint64_t callbackID)
+void WebPage::getContentsAsString(CallbackID callbackID)
 {
     String resultString = m_mainFrame->contentsAsString();
     send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
 }
 
 #if ENABLE(MHTML)
-void WebPage::getContentsAsMHTMLData(uint64_t callbackID)
+void WebPage::getContentsAsMHTMLData(CallbackID callbackID)
 {
     auto buffer = MHTMLArchive::generateMHTMLData(m_page.get());
 
@@ -2874,7 +2874,7 @@ void WebPage::getContentsAsMHTMLData(uint64_t callbackID)
 }
 #endif
 
-void WebPage::getRenderTreeExternalRepresentation(uint64_t callbackID)
+void WebPage::getRenderTreeExternalRepresentation(CallbackID callbackID)
 {
     String resultString = renderTreeExternalRepresentation();
     send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
@@ -2890,7 +2890,7 @@ static Frame* frameWithSelection(Page* page)
     return 0;
 }
 
-void WebPage::getSelectionAsWebArchiveData(uint64_t callbackID)
+void WebPage::getSelectionAsWebArchiveData(CallbackID callbackID)
 {
 #if PLATFORM(COCOA)
     RetainPtr<CFDataRef> data;
@@ -2906,7 +2906,7 @@ void WebPage::getSelectionAsWebArchiveData(uint64_t callbackID)
     send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
 }
 
-void WebPage::getSelectionOrContentsAsString(uint64_t callbackID)
+void WebPage::getSelectionOrContentsAsString(CallbackID callbackID)
 {
     WebFrame* focusedOrMainFrame = WebFrame::fromCoreFrame(m_page->focusController().focusedOrMainFrame());
     String resultString = focusedOrMainFrame->selectionAsString();
@@ -2915,7 +2915,7 @@ void WebPage::getSelectionOrContentsAsString(uint64_t callbackID)
     send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
 }
 
-void WebPage::getSourceForFrame(uint64_t frameID, uint64_t callbackID)
+void WebPage::getSourceForFrame(uint64_t frameID, CallbackID callbackID)
 {
     String resultString;
     if (WebFrame* frame = WebProcess::singleton().webFrame(frameID))
@@ -2924,7 +2924,7 @@ void WebPage::getSourceForFrame(uint64_t frameID, uint64_t callbackID)
     send(Messages::WebPageProxy::StringCallback(resultString, callbackID));
 }
 
-void WebPage::getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID)
+void WebPage::getMainResourceDataOfFrame(uint64_t frameID, CallbackID callbackID)
 {
     RefPtr<SharedBuffer> buffer;
     if (WebFrame* frame = WebProcess::singleton().webFrame(frameID)) {
@@ -2956,7 +2956,7 @@ static RefPtr<SharedBuffer> resourceDataForFrame(Frame* frame, const URL& resour
     return &subresource->data();
 }
 
-void WebPage::getResourceDataFromFrame(uint64_t frameID, const String& resourceURLString, uint64_t callbackID)
+void WebPage::getResourceDataFromFrame(uint64_t frameID, const String& resourceURLString, CallbackID callbackID)
 {
     RefPtr<SharedBuffer> buffer;
     if (WebFrame* frame = WebProcess::singleton().webFrame(frameID)) {
@@ -2975,7 +2975,7 @@ void WebPage::getResourceDataFromFrame(uint64_t frameID, const String& resourceU
     send(Messages::WebPageProxy::DataCallback(dataReference, callbackID));
 }
 
-void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
+void WebPage::getWebArchiveOfFrame(uint64_t frameID, CallbackID callbackID)
 {
 #if PLATFORM(COCOA)
     RetainPtr<CFDataRef> data;
@@ -2998,7 +2998,7 @@ void WebPage::forceRepaintWithoutCallback()
     m_drawingArea->forceRepaint();
 }
 
-void WebPage::forceRepaint(uint64_t callbackID)
+void WebPage::forceRepaint(CallbackID callbackID)
 {
     if (m_drawingArea->forceRepaintAsync(callbackID))
         return;
@@ -4377,7 +4377,7 @@ void WebPage::endPrinting()
     m_printContext = nullptr;
 }
 
-void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, uint64_t callbackID)
+void WebPage::computePagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, CallbackID callbackID)
 {
     Vector<IntRect> resultPageRects;
     double resultTotalScaleFactorForPrinting = 1;
@@ -4406,7 +4406,7 @@ void WebPage::computePagesForPrintingImpl(uint64_t frameID, const PrintInfo& pri
 }
 
 #if PLATFORM(COCOA)
-void WebPage::drawRectToImage(uint64_t frameID, const PrintInfo& printInfo, const IntRect& rect, const WebCore::IntSize& imageSize, uint64_t callbackID)
+void WebPage::drawRectToImage(uint64_t frameID, const PrintInfo& printInfo, const IntRect& rect, const WebCore::IntSize& imageSize, CallbackID callbackID)
 {
     WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     Frame* coreFrame = frame ? frame->coreFrame() : 0;
@@ -4455,7 +4455,7 @@ void WebPage::drawRectToImage(uint64_t frameID, const PrintInfo& printInfo, cons
     send(Messages::WebPageProxy::ImageCallback(handle, callbackID));
 }
 
-void WebPage::drawPagesToPDF(uint64_t frameID, const PrintInfo& printInfo, uint32_t first, uint32_t count, uint64_t callbackID)
+void WebPage::drawPagesToPDF(uint64_t frameID, const PrintInfo& printInfo, uint32_t first, uint32_t count, CallbackID callbackID)
 {
     RetainPtr<CFMutableDataRef> pdfPageData;
     drawPagesToPDFImpl(frameID, printInfo, first, count, pdfPageData);
@@ -4513,7 +4513,7 @@ void WebPage::drawPagesToPDFImpl(uint64_t frameID, const PrintInfo& printInfo, u
 }
 
 #elif PLATFORM(GTK)
-void WebPage::drawPagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, uint64_t callbackID)
+void WebPage::drawPagesForPrinting(uint64_t frameID, const PrintInfo& printInfo, CallbackID callbackID)
 {
     beginPrinting(frameID, printInfo);
     if (m_printContext && m_printOperation) {
@@ -4524,7 +4524,7 @@ void WebPage::drawPagesForPrinting(uint64_t frameID, const PrintInfo& printInfo,
     send(Messages::WebPageProxy::VoidCallback(callbackID));
 }
 
-void WebPage::didFinishPrintOperation(const WebCore::ResourceError& error, uint64_t callbackID)
+void WebPage::didFinishPrintOperation(const WebCore::ResourceError& error, CallbackID callbackID)
 {
     send(Messages::WebPageProxy::PrintFinishedCallback(error, callbackID));
     m_printOperation = nullptr;
@@ -4831,7 +4831,7 @@ void WebPage::insertTextAsync(const String& text, const EditingRange& replacemen
         frame.editor().confirmComposition(text);
 }
 
-void WebPage::getMarkedRangeAsync(uint64_t callbackID)
+void WebPage::getMarkedRangeAsync(CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
 
@@ -4846,7 +4846,7 @@ void WebPage::getMarkedRangeAsync(uint64_t callbackID)
     send(Messages::WebPageProxy::EditingRangeCallback(EditingRange(location, length), callbackID));
 }
 
-void WebPage::getSelectedRangeAsync(uint64_t callbackID)
+void WebPage::getSelectedRangeAsync(CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
 
@@ -4861,7 +4861,7 @@ void WebPage::getSelectedRangeAsync(uint64_t callbackID)
     send(Messages::WebPageProxy::EditingRangeCallback(EditingRange(location, length), callbackID));
 }
 
-void WebPage::characterIndexForPointAsync(const WebCore::IntPoint& point, uint64_t callbackID)
+void WebPage::characterIndexForPointAsync(const WebCore::IntPoint& point, CallbackID callbackID)
 {
     uint64_t index = notFound;
 
@@ -4879,7 +4879,7 @@ void WebPage::characterIndexForPointAsync(const WebCore::IntPoint& point, uint64
     send(Messages::WebPageProxy::UnsignedCallback(index, callbackID));
 }
 
-void WebPage::firstRectForCharacterRangeAsync(const EditingRange& editingRange, uint64_t callbackID)
+void WebPage::firstRectForCharacterRangeAsync(const EditingRange& editingRange, CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     IntRect result(IntPoint(0, 0), IntSize(0, 0));
@@ -5686,7 +5686,7 @@ void WebPage::updateCachedDocumentLoader(WebDocumentLoader& documentLoader, Fram
     }
 }
 
-void WebPage::getBytecodeProfile(uint64_t callbackID)
+void WebPage::getBytecodeProfile(CallbackID callbackID)
 {
     if (!commonVM().m_perBytecodeProfiler) {
         send(Messages::WebPageProxy::StringCallback(String(), callbackID));
@@ -5698,7 +5698,7 @@ void WebPage::getBytecodeProfile(uint64_t callbackID)
     send(Messages::WebPageProxy::StringCallback(result, callbackID));
 }
 
-void WebPage::getSamplingProfilerOutput(uint64_t callbackID)
+void WebPage::getSamplingProfilerOutput(CallbackID callbackID)
 {
 #if ENABLE(SAMPLING_PROFILER)
     SamplingProfiler* samplingProfiler = commonVM().samplingProfiler();
@@ -5881,10 +5881,10 @@ void WebPage::didLosePointerLock()
 }
 #endif
 
-void WebPage::didGetLoadDecisionForIcon(bool decision, uint64_t loadIdentifier, uint64_t newCallbackID)
+void WebPage::didGetLoadDecisionForIcon(bool decision, CallbackID loadIdentifier, OptionalCallbackID newCallbackID)
 {
     if (auto* documentLoader = corePage()->mainFrame().loader().documentLoader())
-        documentLoader->didGetLoadDecisionForIcon(decision, loadIdentifier, newCallbackID);
+        documentLoader->didGetLoadDecisionForIcon(decision, loadIdentifier.toInteger(), newCallbackID.toInteger());
 }
 
 void WebPage::setUseIconLoadingClient(bool useIconLoadingClient)
index ca129fa..bf4bcea 100644 (file)
@@ -32,6 +32,7 @@
 #include "APIInjectedBundlePageResourceLoadClient.h"
 #include "APIInjectedBundlePageUIClient.h"
 #include "APIObject.h"
+#include "CallbackID.h"
 #include "EditingRange.h"
 #include "InjectedBundlePageContextMenuClient.h"
 #include "InjectedBundlePageFullScreenClient.h"
@@ -39,6 +40,7 @@
 #include "LayerTreeContext.h"
 #include "MessageReceiver.h"
 #include "MessageSender.h"
+#include "OptionalCallbackID.h"
 #include "Plugin.h"
 #include "SandboxExtension.h"
 #include "SharedMemory.h"
@@ -542,50 +544,50 @@ public:
     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
 
     void blurAssistedNode();
-    void selectWithGesture(const WebCore::IntPoint&, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, uint64_t callbackID);
-    void updateSelectionWithTouches(const WebCore::IntPoint& point, uint32_t touches, bool baseIsStart, uint64_t callbackID);
+    void selectWithGesture(const WebCore::IntPoint&, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, CallbackID);
+    void updateSelectionWithTouches(const WebCore::IntPoint&, uint32_t touches, bool baseIsStart, CallbackID);
     void updateBlockSelectionWithTouch(const WebCore::IntPoint&, uint32_t touch, uint32_t handlePosition);
-    void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, uint64_t callbackID);
+    void selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, CallbackID);
     void extendSelection(uint32_t granularity);
     void selectWordBackward();
-    void moveSelectionByOffset(int32_t offset, uint64_t callbackID);
-    void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID);
-    void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, bool isInteractingWithAssistedNode, uint64_t callbackID);
-    void moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, uint64_t callbackID);
-    void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithAssistedNode, uint64_t callbackID);
-    void beginSelectionInDirection(uint32_t direction, uint64_t callbackID);
-    void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithAssistedNode, uint64_t callbackID);
-    void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID);
-
-    void requestDictationContext(uint64_t callbackID);
+    void moveSelectionByOffset(int32_t offset, CallbackID);
+    void selectTextWithGranularityAtPoint(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode, CallbackID);
+    void selectPositionAtBoundaryWithDirection(const WebCore::IntPoint&, uint32_t granularity, uint32_t direction, bool isInteractingWithAssistedNode, CallbackID);
+    void moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CallbackID);
+    void selectPositionAtPoint(const WebCore::IntPoint&, bool isInteractingWithAssistedNode, CallbackID);
+    void beginSelectionInDirection(uint32_t direction, CallbackID);
+    void updateSelectionWithExtentPoint(const WebCore::IntPoint&, bool isInteractingWithAssistedNode, CallbackID);
+    void updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&, uint32_t granularity, bool isInteractingWithAssistedNode, CallbackID);
+
+    void requestDictationContext(CallbackID);
     void replaceDictatedText(const String& oldText, const String& newText);
     void replaceSelectedText(const String& oldText, const String& newText);
-    void requestAutocorrectionData(const String& textForAutocorrection, uint64_t callbackID);
-    void applyAutocorrection(const String& correction, const String& originalText, uint64_t callbackID);
+    void requestAutocorrectionData(const String& textForAutocorrection, CallbackID);
+    void applyAutocorrection(const String& correction, const String& originalText, CallbackID);
     void syncApplyAutocorrection(const String& correction, const String& originalText, bool& correctionApplied);
-    void requestAutocorrectionContext(uint64_t callbackID);
+    void requestAutocorrectionContext(CallbackID);
     void getAutocorrectionContext(String& beforeText, String& markedText, String& selectedText, String& afterText, uint64_t& location, uint64_t& length);
     void getPositionInformation(const InteractionInformationRequest&, InteractionInformationAtPosition&);
     void requestPositionInformation(const InteractionInformationRequest&);
     void startInteractionWithElementAtPosition(const WebCore::IntPoint&);
     void stopInteraction();
     void performActionOnElement(uint32_t action);
-    void focusNextAssistedNode(bool isForward, uint64_t callbackID);
+    void focusNextAssistedNode(bool isForward, CallbackID);
     void setAssistedNodeValue(const String&);
     void setAssistedNodeValueAsNumber(double);
     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);
     WebCore::IntRect rectForElementAtInteractionLocation();
     void updateSelectionAppearance();
-    void getSelectionContext(uint64_t callbackID);
+    void getSelectionContext(CallbackID);
     void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID);
-    void getRectsForGranularityWithSelectionOffset(uint32_t, int32_t, uint64_t callbackID);
-    void getRectsAtSelectionOffsetWithText(int32_t, const String&, uint64_t callbackID);
+    void getRectsForGranularityWithSelectionOffset(uint32_t, int32_t, CallbackID);
+    void getRectsAtSelectionOffsetWithText(int32_t, const String&, CallbackID);
 #if ENABLE(IOS_TOUCH_EVENTS)
     void dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& queue);
 #endif
 
     void contentSizeCategoryDidChange(const String&);
-    void executeEditCommandWithCallback(const String&, uint64_t callbackID);
+    void executeEditCommandWithCallback(const String&, CallbackID);
 
     Seconds eventThrottlingDelay() const;
 
@@ -673,17 +675,17 @@ public:
     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
 
     void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, uint32_t editingRangeIsRelativeTo = (uint32_t)EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
-    void getMarkedRangeAsync(uint64_t callbackID);
-    void getSelectedRangeAsync(uint64_t callbackID);
-    void characterIndexForPointAsync(const WebCore::IntPoint&, uint64_t callbackID);
-    void firstRectForCharacterRangeAsync(const EditingRange&, uint64_t callbackID);
+    void getMarkedRangeAsync(CallbackID);
+    void getSelectedRangeAsync(CallbackID);
+    void characterIndexForPointAsync(const WebCore::IntPoint&, CallbackID);
+    void firstRectForCharacterRangeAsync(const EditingRange&, CallbackID);
     void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
     void confirmCompositionAsync();
 
 #if PLATFORM(MAC)
     void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool registerUndoGroup = false);
-    void attributedSubstringForCharacterRangeAsync(const EditingRange&, uint64_t callbackID);
-    void fontAtSelection(uint64_t callbackID);
+    void attributedSubstringForCharacterRangeAsync(const EditingRange&, CallbackID);
+    void fontAtSelection(CallbackID);
 #endif
 
     void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
@@ -746,18 +748,18 @@ public:
 
     void beginPrinting(uint64_t frameID, const PrintInfo&);
     void endPrinting();
-    void computePagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
+    void computePagesForPrinting(uint64_t frameID, const PrintInfo&, CallbackID);
     void computePagesForPrintingImpl(uint64_t frameID, const PrintInfo&, Vector<WebCore::IntRect>& pageRects, double& totalScaleFactor);
 #if PLATFORM(COCOA)
-    void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, uint64_t callbackID);
-    void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, uint64_t callbackID);
+    void drawRectToImage(uint64_t frameID, const PrintInfo&, const WebCore::IntRect&, const WebCore::IntSize&, CallbackID);
+    void drawPagesToPDF(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, CallbackID);
     void drawPagesToPDFImpl(uint64_t frameID, const PrintInfo&, uint32_t first, uint32_t count, RetainPtr<CFMutableDataRef>& pdfPageData);
 #if PLATFORM(IOS)
-    void computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo&, uint64_t callbackID, Ref<Messages::WebPage::ComputePagesForPrintingAndDrawToPDF::DelayedReply>&&);
+    void computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo&, CallbackID, Ref<Messages::WebPage::ComputePagesForPrintingAndDrawToPDF::DelayedReply>&&);
 #endif
 #elif PLATFORM(GTK)
-    void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, uint64_t callbackID);
-    void didFinishPrintOperation(const WebCore::ResourceError&, uint64_t callbackID);
+    void drawPagesForPrinting(uint64_t frameID, const PrintInfo&, CallbackID);
+    void didFinishPrintOperation(const WebCore::ResourceError&, CallbackID);
 #endif
 
     void addResourceRequest(unsigned long, const WebCore::ResourceRequest&);
@@ -915,8 +917,8 @@ public:
     Ref<WebCore::DocumentLoader> createDocumentLoader(WebCore::Frame&, const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
     void updateCachedDocumentLoader(WebDocumentLoader&, WebCore::Frame&);
 
-    void getBytecodeProfile(uint64_t callbackID);
-    void getSamplingProfilerOutput(uint64_t callbackID);
+    void getBytecodeProfile(CallbackID);
+    void getSamplingProfilerOutput(CallbackID);
     
 #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
     void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&);
@@ -969,7 +971,7 @@ public:
     void didLosePointerLock();
 #endif
 
-    void didGetLoadDecisionForIcon(bool decision, uint64_t loadIdentifier, uint64_t newCallbackID);
+    void didGetLoadDecisionForIcon(bool decision, CallbackID loadIdentifier, OptionalCallbackID);
     void setUseIconLoadingClient(bool);
 
 #if ENABLE(DATA_INTERACTION)
@@ -1059,11 +1061,11 @@ private:
     void goBack(uint64_t navigationID, uint64_t);
     void goToBackForwardItem(uint64_t navigationID, uint64_t);
     void tryRestoreScrollPosition();
-    void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, uint64_t callbackID);
+    void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&, CallbackID);
     void updateIsInWindow(bool isInitialState = false);
     void visibilityDidChange();
-    void setActivityState(WebCore::ActivityState::Flags, bool wantsDidUpdateActivityState, const Vector<uint64_t>& callbackIDs);
-    void validateCommand(const String&, uint64_t);
+    void setActivityState(WebCore::ActivityState::Flags, bool wantsDidUpdateActivityState, const Vector<CallbackID>& callbackIDs);
+    void validateCommand(const String&, CallbackID);
     void executeEditCommand(const String&, const String&);
     void setEditable(bool);
 
@@ -1104,20 +1106,20 @@ private:
     void viewWillStartLiveResize();
     void viewWillEndLiveResize();
 
-    void getContentsAsString(uint64_t callbackID);
+    void getContentsAsString(CallbackID);
 #if ENABLE(MHTML)
-    void getContentsAsMHTMLData(uint64_t callbackID);
-#endif
-    void getMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID);
-    void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, uint64_t callbackID);
-    void getRenderTreeExternalRepresentation(uint64_t callbackID);
-    void getSelectionOrContentsAsString(uint64_t callbackID);
-    void getSelectionAsWebArchiveData(uint64_t callbackID);
-    void getSourceForFrame(uint64_t frameID, uint64_t callbackID);
-    void getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID);
-    void runJavaScriptInMainFrame(const String&, uint64_t callbackID);
-    void forceRepaint(uint64_t callbackID);
-    void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, uint64_t callbackID);
+    void getContentsAsMHTMLData(CallbackID);
+#endif
+    void getMainResourceDataOfFrame(uint64_t frameID, CallbackID);
+    void getResourceDataFromFrame(uint64_t frameID, const String& resourceURL, CallbackID);
+    void getRenderTreeExternalRepresentation(CallbackID);
+    void getSelectionOrContentsAsString(CallbackID);
+    void getSelectionAsWebArchiveData(CallbackID);
+    void getSourceForFrame(uint64_t frameID, CallbackID);
+    void getWebArchiveOfFrame(uint64_t frameID, CallbackID);
+    void runJavaScriptInMainFrame(const String&, CallbackID);
+    void forceRepaint(CallbackID);
+    void takeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, CallbackID);
 
     void preferencesDidChange(const WebPreferencesStore&);
     void platformPreferencesDidChange(const WebPreferencesStore&);
index f8a1975..ac93f2b 100644 (file)
@@ -21,8 +21,8 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 messages -> WebPage LegacyReceiver {
-    SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event, uint64_t callbackID)
-    SetActivityState(unsigned activityState, bool wantsDidUpdateActivityState, Vector<uint64_t> callbackIDs)
+    SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event, WebKit::CallbackID callbackID)
+    SetActivityState(unsigned activityState, bool wantsDidUpdateActivityState, Vector<WebKit::CallbackID> callbackIDs)
     SetLayerHostingMode(enum WebKit::LayerHostingMode layerHostingMode)
 
     SetDrawsBackground(bool drawsBackground)
@@ -54,34 +54,34 @@ messages -> WebPage LegacyReceiver {
     InspectorNodeSearchMovedToPosition(WebCore::FloatPoint point)
     InspectorNodeSearchEndedAtPosition(WebCore::FloatPoint point)
     BlurAssistedNode()
-    SelectWithGesture(WebCore::IntPoint point, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, uint64_t callbackID)
-    UpdateSelectionWithTouches(WebCore::IntPoint point, uint32_t touches, bool baseIsStart, uint64_t callbackID)
+    SelectWithGesture(WebCore::IntPoint point, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, WebKit::CallbackID callbackID)
+    UpdateSelectionWithTouches(WebCore::IntPoint point, uint32_t touches, bool baseIsStart, WebKit::CallbackID callbackID)
     UpdateBlockSelectionWithTouch(WebCore::IntPoint point, uint32_t touch, uint32_t handlePosition)
-    SelectWithTwoTouches(WebCore::IntPoint from, WebCore::IntPoint to, uint32_t gestureType, uint32_t gestureState, uint64_t callbackID)
+    SelectWithTwoTouches(WebCore::IntPoint from, WebCore::IntPoint to, uint32_t gestureType, uint32_t gestureState, WebKit::CallbackID callbackID)
     ExtendSelection(uint32_t granularity)
     SelectWordBackward()
-    MoveSelectionByOffset(int32_t offset, uint64_t callbackID)
-    SelectTextWithGranularityAtPoint(WebCore::IntPoint point, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID)
-    SelectPositionAtBoundaryWithDirection(WebCore::IntPoint point, uint32_t granularity, uint32_t direction, bool isInteractingWithAssistedNode, uint64_t callbackID)
-    MoveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, uint64_t callbackID)
-    SelectPositionAtPoint(WebCore::IntPoint point, bool isInteractingWithAssistedNode, uint64_t callbackID)
-    BeginSelectionInDirection(uint32_t direction, uint64_t callbackID)
-    UpdateSelectionWithExtentPoint(WebCore::IntPoint point, bool isInteractingWithAssistedNode, uint64_t callbackID)
-    UpdateSelectionWithExtentPointAndBoundary(WebCore::IntPoint point, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID)
-    RequestDictationContext(uint64_t callbackID)
+    MoveSelectionByOffset(int32_t offset, WebKit::CallbackID callbackID)
+    SelectTextWithGranularityAtPoint(WebCore::IntPoint point, uint32_t granularity, bool isInteractingWithAssistedNode, WebKit::CallbackID callbackID)
+    SelectPositionAtBoundaryWithDirection(WebCore::IntPoint point, uint32_t granularity, uint32_t direction, bool isInteractingWithAssistedNode, WebKit::CallbackID callbackID)
+    MoveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, WebKit::CallbackID callbackID)
+    SelectPositionAtPoint(WebCore::IntPoint point, bool isInteractingWithAssistedNode, WebKit::CallbackID callbackID)
+    BeginSelectionInDirection(uint32_t direction, WebKit::CallbackID callbackID)
+    UpdateSelectionWithExtentPoint(WebCore::IntPoint point, bool isInteractingWithAssistedNode, WebKit::CallbackID callbackID)
+    UpdateSelectionWithExtentPointAndBoundary(WebCore::IntPoint point, uint32_t granularity, bool isInteractingWithAssistedNode, WebKit::CallbackID callbackID)
+    RequestDictationContext(WebKit::CallbackID callbackID)
     ReplaceDictatedText(String oldText, String newText)
     ReplaceSelectedText(String oldText, String newText)
-    RequestAutocorrectionData(String textForAutocorrection, uint64_t callbackID)
-    ApplyAutocorrection(String correction, String originalText, uint64_t callbackID)
+    RequestAutocorrectionData(String textForAutocorrection, WebKit::CallbackID callbackID)
+    ApplyAutocorrection(String correction, String originalText, WebKit::CallbackID callbackID)
     SyncApplyAutocorrection(String correction, String originalText) -> (bool autocorrectionApplied)
-    RequestAutocorrectionContext(uint64_t callbackID)
+    RequestAutocorrectionContext(WebKit::CallbackID callbackID)
     GetAutocorrectionContext() -> (String beforeContext, String markedText, String selectedText, String afterContext, uint64_t location, uint64_t length) 
     GetPositionInformation(struct WebKit::InteractionInformationRequest request) -> (struct WebKit::InteractionInformationAtPosition information)
     RequestPositionInformation(struct WebKit::InteractionInformationRequest request)
     StartInteractionWithElementAtPosition(WebCore::IntPoint point)
     StopInteraction()
     PerformActionOnElement(uint32_t action)
-    FocusNextAssistedNode(bool isForward, uint64_t callbackID)
+    FocusNextAssistedNode(bool isForward, WebKit::CallbackID callbackID)
     SetAssistedNodeValue(String value)
     SetAssistedNodeValueAsNumber(double value)
     SetAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection)
@@ -91,13 +91,13 @@ messages -> WebPage LegacyReceiver {
     ApplicationWillEnterForeground(bool isSuspendedUnderLock)
     ApplicationDidBecomeActive()
     ContentSizeCategoryDidChange(String contentSizeCategory)
-    ExecuteEditCommandWithCallback(String name, uint64_t callbackID)
-    GetSelectionContext(uint64_t callbackID)
+    ExecuteEditCommandWithCallback(String name, WebKit::CallbackID callbackID)
+    GetSelectionContext(WebKit::CallbackID callbackID)
     SetAllowsMediaDocumentInlinePlayback(bool allows)
     HandleTwoFingerTapAtPoint(WebCore::IntPoint point, uint64_t requestID)
     SetForceAlwaysUserScalable(bool userScalable)
-    GetRectsForGranularityWithSelectionOffset(uint32_t granularity, int32_t offset, uint64_t callbackID);
-    GetRectsAtSelectionOffsetWithText(int32_t offset, String text, uint64_t callbackID);
+    GetRectsForGranularityWithSelectionOffset(uint32_t granularity, int32_t offset, WebKit::CallbackID callbackID);
+    GetRectsAtSelectionOffsetWithText(int32_t offset, String text, WebKit::CallbackID callbackID);
 #endif
 
     SetControlledByAutomation(bool controlled)
@@ -156,19 +156,19 @@ messages -> WebPage LegacyReceiver {
     RestoreSelectionInFocusedEditableElement()
 
     # Callbacks.
-    GetContentsAsString(uint64_t callbackID)
+    GetContentsAsString(WebKit::CallbackID callbackID)
 #if ENABLE(MHTML)
-    GetContentsAsMHTMLData(uint64_t callbackID)
-#endif
-    GetMainResourceDataOfFrame(uint64_t frameID, uint64_t callbackID)
-    GetResourceDataFromFrame(uint64_t frameID, String resourceURL, uint64_t callbackID)
-    GetRenderTreeExternalRepresentation(uint64_t callbackID)
-    GetSelectionOrContentsAsString(uint64_t callbackID)
-    GetSelectionAsWebArchiveData(uint64_t callbackID)
-    GetSourceForFrame(uint64_t frameID, uint64_t callbackID)
-    GetWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID)
-    RunJavaScriptInMainFrame(String script, uint64_t callbackID)
-    ForceRepaint(uint64_t callbackID)
+    GetContentsAsMHTMLData(WebKit::CallbackID callbackID)
+#endif
+    GetMainResourceDataOfFrame(uint64_t frameID, WebKit::CallbackID callbackID)
+    GetResourceDataFromFrame(uint64_t frameID, String resourceURL, WebKit::CallbackID callbackID)
+    GetRenderTreeExternalRepresentation(WebKit::CallbackID callbackID)
+    GetSelectionOrContentsAsString(WebKit::CallbackID callbackID)
+    GetSelectionAsWebArchiveData(WebKit::CallbackID callbackID)
+    GetSourceForFrame(uint64_t frameID, WebKit::CallbackID callbackID)
+    GetWebArchiveOfFrame(uint64_t frameID, WebKit::CallbackID callbackID)
+    RunJavaScriptInMainFrame(String script, WebKit::CallbackID callbackID)
+    ForceRepaint(WebKit::CallbackID callbackID)
 
 #if PLATFORM(COCOA)
     # Dictionary support.
@@ -192,7 +192,7 @@ messages -> WebPage LegacyReceiver {
     TryClose()
 
     SetEditable(bool editable)
-    ValidateCommand(String name, uint64_t callbackID)
+    ValidateCommand(String name, WebKit::CallbackID callbackID)
     ExecuteEditCommand(String name, String argument)
 
     DidRemoveEditCommand(uint64_t commandID)
@@ -322,16 +322,16 @@ messages -> WebPage LegacyReceiver {
     # Printing.
     BeginPrinting(uint64_t frameID, struct WebKit::PrintInfo printInfo)
     EndPrinting()
-    ComputePagesForPrinting(uint64_t frameID, struct WebKit::PrintInfo printInfo, uint64_t callbackID)
+    ComputePagesForPrinting(uint64_t frameID, struct WebKit::PrintInfo printInfo, WebKit::CallbackID callbackID)
 #if PLATFORM(COCOA)
-    DrawRectToImage(uint64_t frameID, struct WebKit::PrintInfo printInfo, WebCore::IntRect rect, WebCore::IntSize imageSize, uint64_t callbackID)
-    DrawPagesToPDF(uint64_t frameID, struct WebKit::PrintInfo printInfo, uint32_t first, uint32_t count, uint64_t callbackID)
+    DrawRectToImage(uint64_t frameID, struct WebKit::PrintInfo printInfo, WebCore::IntRect rect, WebCore::IntSize imageSize, WebKit::CallbackID callbackID)
+    DrawPagesToPDF(uint64_t frameID, struct WebKit::PrintInfo printInfo, uint32_t first, uint32_t count, WebKit::CallbackID callbackID)
 #if PLATFORM(IOS)
-    ComputePagesForPrintingAndDrawToPDF(uint64_t frameID, struct WebKit::PrintInfo printInfo, uint64_t callbackID) -> (uint32_t pageCount) Delayed
+    ComputePagesForPrintingAndDrawToPDF(uint64_t frameID, struct WebKit::PrintInfo printInfo, WebKit::CallbackID callbackID) -> (uint32_t pageCount) Delayed
 #endif
 #endif
 #if PLATFORM(GTK)
-    DrawPagesForPrinting(uint64_t frameID, struct WebKit::PrintInfo printInfo, uint64_t callbackID)
+    DrawPagesForPrinting(uint64_t frameID, struct WebKit::PrintInfo printInfo, WebKit::CallbackID callbackID)
 #endif
 
     # Media
@@ -383,17 +383,17 @@ messages -> WebPage LegacyReceiver {
     AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result)
 
     InsertTextAsync(String text, struct WebKit::EditingRange replacementRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate)
-    GetMarkedRangeAsync(uint64_t callbackID)
-    GetSelectedRangeAsync(uint64_t callbackID)
-    CharacterIndexForPointAsync(WebCore::IntPoint point, uint64_t callbackID);
-    FirstRectForCharacterRangeAsync(struct WebKit::EditingRange range, uint64_t callbackID);
+    GetMarkedRangeAsync(WebKit::CallbackID callbackID)
+    GetSelectedRangeAsync(WebKit::CallbackID callbackID)
+    CharacterIndexForPointAsync(WebCore::IntPoint point, WebKit::CallbackID callbackID);
+    FirstRectForCharacterRangeAsync(struct WebKit::EditingRange range, WebKit::CallbackID callbackID);
     SetCompositionAsync(String text, Vector<WebCore::CompositionUnderline> underlines, struct WebKit::EditingRange selectionRange, struct WebKit::EditingRange replacementRange)
     ConfirmCompositionAsync()
 #endif
 #if PLATFORM(MAC)
     InsertDictatedTextAsync(String text, struct WebKit::EditingRange replacementRange, Vector<WebCore::DictationAlternative> dictationAlternatives, bool registerUndoGroup)
-    AttributedSubstringForCharacterRangeAsync(struct WebKit::EditingRange range, uint64_t callbackID);
-    FontAtSelection(uint64_t callbackID);
+    AttributedSubstringForCharacterRangeAsync(struct WebKit::EditingRange range, WebKit::CallbackID callbackID);
+    FontAtSelection(WebKit::CallbackID callbackID);
 #endif
 
     SetMinimumLayoutSize(WebCore::IntSize minimumLayoutSize)
@@ -412,11 +412,11 @@ messages -> WebPage LegacyReceiver {
     SetScrollPinningBehavior(uint32_t pinning)
     SetScrollbarOverlayStyle(std::optional<uint32_t> scrollbarStyle)
 
-    GetBytecodeProfile(uint64_t callbackID)
+    GetBytecodeProfile(WebKit::CallbackID callbackID)
 
-    GetSamplingProfilerOutput(uint64_t callbackID)
+    GetSamplingProfilerOutput(WebKit::CallbackID callbackID)
     
-    TakeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, uint64_t callbackID)
+    TakeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, WebKit::CallbackID callbackID)
 #if PLATFORM(MAC)
     PerformImmediateActionHitTestAtLocation(WebCore::FloatPoint location)
     ImmediateActionDidUpdate()
@@ -462,7 +462,7 @@ messages -> WebPage LegacyReceiver {
 
     SetUserInterfaceLayoutDirection(uint32_t direction)
 
-    DidGetLoadDecisionForIcon(bool decision, uint64_t loadIdentifier, uint64_t newCallbackID)
+    DidGetLoadDecisionForIcon(bool decision, WebKit::CallbackID loadIdentifier, WebKit::OptionalCallbackID newCallbackID)
     SetUseIconLoadingClient(bool useIconLoadingClient)
 
 #if ENABLE(GAMEPAD)
index c8c93b2..612c1a9 100644 (file)
@@ -62,7 +62,7 @@ public:
     {
     }
 
-    void startPrint(WebCore::PrintContext* printContext, uint64_t callbackID) override
+    void startPrint(WebCore::PrintContext* printContext, CallbackID callbackID) override
     {
         m_printContext = printContext;
         m_callbackID = callbackID;
@@ -177,7 +177,7 @@ public:
     {
     }
 
-    void startPrint(WebCore::PrintContext* printContext, uint64_t callbackID) override
+    void startPrint(WebCore::PrintContext* printContext, CallbackID callbackID) override
     {
         m_printContext = printContext;
         m_callbackID = callbackID;
@@ -398,7 +398,6 @@ WebPrintOperationGtk::WebPrintOperationGtk(WebPage* page, const PrintInfo& print
     , m_pageSetup(printInfo.pageSetup.get())
     , m_printMode(printInfo.printMode)
     , m_printContext(0)
-    , m_callbackID(0)
     , m_xDPI(1)
     , m_yDPI(1)
     , m_printPagesIdleId(0)
index 743cc2c..b262df3 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef WebPrintOperationGtk_h
 #define WebPrintOperationGtk_h
 
+#include "CallbackID.h"
 #include "PrintInfo.h"
 #include <WebCore/RefPtrCairo.h>
 #include <wtf/RefCounted.h>
@@ -75,7 +76,7 @@ public:
 
     void disconnectFromPage();
 
-    virtual void startPrint(WebCore::PrintContext*, uint64_t callbackID) = 0;
+    virtual void startPrint(WebCore::PrintContext*, CallbackID) = 0;
 
 protected:
     WebPrintOperationGtk(WebPage*, const PrintInfo&);
@@ -103,7 +104,7 @@ protected:
     GRefPtr<GtkPageSetup> m_pageSetup;
     PrintInfo::PrintMode m_printMode;
     WebCore::PrintContext* m_printContext;
-    uint64_t m_callbackID;
+    CallbackID m_callbackID;
     RefPtr<cairo_t> m_cairoContext;
     double m_xDPI;
     double m_yDPI;
index 775906e..e76f9b7 100644 (file)
@@ -396,7 +396,7 @@ bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&)
     return false;
 }
 
-void WebPage::getSelectionContext(uint64_t callbackID)
+void WebPage::getSelectionContext(CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     if (!frame.selection().isRange()) {
@@ -1046,7 +1046,7 @@ RefPtr<Range> WebPage::rangeForBlockAtPoint(const IntPoint& point)
     return range;
 }
 
-void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, uint64_t callbackID)
+void WebPage::selectWithGesture(const IntPoint& point, uint32_t granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, CallbackID callbackID)
 {
     auto& frame = m_page->focusController().focusedOrMainFrame();
     VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
@@ -1722,7 +1722,7 @@ bool WebPage::shouldSwitchToBlockModeForHandle(const IntPoint& handlePoint, Sele
     }
 }
 
-void WebPage::updateSelectionWithTouches(const IntPoint& point, uint32_t touches, bool baseIsStart, uint64_t callbackID)
+void WebPage::updateSelectionWithTouches(const IntPoint& point, uint32_t touches, bool baseIsStart, CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     IntPoint pointInDocument = frame.view()->rootViewToContents(point);
@@ -1783,7 +1783,7 @@ void WebPage::updateSelectionWithTouches(const IntPoint& point, uint32_t touches
     }
 }
 
-void WebPage::selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, uint64_t callbackID)
+void WebPage::selectWithTwoTouches(const WebCore::IntPoint& from, const WebCore::IntPoint& to, uint32_t gestureType, uint32_t gestureState, CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     VisiblePosition fromPosition = frame.visiblePositionForPoint(frame.view()->rootViewToContents(from));
@@ -1824,7 +1824,7 @@ void WebPage::selectWordBackward()
         frame.selection().setSelectedRange(Range::create(*frame.document(), startPosition, position).ptr(), position.affinity(), true, UserTriggered);
 }
 
-void WebPage::moveSelectionByOffset(int32_t offset, uint64_t callbackID)
+void WebPage::moveSelectionByOffset(int32_t offset, CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     
@@ -1850,7 +1850,7 @@ static VisiblePosition visiblePositionForPositionWithOffset(const VisiblePositio
     return visiblePositionForIndex(startIndex + offset, root.get());
 }
 
-void WebPage::getRectsForGranularityWithSelectionOffset(uint32_t granularity, int32_t offset, uint64_t callbackID)
+void WebPage::getRectsForGranularityWithSelectionOffset(uint32_t granularity, int32_t offset, CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     VisibleSelection selection = frame.selection().selection();
@@ -1883,7 +1883,7 @@ static RefPtr<Range> rangeNearPositionMatchesText(const VisiblePosition& positio
     return findClosestPlainText(*selectionRange.get(), matchText, 0, targetOffset);
 }
 
-void WebPage::getRectsAtSelectionOffsetWithText(int32_t offset, const String& text, uint64_t callbackID)
+void WebPage::getRectsAtSelectionOffsetWithText(int32_t offset, const String& text, CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     uint32_t length = text.length();
@@ -1928,7 +1928,7 @@ VisiblePosition WebPage::visiblePositionInFocusedNodeForPoint(const Frame& frame
     return frame.visiblePositionForPoint(constrainedPoint);
 }
 
-void WebPage::selectPositionAtPoint(const WebCore::IntPoint& point, bool isInteractingWithAssistedNode, uint64_t callbackID)
+void WebPage::selectPositionAtPoint(const WebCore::IntPoint& point, bool isInteractingWithAssistedNode, CallbackID callbackID)
 {
     auto& frame = m_page->focusController().focusedOrMainFrame();
     VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
@@ -1938,7 +1938,7 @@ void WebPage::selectPositionAtPoint(const WebCore::IntPoint& point, bool isInter
     send(Messages::WebPageProxy::VoidCallback(callbackID));
 }
 
-void WebPage::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint& point, uint32_t granularity, uint32_t direction, bool isInteractingWithAssistedNode, uint64_t callbackID)
+void WebPage::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint& point, uint32_t granularity, uint32_t direction, bool isInteractingWithAssistedNode, CallbackID callbackID)
 {
     auto& frame = m_page->focusController().focusedOrMainFrame();
     VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
@@ -1951,7 +1951,7 @@ void WebPage::selectPositionAtBoundaryWithDirection(const WebCore::IntPoint& poi
     send(Messages::WebPageProxy::VoidCallback(callbackID));
 }
 
-void WebPage::moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, uint64_t callbackID)
+void WebPage::moveSelectionAtBoundaryWithDirection(uint32_t granularity, uint32_t direction, CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     
@@ -1995,7 +1995,7 @@ static inline bool rectIsTooBigForSelection(const IntRect& blockRect, const Fram
     return blockRect.height() > frame.view()->unobscuredContentRect().height() * factor;
 }
 
-void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID)
+void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithAssistedNode, CallbackID callbackID)
 {
     auto& frame = m_page->focusController().focusedOrMainFrame();
     RefPtr<Range> range = rangeForGranularityAtPoint(frame, point, granularity, isInteractingWithAssistedNode);
@@ -2022,13 +2022,13 @@ void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, u
     send(Messages::WebPageProxy::VoidCallback(callbackID));
 }
 
-void WebPage::beginSelectionInDirection(uint32_t direction, uint64_t callbackID)
+void WebPage::beginSelectionInDirection(uint32_t direction, CallbackID callbackID)
 {
     m_selectionAnchor = (static_cast<SelectionDirection>(direction) == DirectionLeft) ? Start : End;
     send(Messages::WebPageProxy::UnsignedCallback(m_selectionAnchor == Start, callbackID));
 }
 
-void WebPage::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID)
+void WebPage::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithAssistedNode, CallbackID callbackID)
 {
     auto& frame = m_page->focusController().focusedOrMainFrame();
     VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
@@ -2057,7 +2057,7 @@ void WebPage::updateSelectionWithExtentPointAndBoundary(const WebCore::IntPoint&
     send(Messages::WebPageProxy::UnsignedCallback(selectionStart == m_initialSelection->startPosition(), callbackID));
 }
 
-void WebPage::updateSelectionWithExtentPoint(const WebCore::IntPoint& point, bool isInteractingWithAssistedNode, uint64_t callbackID)
+void WebPage::updateSelectionWithExtentPoint(const WebCore::IntPoint& point, bool isInteractingWithAssistedNode, CallbackID callbackID)
 {
     auto& frame = m_page->focusController().focusedOrMainFrame();
     VisiblePosition position = visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode);
@@ -2108,7 +2108,7 @@ void WebPage::convertSelectionRectsToRootView(FrameView* view, Vector<SelectionR
     }
 }
 
-void WebPage::requestDictationContext(uint64_t callbackID)
+void WebPage::requestDictationContext(CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     VisiblePosition startPosition = frame.selection().selection().start();
@@ -2190,7 +2190,7 @@ void WebPage::replaceDictatedText(const String& oldText, const String& newText)
     frame.editor().setIgnoreSelectionChanges(false);
 }
 
-void WebPage::requestAutocorrectionData(const String& textForAutocorrection, uint64_t callbackID)
+void WebPage::requestAutocorrectionData(const String& textForAutocorrection, CallbackID callbackID)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
     if (!frame.selection().isCaret()) {
@@ -2238,14 +2238,14 @@ void WebPage::requestAutocorrectionData(const String& textForAutocorrection, uin
     send(Messages::WebPageProxy::AutocorrectionDataCallback(rectsForText, fontName.get(), fontSize, fontTraits, callbackID));
 }
 
-void WebPage::applyAutocorrection(const String& correction, const String& originalText, uint64_t callbackID)
+void WebPage::applyAutocorrection(const String& correction, const String& originalText, CallbackID callbackID)
 {
     bool correctionApplied;
     syncApplyAutocorrection(correction, originalText, correctionApplied);
     send(Messages::WebPageProxy::StringCallback(correctionApplied ? correction : String(), callbackID));
 }
 
-void WebPage::executeEditCommandWithCallback(const String& commandName, uint64_t callbackID)
+void WebPage::executeEditCommandWithCallback(const String& commandName, CallbackID callbackID)
 {
     executeEditCommand(commandName, String());
     if (commandName == "toggleBold" || commandName == "toggleItalic" || commandName == "toggleUnderline")
@@ -2392,7 +2392,7 @@ static void computeAutocorrectionContext(Frame& frame, String& contextBefore, St
     }
 }
 
-void WebPage::requestAutocorrectionContext(uint64_t callbackID)
+void WebPage::requestAutocorrectionContext(CallbackID callbackID)
 {
     String contextBefore;
     String contextAfter;
@@ -2676,7 +2676,7 @@ static inline bool hasAssistableElement(Node* startNode, Page& page, bool isForw
     return nextAssistableElement(startNode, page, isForward);
 }
 
-void WebPage::focusNextAssistedNode(bool isForward, uint64_t callbackID)
+void WebPage::focusNextAssistedNode(bool isForward, CallbackID callbackID)
 {
     Element* nextElement = nextAssistableElement(m_assistedNode.get(), *m_page, isForward);
     m_userIsInteracting = true;
@@ -3300,7 +3300,7 @@ void WebPage::dispatchAsynchronousTouchEvents(const Vector<WebTouchEvent, 1>& qu
 }
 #endif
 
-void WebPage::computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo& printInfo, uint64_t callbackID, Ref<Messages::WebPage::ComputePagesForPrintingAndDrawToPDF::DelayedReply>&& reply)
+void WebPage::computePagesForPrintingAndDrawToPDF(uint64_t frameID, const PrintInfo& printInfo, CallbackID callbackID, Ref<Messages::WebPage::ComputePagesForPrintingAndDrawToPDF::DelayedReply>&& reply)
 {
     if (printInfo.snapshotFirstPage) {
         reply->send(1);
index 020eec2..4275ae3 100644 (file)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "CallbackID.h"
 #include "DrawingArea.h"
 #include "GraphicsLayerCARemote.h"
 #include "RemoteLayerTreeTransaction.h"
@@ -68,7 +69,7 @@ private:
     void scheduleCompositingLayerFlushImmediately() override;
     void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
 
-    void addTransactionCallbackID(uint64_t callbackID) override;
+    void addTransactionCallbackID(CallbackID) override;
 
     RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID) override;
     void willDestroyDisplayRefreshMonitor(WebCore::DisplayRefreshMonitor*);
@@ -82,7 +83,7 @@ private:
     void setLayerTreeStateIsFrozen(bool) override;
 
     void forceRepaint() override;
-    bool forceRepaintAsync(uint64_t) override { return false; }
+    bool forceRepaintAsync(CallbackID) override { return false; }
 
     void setViewExposedRect(std::optional<WebCore::FloatRect>) override;
     std::optional<WebCore::FloatRect> viewExposedRect() const override { return m_scrolledViewExposedRect; }
@@ -103,7 +104,7 @@ private:
 
     void mainFrameContentSizeChanged(const WebCore::IntSize&) override;
 
-    void activityStateDidChange(WebCore::ActivityState::Flags changed, bool wantsDidUpdateActivityState, const Vector<uint64_t>& callbackIDs) override;
+    void activityStateDidChange(WebCore::ActivityState::Flags changed, bool wantsDidUpdateActivityState, const Vector<CallbackID>& callbackIDs) override;
 
     bool adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags) override;
 
index 2d9c9a7..9c2e73a 100644 (file)
@@ -487,7 +487,7 @@ void RemoteLayerTreeDrawingArea::BackingStoreFlusher::flush()
     m_connection->sendMessage(WTFMove(m_commitEncoder), { });
 }
 
-void RemoteLayerTreeDrawingArea::activityStateDidChange(ActivityState::Flags, bool wantsDidUpdateActivityState, const Vector<uint64_t>&)
+void RemoteLayerTreeDrawingArea::activityStateDidChange(ActivityState::Flags, bool wantsDidUpdateActivityState, const Vector<CallbackID>&)
 {
     // FIXME: Should we suspend painting while not visible, like TiledCoreAnimationDrawingArea? Probably.
 
@@ -497,7 +497,7 @@ void RemoteLayerTreeDrawingArea::activityStateDidChange(ActivityState::Flags, bo
     }
 }
 
-void RemoteLayerTreeDrawingArea::addTransactionCallbackID(uint64_t callbackID)
+void RemoteLayerTreeDrawingArea::addTransactionCallbackID(CallbackID callbackID)
 {
     m_pendingCallbackIDs.append(static_cast<RemoteLayerTreeTransaction::TransactionCallbackID>(callbackID));
     scheduleCompositingLayerFlush();
index cf89578..f0e6c55 100644 (file)
@@ -62,7 +62,7 @@ private:
     void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) override;
 
     void forceRepaint() override;
-    bool forceRepaintAsync(uint64_t callbackID) override;
+    bool forceRepaintAsync(CallbackID) override;
     void setLayerTreeStateIsFrozen(bool) override;
     bool layerTreeStateIsFrozen() const override;
     void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
@@ -81,7 +81,7 @@ private:
 
     bool shouldUseTiledBackingForFrameView(const WebCore::FrameView&) override;
 
-    void activityStateDidChange(WebCore::ActivityState::Flags changed, bool wantsDidUpdateActivityState, const Vector<uint64_t>&) override;
+    void activityStateDidChange(WebCore::ActivityState::Flags changed, bool wantsDidUpdateActivityState, const Vector<CallbackID>&) override;
     void didUpdateActivityStateTimerFired();
 
     void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
@@ -149,7 +149,7 @@ private:
     WebCore::TransformationMatrix m_transform;
 
     RunLoop::Timer<TiledCoreAnimationDrawingArea> m_sendDidUpdateActivityStateTimer;
-    Vector<uint64_t> m_nextActivityStateChangeCallbackIDs;
+    Vector<CallbackID> m_nextActivityStateChangeCallbackIDs;
     bool m_wantsDidUpdateActivityState;
 
     WebCore::GraphicsLayer* m_viewOverlayRootLayer;
index 480d681..1b30b53 100644 (file)
@@ -147,7 +147,7 @@ void TiledCoreAnimationDrawingArea::forceRepaint()
     [CATransaction synchronize];
 }
 
-bool TiledCoreAnimationDrawingArea::forceRepaintAsync(uint64_t callbackID)
+bool TiledCoreAnimationDrawingArea::forceRepaintAsync(CallbackID callbackID)
 {
     if (m_layerTreeStateIsFrozen)
         return false;
@@ -459,7 +459,7 @@ bool TiledCoreAnimationDrawingArea::flushLayers()
     }
 }
 
-void TiledCoreAnimationDrawingArea::activityStateDidChange(ActivityState::Flags changed, bool wantsDidUpdateActivityState, const Vector<uint64_t>& nextActivityStateChangeCallbackIDs)
+void TiledCoreAnimationDrawingArea::activityStateDidChange(ActivityState::Flags changed, bool wantsDidUpdateActivityState, const Vector<CallbackID>& nextActivityStateChangeCallbackIDs)
 {
     m_nextActivityStateChangeCallbackIDs.appendVector(nextActivityStateChangeCallbackIDs);
     m_wantsDidUpdateActivityState |= wantsDidUpdateActivityState;
@@ -482,7 +482,7 @@ void TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired()
     if (m_wantsDidUpdateActivityState)
         m_webPage.send(Messages::WebPageProxy::DidUpdateActivityState());
 
-    for (uint64_t callbackID : m_nextActivityStateChangeCallbackIDs)
+    for (auto callbackID : m_nextActivityStateChangeCallbackIDs)
         m_webPage.send(Messages::WebPageProxy::VoidCallback(callbackID));
 
     m_nextActivityStateChangeCallbackIDs.clear();
index 1eb0437..0192ff1 100644 (file)
@@ -334,7 +334,7 @@ void WebPage::insertDictatedTextAsync(const String& text, const EditingRange& re
     frame.editor().insertDictatedText(text, dictationAlternativeLocations, nullptr);
 }
 
-void WebPage::attributedSubstringForCharacterRangeAsync(const EditingRange& editingRange, uint64_t callbackID)
+void WebPage::attributedSubstringForCharacterRangeAsync(const EditingRange& editingRange, CallbackID callbackID)
 {
     AttributedString result;
 
@@ -375,7 +375,7 @@ void WebPage::attributedSubstringForCharacterRangeAsync(const EditingRange& edit
     send(Messages::WebPageProxy::AttributedStringForCharacterRangeCallback(result, rangeToSend, callbackID));
 }
 
-void WebPage::fontAtSelection(uint64_t callbackID)
+void WebPage::fontAtSelection(CallbackID callbackID)
 {
     String fontName;
     double fontSize = 0;