Use a single map for all callback types in WebPageProxy
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jun 2014 19:59:14 +0000 (19:59 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Jun 2014 19:59:14 +0000 (19:59 +0000)
commitd75461a6c67a0c7a35b77c660278513fa1406d8d
treed0b27e94d982cc35f600819961abf11efb36a34b
parent6340151bdab8710f030bc9f4946f6f3d7dedf0d5
Use a single map for all callback types in WebPageProxy
https://bugs.webkit.org/show_bug.cgi?id=134069

Reviewed by Anders Carlsson.

* UIProcess/GenericCallback.h:
(WebKit::CallbackBase::as): Added. Performs a dynamic cast to a specific callback type.
(WebKit::CallbackBase::CallbackBase): Added a type parameter, which is used to initialize
the new m_type member.
(WebKit::GenericCallback::GenericCallback): Pass the type to the base class constructor.
(WebKit::GenericCallback::type): Added. Returns a unique type.
(WebKit::GenericCallback::invalidate): Now virtual.

(WebKit::CallbackMap::put): Adds the callback to the map.
(WebKit::CallbackMap::take): Removes the callback from the map, and dynamically casts it to
the specified type.
(WebKit::CallbackMap::invalidate): Invalidates the map.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::validateCommand):
(WebKit::WebPageProxy::runJavaScriptInMainFrame):
(WebKit::WebPageProxy::getRenderTreeExternalRepresentation):
(WebKit::WebPageProxy::getSourceForFrame):
(WebKit::WebPageProxy::getContentsAsString):
(WebKit::WebPageProxy::getBytecodeProfile):
(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::scriptValueCallback):
(WebKit::WebPageProxy::computedPagesCallback):
(WebKit::WebPageProxy::validateCommandCallback):
(WebKit::WebPageProxy::unsignedCallback):
(WebKit::WebPageProxy::editingRangeCallback):
(WebKit::WebPageProxy::rectForCharacterRangeCallback):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::computePagesForPrinting):
(WebKit::WebPageProxy::drawRectToImage):
(WebKit::WebPageProxy::drawPagesToPDF):
(WebKit::WebPageProxy::getMarkedRangeAsync):
(WebKit::WebPageProxy::getSelectedRangeAsync):
(WebKit::WebPageProxy::characterIndexForPointAsync):
(WebKit::WebPageProxy::firstRectForCharacterRangeAsync):
(WebKit::WebPageProxy::takeSnapshot):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::gestureCallback):
(WebKit::WebPageProxy::touchesCallback):
(WebKit::WebPageProxy::autocorrectionDataCallback):
(WebKit::WebPageProxy::dictationContextCallback):
(WebKit::WebPageProxy::autocorrectionContextCallback):
(WebKit::WebPageProxy::selectWithGesture):
(WebKit::WebPageProxy::updateSelectionWithTouches):
(WebKit::WebPageProxy::requestAutocorrectionData):
(WebKit::WebPageProxy::applyAutocorrection):
(WebKit::WebPageProxy::requestDictationContext):
(WebKit::WebPageProxy::requestAutocorrectionContext):
(WebKit::WebPageProxy::selectWithTwoTouches):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170158 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/GenericCallback.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm