Changeset 233165 in webkit
- Timestamp:
- Jun 25, 2018 12:54:21 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r233162 r233165 1 2018-06-25 Chris Dumez <cdumez@apple.com> 2 3 Make sure API::IconLoadingClient::getLoadDecisionForIcon()'s completion handler gets called 4 https://bugs.webkit.org/show_bug.cgi?id=187007 5 <rdar://problem/41293989> 6 7 Reviewed by Brady Eidson. 8 9 Make sure API::IconLoadingClient::getLoadDecisionForIcon()'s completion handler gets called by 10 switching its type to WTF::CompletionHandler instead of WTF::Function. This also has the benefit 11 of destroying our captured objects when the completion handler gets called by the client on the 12 main thread instead of whatever thread the ObjC block gets released on. 13 14 * UIProcess/API/APIIconLoadingClient.h: 15 (API::IconLoadingClient::getLoadDecisionForIcon): 16 * UIProcess/API/glib/WebKitIconLoadingClient.cpp: 17 * UIProcess/API/mac/WKView.mm: 18 (-[WKView maybeInstallIconLoadingClient]): 19 * UIProcess/Cocoa/IconLoadingDelegate.h: 20 * UIProcess/Cocoa/IconLoadingDelegate.mm: 21 (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon): 22 1 23 2018-06-25 Youenn Fablet <youenn@apple.com> 2 24 -
trunk/Source/WebKit/UIProcess/API/APIIconLoadingClient.h
r218457 r233165 28 28 #include "GenericCallback.h" 29 29 #include <WebCore/LinkIcon.h> 30 #include <wtf/CompletionHandler.h> 30 31 #include <wtf/Function.h> 31 32 … … 40 41 virtual ~IconLoadingClient() { } 41 42 42 virtual void getLoadDecisionForIcon(const WebCore::LinkIcon&, WTF::Function<void (WTF::Function<void (API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) { 43 virtual void getLoadDecisionForIcon(const WebCore::LinkIcon&, WTF::CompletionHandler<void(WTF::Function<void(API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) 44 { 43 45 completionHandler(nullptr); 44 46 } -
trunk/Source/WebKit/UIProcess/API/glib/WebKitIconLoadingClient.cpp
r219905 r233165 34 34 35 35 private: 36 void getLoadDecisionForIcon(const WebCore::LinkIcon& icon, Function<void (Function<void(API::Data*, CallbackBase::Error)>&&)>&& completionHandler) override36 void getLoadDecisionForIcon(const WebCore::LinkIcon& icon, CompletionHandler<void(Function<void(API::Data*, CallbackBase::Error)>&&)>&& completionHandler) override 37 37 { 38 38 // WebCore can send non HTTP icons. -
trunk/Source/WebKit/UIProcess/API/mac/WKView.mm
r232523 r233165 884 884 typedef void (^IconLoadCompletionHandler)(NSData*); 885 885 886 void getLoadDecisionForIcon(const WebCore::LinkIcon& linkIcon, WTF::Function<void (WTF::Function<void (API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) override { 886 void getLoadDecisionForIcon(const WebCore::LinkIcon& linkIcon, WTF::CompletionHandler<void(WTF::Function<void(API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) override 887 { 887 888 RetainPtr<_WKLinkIconParameters> parameters = adoptNS([[_WKLinkIconParameters alloc] _initWithLinkIcon:linkIcon]); 888 889 889 890 [m_wkView performSelector:delegateSelector() withObject:parameters.get() withObject:BlockPtr<void (IconLoadCompletionHandler)>::fromCallable([completionHandler = WTFMove(completionHandler)](IconLoadCompletionHandler loadCompletionHandler) { 891 ASSERT(RunLoop::isMain()); 890 892 if (loadCompletionHandler) { 891 893 completionHandler([loadCompletionHandler = BlockPtr<void (NSData *)>(loadCompletionHandler)](API::Data* data, WebKit::CallbackBase::Error error) { -
trunk/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.h
r232082 r233165 56 56 57 57 private: 58 void getLoadDecisionForIcon(const WebCore::LinkIcon&, WTF:: Function<void (WTF::Function<void (API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) override;58 void getLoadDecisionForIcon(const WebCore::LinkIcon&, WTF::CompletionHandler<void(WTF::Function<void(API::Data*, WebKit::CallbackBase::Error)>&&)>&&) override; 59 59 60 60 IconLoadingDelegate& m_iconLoadingDelegate; -
trunk/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm
r218457 r233165 73 73 typedef void (^IconLoadCompletionHandler)(NSData*); 74 74 75 void IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon(const WebCore::LinkIcon& linkIcon, WTF:: Function<void (WTF::Function<void(API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler)75 void IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon(const WebCore::LinkIcon& linkIcon, WTF::CompletionHandler<void(WTF::Function<void(API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) 76 76 { 77 77 if (!m_iconLoadingDelegate.m_delegateMethods.webViewShouldLoadIconWithParametersCompletionHandler) { … … 89 89 90 90 [delegate webView:m_iconLoadingDelegate.m_webView shouldLoadIconWithParameters:parameters.get() completionHandler:BlockPtr<void (IconLoadCompletionHandler loadCompletionHandler)>::fromCallable([completionHandler = WTFMove(completionHandler)] (IconLoadCompletionHandler loadCompletionHandler) { 91 ASSERT(RunLoop::isMain()); 91 92 if (loadCompletionHandler) { 92 93 completionHandler([loadCompletionHandler = Block_copy(loadCompletionHandler)](API::Data* data, WebKit::CallbackBase::Error error) {
Note: See TracChangeset
for help on using the changeset viewer.