Changeset 170041 in webkit
- Timestamp:
- Jun 16, 2014 8:52:21 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r170038 r170041 1 2014-06-16 Dan Bernstein <mitz@apple.com> 2 3 Part 2 of: Change GenericCallback<> function parameters into std::function<> 4 https://bugs.webkit.org/show_bug.cgi?id=133927 5 6 Reviewed by Sam Weinig. 7 8 * UIProcess/API/C/WKPage.cpp: 9 (WKPageRunJavaScriptInMainFrame): 10 (WKPageRenderTreeExternalRepresentation): 11 (WKPageGetSourceForFrame): 12 (WKPageGetContentsAsString): 13 (WKPageGetBytecodeProfile): 14 (WKPageGetSelectionAsWebArchiveData): 15 (WKPageValidateCommand): 16 * UIProcess/API/C/WKPluginSiteDataManager.cpp: 17 (WKPluginSiteDataManagerClearSiteData): 18 (WKPluginSiteDataManagerClearAllSiteData): 19 * UIProcess/API/Cocoa/WKWebView.mm: 20 (-[WKWebView evaluateJavaScript:completionHandler:]): 21 * UIProcess/API/mac/WKView.mm: 22 (-[WKView validateUserInterfaceItem:]): 23 (-[WKView startSpeaking:]): 24 (-[WKView selectedRangeWithCompletionHandler:]): 25 (-[WKView markedRangeWithCompletionHandler:]): 26 (-[WKView hasMarkedTextWithCompletionHandler:]): 27 (-[WKView firstRectForCharacterRange:completionHandler:]): 28 (-[WKView characterIndexForPoint:completionHandler:]): 29 * UIProcess/Plugins/WebPluginSiteDataManager.cpp: 30 (WebKit::WebPluginSiteDataManager::clearSiteData): 31 * UIProcess/Plugins/WebPluginSiteDataManager.h: 32 * UIProcess/WebPageProxy.cpp: 33 (WebKit::WebPageProxy::validateCommand): 34 (WebKit::WebPageProxy::runJavaScriptInMainFrame): 35 (WebKit::WebPageProxy::getRenderTreeExternalRepresentation): 36 (WebKit::WebPageProxy::getSourceForFrame): 37 (WebKit::WebPageProxy::getContentsAsString): 38 (WebKit::WebPageProxy::getBytecodeProfile): 39 (WebKit::WebPageProxy::getContentsAsMHTMLData): 40 (WebKit::WebPageProxy::getSelectionOrContentsAsString): 41 (WebKit::WebPageProxy::getSelectionAsWebArchiveData): 42 (WebKit::WebPageProxy::getMarkedRangeAsync): 43 (WebKit::WebPageProxy::getSelectedRangeAsync): 44 (WebKit::WebPageProxy::characterIndexForPointAsync): 45 (WebKit::WebPageProxy::firstRectForCharacterRangeAsync): 46 (WebKit::WebPageProxy::takeSnapshot): 47 * UIProcess/WebPageProxy.h: 48 * UIProcess/ios/WKContentViewInteraction.mm: 49 (-[WKContentView _define:]): 50 (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): 51 (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]): 52 (-[WKContentView requestDictationContext:]): 53 (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): 54 (-[WKContentView requestAutocorrectionContextWithCompletionHandler:]): 55 * UIProcess/ios/WebPageProxyIOS.mm: 56 (WebKit::WebPageProxy::updateSelectionWithTouches): 57 (WebKit::WebPageProxy::requestAutocorrectionData): 58 (WebKit::WebPageProxy::applyAutocorrection): 59 (WebKit::WebPageProxy::requestDictationContext): 60 (WebKit::WebPageProxy::requestAutocorrectionContext): 61 1 62 2014-06-16 Jaehun Lim <ljaehun.lim@samsung.com> 2 63 … … 176 237 2014-06-15 Dan Bernstein <mitz@apple.com> 177 238 178 Part 1 of Change GenericCallback<> function parameters into std::function<>239 Part 1 of: Change GenericCallback<> function parameters into std::function<> 179 240 https://bugs.webkit.org/show_bug.cgi?id=133927 180 241 -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r169994 r170041 1563 1563 void WKPageRunJavaScriptInMainFrame(WKPageRef pageRef, WKStringRef scriptRef, void* context, WKPageRunJavaScriptFunction callback) 1564 1564 { 1565 toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), ScriptValueCallback::create(toGenericCallbackFunction(context, callback)));1565 toImpl(pageRef)->runJavaScriptInMainFrame(toImpl(scriptRef)->string(), toGenericCallbackFunction(context, callback)); 1566 1566 } 1567 1567 … … 1575 1575 void WKPageRenderTreeExternalRepresentation(WKPageRef pageRef, void* context, WKPageRenderTreeExternalRepresentationFunction callback) 1576 1576 { 1577 toImpl(pageRef)->getRenderTreeExternalRepresentation( StringCallback::create(toGenericCallbackFunction(context, callback)));1577 toImpl(pageRef)->getRenderTreeExternalRepresentation(toGenericCallbackFunction(context, callback)); 1578 1578 } 1579 1579 1580 1580 void WKPageGetSourceForFrame(WKPageRef pageRef, WKFrameRef frameRef, void* context, WKPageGetSourceForFrameFunction callback) 1581 1581 { 1582 toImpl(pageRef)->getSourceForFrame(toImpl(frameRef), StringCallback::create(toGenericCallbackFunction(context, callback)));1582 toImpl(pageRef)->getSourceForFrame(toImpl(frameRef), toGenericCallbackFunction(context, callback)); 1583 1583 } 1584 1584 1585 1585 void WKPageGetContentsAsString(WKPageRef pageRef, void* context, WKPageGetContentsAsStringFunction callback) 1586 1586 { 1587 toImpl(pageRef)->getContentsAsString( StringCallback::create(toGenericCallbackFunction(context, callback)));1587 toImpl(pageRef)->getContentsAsString(toGenericCallbackFunction(context, callback)); 1588 1588 } 1589 1589 1590 1590 void WKPageGetBytecodeProfile(WKPageRef pageRef, void* context, WKPageGetBytecodeProfileFunction callback) 1591 1591 { 1592 toImpl(pageRef)->getBytecodeProfile( StringCallback::create(toGenericCallbackFunction(context, callback)));1592 toImpl(pageRef)->getBytecodeProfile(toGenericCallbackFunction(context, callback)); 1593 1593 } 1594 1594 1595 1595 void WKPageGetSelectionAsWebArchiveData(WKPageRef pageRef, void* context, WKPageGetSelectionAsWebArchiveDataFunction callback) 1596 1596 { 1597 toImpl(pageRef)->getSelectionAsWebArchiveData( DataCallback::create(toGenericCallbackFunction(context, callback)));1597 toImpl(pageRef)->getSelectionAsWebArchiveData(toGenericCallbackFunction(context, callback)); 1598 1598 } 1599 1599 … … 1649 1649 void WKPageValidateCommand(WKPageRef pageRef, WKStringRef command, void* context, WKPageValidateCommandCallback callback) 1650 1650 { 1651 toImpl(pageRef)->validateCommand(toImpl(command)->string(), ValidateCommandCallback::create([context, callback](const String& commandName, bool isEnabled, int32_t state, CallbackBase::Error error) {1651 toImpl(pageRef)->validateCommand(toImpl(command)->string(), [context, callback](const String& commandName, bool isEnabled, int32_t state, CallbackBase::Error error) { 1652 1652 callback(toAPI(API::String::create(commandName).get()), isEnabled, state, error != CallbackBase::Error::None ? toAPI(API::Error::create().get()) : 0, context); 1653 }) );1653 }); 1654 1654 } 1655 1655 -
trunk/Source/WebKit2/UIProcess/API/C/WKPluginSiteDataManager.cpp
r170002 r170041 76 76 { 77 77 #if ENABLE(NETSCAPE_PLUGIN_API) 78 toImpl(managerRef)->clearSiteData(toImpl(sitesRef), toNPClearSiteDataFlags(flags), maxAgeInSeconds, VoidCallback::create([context, function](CallbackBase::Error error) {78 toImpl(managerRef)->clearSiteData(toImpl(sitesRef), toNPClearSiteDataFlags(flags), maxAgeInSeconds, [context, function](CallbackBase::Error error) { 79 79 function(error == CallbackBase::Error::None ? nullptr : toAPI(API::Error::create().get()), context); 80 }) );80 }); 81 81 #else 82 82 UNUSED_PARAM(managerRef); … … 92 92 { 93 93 #if ENABLE(NETSCAPE_PLUGIN_API) 94 toImpl(managerRef)->clearSiteData(0, NP_CLEAR_ALL, std::numeric_limits<uint64_t>::max(), VoidCallback::create([context, function](CallbackBase::Error error) {94 toImpl(managerRef)->clearSiteData(0, NP_CLEAR_ALL, std::numeric_limits<uint64_t>::max(), [context, function](CallbackBase::Error error) { 95 95 function(error == CallbackBase::Error::None ? nullptr : toAPI(API::Error::create().get()), context); 96 }) );96 }); 97 97 #else 98 98 UNUSED_PARAM(managerRef); -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r170000 r170041 493 493 auto handler = adoptNS([completionHandler copy]); 494 494 495 _page->runJavaScriptInMainFrame(javaScriptString, WebKit::ScriptValueCallback::create([handler](WebKit::WebSerializedScriptValue* serializedScriptValue, WebKit::ScriptValueCallback::Error errorCode) {495 _page->runJavaScriptInMainFrame(javaScriptString, [handler](WebKit::WebSerializedScriptValue* serializedScriptValue, WebKit::ScriptValueCallback::Error errorCode) { 496 496 if (!handler) 497 497 return; … … 525 525 526 526 completionHandler([value toObject], nil); 527 }) );527 }); 528 528 } 529 529 -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r170000 r170041 836 836 // FIXME: Theoretically, there is a race here; when we get the answer it might be old, from a previous time 837 837 // we asked for the same command; there is no guarantee the answer is still valid. 838 _data->_page->validateCommand(commandName, ValidateCommandCallback::create([self](const String& commandName, bool isEnabled, int32_t state, CallbackBase::Error error) {838 _data->_page->validateCommand(commandName, [self](const String& commandName, bool isEnabled, int32_t state, CallbackBase::Error error) { 839 839 // If the process exits before the command can be validated, we'll be called back with an error. 840 840 if (error != CallbackBase::Error::None) … … 842 842 843 843 [self _setUserInterfaceItemState:commandName enabled:isEnabled state:state]; 844 }) );844 }); 845 845 } 846 846 … … 853 853 - (IBAction)startSpeaking:(id)sender 854 854 { 855 _data->_page->getSelectionOrContentsAsString( StringCallback::create([self](const String& string, CallbackBase::Error error) {855 _data->_page->getSelectionOrContentsAsString([self](const String& string, CallbackBase::Error error) { 856 856 if (error != CallbackBase::Error::None) 857 857 return; … … 860 860 861 861 [NSApp speakString:string]; 862 }) );862 }); 863 863 } 864 864 … … 1465 1465 1466 1466 LOG(TextInput, "selectedRange"); 1467 _data->_page->getSelectedRangeAsync( EditingRangeCallback::create([completionHandler](const EditingRange& editingRangeResult, CallbackBase::Error error) {1467 _data->_page->getSelectedRangeAsync([completionHandler](const EditingRange& editingRangeResult, CallbackBase::Error error) { 1468 1468 void (^completionHandlerBlock)(NSRange) = (void (^)(NSRange))completionHandler.get(); 1469 1469 if (error != CallbackBase::Error::None) { … … 1478 1478 LOG(TextInput, " -> selectedRange returned (%llu, %llu)", result.location, result.length); 1479 1479 completionHandlerBlock(result); 1480 }) );1480 }); 1481 1481 } 1482 1482 … … 1486 1486 1487 1487 LOG(TextInput, "markedRange"); 1488 _data->_page->getMarkedRangeAsync( EditingRangeCallback::create([completionHandler](const EditingRange& editingRangeResult, CallbackBase::Error error) {1488 _data->_page->getMarkedRangeAsync([completionHandler](const EditingRange& editingRangeResult, CallbackBase::Error error) { 1489 1489 void (^completionHandlerBlock)(NSRange) = (void (^)(NSRange))completionHandler.get(); 1490 1490 if (error != CallbackBase::Error::None) { … … 1499 1499 LOG(TextInput, " -> markedRange returned (%llu, %llu)", result.location, result.length); 1500 1500 completionHandlerBlock(result); 1501 }) );1501 }); 1502 1502 } 1503 1503 … … 1507 1507 1508 1508 LOG(TextInput, "hasMarkedText"); 1509 _data->_page->getMarkedRangeAsync( EditingRangeCallback::create([completionHandler](const EditingRange& editingRangeResult, CallbackBase::Error error) {1509 _data->_page->getMarkedRangeAsync([completionHandler](const EditingRange& editingRangeResult, CallbackBase::Error error) { 1510 1510 void (^completionHandlerBlock)(BOOL) = (void (^)(BOOL))completionHandler.get(); 1511 1511 if (error != CallbackBase::Error::None) { … … 1517 1517 LOG(TextInput, " -> hasMarkedText returned %u", hasMarkedText); 1518 1518 completionHandlerBlock(hasMarkedText); 1519 }) );1519 }); 1520 1520 } 1521 1521 … … 1555 1555 } 1556 1556 1557 _data->_page->firstRectForCharacterRangeAsync(theRange, RectForCharacterRangeCallback::create([self, completionHandler](const IntRect& rect, const EditingRange& actualRange, CallbackBase::Error error) {1557 _data->_page->firstRectForCharacterRangeAsync(theRange, [self, completionHandler](const IntRect& rect, const EditingRange& actualRange, CallbackBase::Error error) { 1558 1558 void (^completionHandlerBlock)(NSRect, NSRange) = (void (^)(NSRect, NSRange))completionHandler.get(); 1559 1559 if (error != CallbackBase::Error::None) { … … 1568 1568 LOG(TextInput, " -> firstRectForCharacterRange returned (%f, %f, %f, %f)", resultRect.origin.x, resultRect.origin.y, resultRect.size.width, resultRect.size.height); 1569 1569 completionHandlerBlock(resultRect, actualRange); 1570 }) );1570 }); 1571 1571 } 1572 1572 … … 1586 1586 thePoint = [self convertPoint:thePoint fromView:nil]; // the point is relative to the main frame 1587 1587 1588 _data->_page->characterIndexForPointAsync(IntPoint(thePoint), UnsignedCallback::create([completionHandler](uint64_t result, CallbackBase::Error error) {1588 _data->_page->characterIndexForPointAsync(IntPoint(thePoint), [completionHandler](uint64_t result, CallbackBase::Error error) { 1589 1589 void (^completionHandlerBlock)(NSUInteger) = (void (^)(NSUInteger))completionHandler.get(); 1590 1590 if (error != CallbackBase::Error::None) { … … 1597 1597 LOG(TextInput, " -> characterIndexForPoint returned %lu", result); 1598 1598 completionHandlerBlock(result); 1599 }) );1599 }); 1600 1600 } 1601 1601 -
trunk/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.cpp
r170000 r170041 169 169 } 170 170 171 void WebPluginSiteDataManager::clearSiteData(API::Array* sites, uint64_t flags, uint64_t maxAgeInSeconds, PassRefPtr<VoidCallback> prpCallback)172 { 173 RefPtr<VoidCallback> callback = prpCallback;171 void WebPluginSiteDataManager::clearSiteData(API::Array* sites, uint64_t flags, uint64_t maxAgeInSeconds, std::function<void (CallbackBase::Error)> callbackFunction) 172 { 173 RefPtr<VoidCallback> callback = VoidCallback::create(std::move(callbackFunction)); 174 174 if (!m_webContext) { 175 175 // FIXME: If the context is invalid we should not call the callback. It'd be better to just return false from clearSiteData. -
trunk/Source/WebKit2/UIProcess/Plugins/WebPluginSiteDataManager.h
r170000 r170041 54 54 void didGetSitesWithData(const Vector<String>& sites, uint64_t callbackID); 55 55 56 void clearSiteData(API::Array* sites, uint64_t flags, uint64_t maxAgeInSeconds, PassRefPtr<VoidCallback>);56 void clearSiteData(API::Array* sites, uint64_t flags, uint64_t maxAgeInSeconds, std::function<void (CallbackBase::Error)>); 57 57 void didClearSiteData(uint64_t callbackID); 58 58 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r170000 r170041 1240 1240 } 1241 1241 1242 void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback) 1243 { 1242 void WebPageProxy::validateCommand(const String& commandName, std::function<void (const String&, bool, int32_t, CallbackBase::Error)> callbackFunction) 1243 { 1244 RefPtr<ValidateCommandCallback> callback = ValidateCommandCallback::create(std::move(callbackFunction)); 1245 1244 1246 if (!isValid()) { 1245 1247 callback->invalidate(); … … 2184 2186 } 2185 2187 2186 void WebPageProxy::runJavaScriptInMainFrame(const String& script, PassRefPtr<ScriptValueCallback> prpCallback)2187 { 2188 RefPtr<ScriptValueCallback> callback = prpCallback;2188 void WebPageProxy::runJavaScriptInMainFrame(const String& script, std::function<void (WebSerializedScriptValue*, CallbackBase::Error)> callbackFunction) 2189 { 2190 RefPtr<ScriptValueCallback> callback = ScriptValueCallback::create(std::move(callbackFunction)); 2189 2191 if (!isValid()) { 2190 2192 callback->invalidate(); … … 2197 2199 } 2198 2200 2199 void WebPageProxy::getRenderTreeExternalRepresentation( PassRefPtr<StringCallback> prpCallback)2200 { 2201 RefPtr<StringCallback> callback = prpCallback;2201 void WebPageProxy::getRenderTreeExternalRepresentation(std::function<void (const String&, CallbackBase::Error)> callbackFunction) 2202 { 2203 RefPtr<StringCallback> callback = StringCallback::create(std::move(callbackFunction)); 2202 2204 if (!isValid()) { 2203 2205 callback->invalidate(); … … 2210 2212 } 2211 2213 2212 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, PassRefPtr<StringCallback> prpCallback)2213 { 2214 RefPtr<StringCallback> callback = prpCallback;2214 void WebPageProxy::getSourceForFrame(WebFrameProxy* frame, std::function<void (const String&, CallbackBase::Error)> callbackFunction) 2215 { 2216 RefPtr<StringCallback> callback = StringCallback::create(std::move(callbackFunction)); 2215 2217 if (!isValid()) { 2216 2218 callback->invalidate(); … … 2224 2226 } 2225 2227 2226 void WebPageProxy::getContentsAsString( PassRefPtr<StringCallback> prpCallback)2227 { 2228 RefPtr<StringCallback> callback = prpCallback;2228 void WebPageProxy::getContentsAsString(std::function<void (const String&, CallbackBase::Error)> callbackFunction) 2229 { 2230 RefPtr<StringCallback> callback = StringCallback::create(std::move(callbackFunction)); 2229 2231 if (!isValid()) { 2230 2232 callback->invalidate(); … … 2238 2240 } 2239 2241 2240 void WebPageProxy::getBytecodeProfile( PassRefPtr<StringCallback> prpCallback)2241 { 2242 RefPtr<StringCallback> callback = prpCallback;2242 void WebPageProxy::getBytecodeProfile(std::function<void (const String&, CallbackBase::Error)> callbackFunction) 2243 { 2244 RefPtr<StringCallback> callback = StringCallback::create(std::move(callbackFunction)); 2243 2245 if (!isValid()) { 2244 2246 callback->invalidate(); … … 2253 2255 2254 2256 #if ENABLE(MHTML) 2255 void WebPageProxy::getContentsAsMHTMLData( PassRefPtr<DataCallback> prpCallback, bool useBinaryEncoding)2256 { 2257 RefPtr<DataCallback> callback = prpCallback;2257 void WebPageProxy::getContentsAsMHTMLData(std::function<void (API::Data*, CallbackBase::Error)> callbackFunction, bool useBinaryEncoding) 2258 { 2259 RefPtr<DataCallback> callback = DataCallback::create(std::move(callbackFunction)); 2258 2260 if (!isValid()) { 2259 2261 callback->invalidate(); … … 2267 2269 #endif 2268 2270 2269 void WebPageProxy::getSelectionOrContentsAsString( PassRefPtr<StringCallback> prpCallback)2270 { 2271 RefPtr<StringCallback> callback = prpCallback;2271 void WebPageProxy::getSelectionOrContentsAsString(std::function<void (const String&, CallbackBase::Error)> callbackFunction) 2272 { 2273 RefPtr<StringCallback> callback = StringCallback::create(std::move(callbackFunction)); 2272 2274 if (!isValid()) { 2273 2275 callback->invalidate(); … … 2280 2282 } 2281 2283 2282 void WebPageProxy::getSelectionAsWebArchiveData( PassRefPtr<DataCallback> prpCallback)2283 { 2284 RefPtr<DataCallback> callback = prpCallback;2284 void WebPageProxy::getSelectionAsWebArchiveData(std::function<void (API::Data*, CallbackBase::Error)> callbackFunction) 2285 { 2286 RefPtr<DataCallback> callback = DataCallback::create(std::move(callbackFunction)); 2285 2287 if (!isValid()) { 2286 2288 callback->invalidate(); … … 4987 4989 } 4988 4990 4989 void WebPageProxy::getMarkedRangeAsync(PassRefPtr<EditingRangeCallback> callback) 4990 { 4991 void WebPageProxy::getMarkedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)> callbackFunction) 4992 { 4993 RefPtr<EditingRangeCallback> callback = EditingRangeCallback::create(std::move(callbackFunction)); 4994 4991 4995 if (!isValid()) { 4992 4996 callback->invalidate(); … … 5000 5004 } 5001 5005 5002 void WebPageProxy::getSelectedRangeAsync(PassRefPtr<EditingRangeCallback> callback) 5003 { 5006 void WebPageProxy::getSelectedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)> callbackFunction) 5007 { 5008 RefPtr<EditingRangeCallback> callback = EditingRangeCallback::create(std::move(callbackFunction)); 5009 5004 5010 if (!isValid()) { 5005 5011 callback->invalidate(); … … 5013 5019 } 5014 5020 5015 void WebPageProxy::characterIndexForPointAsync(const WebCore::IntPoint& point, PassRefPtr<UnsignedCallback> callback) 5016 { 5021 void WebPageProxy::characterIndexForPointAsync(const WebCore::IntPoint& point, std::function<void (uint64_t, CallbackBase::Error)> callbackFunction) 5022 { 5023 RefPtr<UnsignedCallback> callback = UnsignedCallback::create(std::move(callbackFunction)); 5024 5017 5025 if (!isValid()) { 5018 5026 callback->invalidate(); … … 5026 5034 } 5027 5035 5028 void WebPageProxy::firstRectForCharacterRangeAsync(const EditingRange& range, PassRefPtr<RectForCharacterRangeCallback> callback) 5029 { 5036 void WebPageProxy::firstRectForCharacterRangeAsync(const EditingRange& range, std::function<void (const WebCore::IntRect&, const EditingRange&, CallbackBase::Error)> callbackFunction) 5037 { 5038 RefPtr<RectForCharacterRangeCallback> callback = RectForCharacterRangeCallback::create(std::move(callbackFunction)); 5039 5030 5040 if (!isValid()) { 5031 5041 callback->invalidate(); … … 5060 5070 #endif 5061 5071 5062 void WebPageProxy::takeSnapshot(IntRect rect, IntSize bitmapSize, SnapshotOptions options, ImageCallback::CallbackFunctioncallbackFunction)5063 { 5064 RefPtr<ImageCallback> callback = ImageCallback::create( callbackFunction);5072 void WebPageProxy::takeSnapshot(IntRect rect, IntSize bitmapSize, SnapshotOptions options, std::function<void (const ShareableBitmap::Handle&, CallbackBase::Error)> callbackFunction) 5073 { 5074 RefPtr<ImageCallback> callback = ImageCallback::create(std::move(callbackFunction)); 5065 5075 5066 5076 if (!isValid()) { -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r170000 r170041 376 376 377 377 void executeEditCommand(const String& commandName); 378 void validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback>);378 void validateCommand(const String& commandName, std::function<void (const String&, bool, int32_t, CallbackBase::Error)>); 379 379 #if PLATFORM(IOS) 380 380 double displayedContentScale() const { return m_lastVisibleContentRectUpdate.scale(); } … … 399 399 400 400 void selectWithGesture(const WebCore::IntPoint, WebCore::TextGranularity, uint32_t gestureType, uint32_t gestureState, std::function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>); 401 void updateSelectionWithTouches(const WebCore::IntPoint, uint32_t touches, bool baseIsStart, PassRefPtr<TouchesCallback>);401 void updateSelectionWithTouches(const WebCore::IntPoint, uint32_t touches, bool baseIsStart, std::function<void (const WebCore::IntPoint&, uint32_t, CallbackBase::Error)>); 402 402 void selectWithTwoTouches(const WebCore::IntPoint from, const WebCore::IntPoint to, uint32_t gestureType, uint32_t gestureState, std::function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>); 403 403 void updateBlockSelectionWithTouch(const WebCore::IntPoint, uint32_t touch, uint32_t handlePosition); 404 404 void extendSelection(WebCore::TextGranularity); 405 405 void selectWordBackward(); 406 void requestAutocorrectionData(const String& textForAutocorrection, PassRefPtr<AutocorrectionDataCallback>);407 void applyAutocorrection(const String& correction, const String& originalText, PassRefPtr<StringCallback>);406 void requestAutocorrectionData(const String& textForAutocorrection, std::function<void (const Vector<WebCore::FloatRect>&, const String&, double, uint64_t, CallbackBase::Error)>); 407 void applyAutocorrection(const String& correction, const String& originalText, std::function<void (const String&, CallbackBase::Error)>); 408 408 bool applyAutocorrection(const String& correction, const String& originalText); 409 void requestAutocorrectionContext( PassRefPtr<AutocorrectionContextCallback>);409 void requestAutocorrectionContext(std::function<void (const String&, const String&, const String&, const String&, uint64_t, uint64_t, CallbackBase::Error)>); 410 410 void getAutocorrectionContext(String& contextBefore, String& markedText, String& selectedText, String& contextAfter, uint64_t& location, uint64_t& length); 411 void requestDictationContext( PassRefPtr<DictationContextCallback>);411 void requestDictationContext(std::function<void (const String&, const String&, const String&, CallbackBase::Error)>); 412 412 void replaceDictatedText(const String& oldText, const String& newText); 413 413 void replaceSelectedText(const String& oldText, const String& newText); … … 472 472 473 473 void insertTextAsync(const String& text, const EditingRange& replacementRange); 474 void getMarkedRangeAsync( PassRefPtr<EditingRangeCallback>);475 void getSelectedRangeAsync( PassRefPtr<EditingRangeCallback>);476 void characterIndexForPointAsync(const WebCore::IntPoint&, PassRefPtr<UnsignedCallback>);477 void firstRectForCharacterRangeAsync(const EditingRange&, PassRefPtr<RectForCharacterRangeCallback>);474 void getMarkedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)>); 475 void getSelectedRangeAsync(std::function<void (EditingRange, CallbackBase::Error)>); 476 void characterIndexForPointAsync(const WebCore::IntPoint&, std::function<void (uint64_t, CallbackBase::Error)>); 477 void firstRectForCharacterRangeAsync(const EditingRange&, std::function<void (const WebCore::IntRect&, const EditingRange&, CallbackBase::Error)>); 478 478 void setCompositionAsync(const String& text, Vector<WebCore::CompositionUnderline> underlines, const EditingRange& selectionRange, const EditingRange& replacementRange); 479 479 void confirmCompositionAsync(); … … 652 652 void didFindStringMatches(const String&, const Vector<Vector<WebCore::IntRect>>& matchRects, int32_t firstIndexAfterSelection); 653 653 654 void getContentsAsString( PassRefPtr<StringCallback>);655 void getBytecodeProfile( PassRefPtr<StringCallback>);654 void getContentsAsString(std::function<void (const String&, CallbackBase::Error)>); 655 void getBytecodeProfile(std::function<void (const String&, CallbackBase::Error)>); 656 656 657 657 #if ENABLE(MHTML) 658 void getContentsAsMHTMLData( PassRefPtr<DataCallback>, bool useBinaryEncoding);658 void getContentsAsMHTMLData(std::function<void (API::Data*, CallbackBase::Error)>, bool useBinaryEncoding); 659 659 #endif 660 660 void getMainResourceDataOfFrame(WebFrameProxy*, std::function<void (API::Data*, CallbackBase::Error)>); 661 661 void getResourceDataFromFrame(WebFrameProxy*, API::URL*, std::function<void (API::Data*, CallbackBase::Error)>); 662 void getRenderTreeExternalRepresentation( PassRefPtr<StringCallback>);663 void getSelectionOrContentsAsString( PassRefPtr<StringCallback>);664 void getSelectionAsWebArchiveData( PassRefPtr<DataCallback>);665 void getSourceForFrame(WebFrameProxy*, PassRefPtr<StringCallback>);662 void getRenderTreeExternalRepresentation(std::function<void (const String&, CallbackBase::Error)>); 663 void getSelectionOrContentsAsString(std::function<void (const String&, CallbackBase::Error)>); 664 void getSelectionAsWebArchiveData(std::function<void (API::Data*, CallbackBase::Error)>); 665 void getSourceForFrame(WebFrameProxy*, std::function<void (const String&, CallbackBase::Error)>); 666 666 void getWebArchiveOfFrame(WebFrameProxy*, std::function<void (API::Data*, CallbackBase::Error)>); 667 void runJavaScriptInMainFrame(const String&, PassRefPtr<ScriptValueCallback>);667 void runJavaScriptInMainFrame(const String&, std::function<void (WebSerializedScriptValue*, CallbackBase::Error)> callbackFunction); 668 668 void forceRepaint(PassRefPtr<VoidCallback>); 669 669 … … 893 893 void setThumbnailScale(double); 894 894 895 void takeSnapshot(WebCore::IntRect, WebCore::IntSize bitmapSize, SnapshotOptions, ImageCallback::CallbackFunction);895 void takeSnapshot(WebCore::IntRect, WebCore::IntSize bitmapSize, SnapshotOptions, std::function<void (const ShareableBitmap::Handle&, CallbackBase::Error)>); 896 896 897 897 private: -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r170000 r170041 1211 1211 - (void)_define:(id)sender 1212 1212 { 1213 _page->getSelectionOrContentsAsString( StringCallback::create([self](const String& string, CallbackBase::Error error) {1213 _page->getSelectionOrContentsAsString([self](const String& string, CallbackBase::Error error) { 1214 1214 if (error != CallbackBase::Error::None) 1215 1215 return; … … 1218 1218 1219 1219 [self _showDictionary:string]; 1220 }) );1220 }); 1221 1221 } 1222 1222 … … 1440 1440 { 1441 1441 _usingGestureForSelection = YES; 1442 _page->updateSelectionWithTouches(WebCore::IntPoint(point), static_cast<uint32_t>(toSelectionTouch(touch)), baseIsStart, TouchesCallback::create([self, touch](const WebCore::IntPoint& point, uint32_t touch, CallbackBase::Error error) {1442 _page->updateSelectionWithTouches(WebCore::IntPoint(point), static_cast<uint32_t>(toSelectionTouch(touch)), baseIsStart, [self, touch](const WebCore::IntPoint& point, uint32_t touch, CallbackBase::Error error) { 1443 1443 selectionChangedWithTouch(self, point, touch, error); 1444 1444 if (touch != UIWKSelectionTouchStarted && touch != UIWKSelectionTouchMoved) 1445 1445 _usingGestureForSelection = NO; 1446 }) );1446 }); 1447 1447 } 1448 1448 … … 1477 1477 1478 1478 _autocorrectionData.autocorrectionHandler = [completionHandler copy]; 1479 _page->requestAutocorrectionData(input, AutocorrectionDataCallback::create([self](const Vector<FloatRect>& rects, const String& fontName, double fontSize, uint64_t traits, CallbackBase::Error) {1479 _page->requestAutocorrectionData(input, [self](const Vector<FloatRect>& rects, const String& fontName, double fontSize, uint64_t traits, CallbackBase::Error) { 1480 1480 CGRect firstRect = CGRectZero; 1481 1481 CGRect lastRect = CGRectZero; … … 1494 1494 [_autocorrectionData.autocorrectionHandler release]; 1495 1495 _autocorrectionData.autocorrectionHandler = nil; 1496 }) );1496 }); 1497 1497 } 1498 1498 … … 1540 1540 UIWKDictationContextHandler dictationHandler = [completionHandler copy]; 1541 1541 1542 _page->requestDictationContext( DictationContextCallback::create([dictationHandler](const String& selectedText, const String& beforeText, const String& afterText, CallbackBase::Error) {1542 _page->requestDictationContext([dictationHandler](const String& selectedText, const String& beforeText, const String& afterText, CallbackBase::Error) { 1543 1543 dictationHandler(selectedText, beforeText, afterText); 1544 1544 [dictationHandler release]; 1545 }) );1545 }); 1546 1546 } 1547 1547 … … 1557 1557 } 1558 1558 _autocorrectionData.autocorrectionHandler = [completionHandler copy]; 1559 _page->applyAutocorrection(correction, input, StringCallback::create([self](const String& string, CallbackBase::Error error) {1559 _page->applyAutocorrection(correction, input, [self](const String& string, CallbackBase::Error error) { 1560 1560 _autocorrectionData.autocorrectionHandler(!string.isNull() ? [WKAutocorrectionRects autocorrectionRectsWithRects:_autocorrectionData.textFirstRect lastRect:_autocorrectionData.textLastRect] : nil); 1561 1561 [_autocorrectionData.autocorrectionHandler release]; 1562 1562 _autocorrectionData.autocorrectionHandler = nil; 1563 }) );1563 }); 1564 1564 } 1565 1565 … … 1580 1580 } else { 1581 1581 _autocorrectionData.autocorrectionContextHandler = [completionHandler copy]; 1582 _page->requestAutocorrectionContext( AutocorrectionContextCallback::create([self](const String& beforeText, const String& markedText, const String& selectedText, const String& afterText, uint64_t location, uint64_t length, CallbackBase::Error) {1582 _page->requestAutocorrectionContext([self](const String& beforeText, const String& markedText, const String& selectedText, const String& afterText, uint64_t location, uint64_t length, CallbackBase::Error) { 1583 1583 _autocorrectionData.autocorrectionContextHandler([WKAutocorrectionContext autocorrectionContextWithData:beforeText markedText:markedText selectedText:selectedText afterText:afterText selectedRangeInMarkedText:NSMakeRange(location, length)]); 1584 }) );1584 }); 1585 1585 } 1586 1586 } -
trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
r170000 r170041 318 318 } 319 319 320 void WebPageProxy::updateSelectionWithTouches(const WebCore::IntPoint point, uint32_t touches, bool baseIsStart, PassRefPtr<TouchesCallback> callback) 321 { 320 void WebPageProxy::updateSelectionWithTouches(const WebCore::IntPoint point, uint32_t touches, bool baseIsStart, std::function<void (const WebCore::IntPoint&, uint32_t, CallbackBase::Error)> callbackFunction) 321 { 322 RefPtr<TouchesCallback> callback = TouchesCallback::create(std::move(callbackFunction)); 323 322 324 if (!isValid()) { 323 325 callback->invalidate(); … … 340 342 } 341 343 342 void WebPageProxy::requestAutocorrectionData(const String& textForAutocorrection, PassRefPtr<AutocorrectionDataCallback> callback) 343 { 344 void WebPageProxy::requestAutocorrectionData(const String& textForAutocorrection, std::function<void (const Vector<WebCore::FloatRect>&, const String&, double, uint64_t, CallbackBase::Error)> callbackFunction) 345 { 346 RefPtr<AutocorrectionDataCallback> callback = AutocorrectionDataCallback::create(std::move(callbackFunction)); 347 344 348 if (!isValid()) { 345 349 callback->invalidate(); … … 352 356 } 353 357 354 void WebPageProxy::applyAutocorrection(const String& correction, const String& originalText, PassRefPtr<StringCallback> callback) 355 { 358 void WebPageProxy::applyAutocorrection(const String& correction, const String& originalText, std::function<void (const String&, CallbackBase::Error)> callbackFunction) 359 { 360 RefPtr<StringCallback> callback = StringCallback::create(std::move(callbackFunction)); 361 356 362 if (!isValid()) { 357 363 callback->invalidate(); … … 371 377 } 372 378 373 void WebPageProxy::requestDictationContext(PassRefPtr<DictationContextCallback> callback) 374 { 379 void WebPageProxy::requestDictationContext(std::function<void (const String&, const String&, const String&, CallbackBase::Error)> callbackFunction) 380 { 381 RefPtr<DictationContextCallback> callback = DictationContextCallback::create(std::move(callbackFunction)); 382 375 383 if (!isValid()) { 376 384 callback->invalidate(); … … 383 391 } 384 392 385 void WebPageProxy::requestAutocorrectionContext(PassRefPtr<AutocorrectionContextCallback> callback) 386 { 393 void WebPageProxy::requestAutocorrectionContext(std::function<void (const String&, const String&, const String&, const String&, uint64_t, uint64_t, CallbackBase::Error)> callbackFunction) 394 { 395 RefPtr<AutocorrectionContextCallback> callback = AutocorrectionContextCallback::create(std::move(callbackFunction)); 396 387 397 if (!isValid()) { 388 398 callback->invalidate();
Note: See TracChangeset
for help on using the changeset viewer.