WebKit Bugzilla
Attachment 343515 Details for
Bug 187007
: Make sure API::IconLoadingClient::getLoadDecisionForIcon()'s completion handler gets called
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187007-20180625105608.patch (text/plain), 7.37 KB, created by
Chris Dumez
on 2018-06-25 10:56:09 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2018-06-25 10:56:09 PDT
Size:
7.37 KB
patch
obsolete
>Subversion Revision: 233146 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 542a83de155e76a30f1d8e3b9140de335fdcd7bf..53e01a4407d5fffe93566dc4a1b4cbcfd4866ec7 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,25 @@ >+2018-06-25 Chris Dumez <cdumez@apple.com> >+ >+ Make sure API::IconLoadingClient::getLoadDecisionForIcon()'s completion handler gets called >+ https://bugs.webkit.org/show_bug.cgi?id=187007 >+ <rdar://problem/41293989> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make sure API::IconLoadingClient::getLoadDecisionForIcon()'s completion handler gets called by >+ switching its type to WTF::CompletionHandler instead of WTF::Function. This also has the benefit >+ of destroying our captured objects when the completion handler gets called by the client on the >+ main thread instead of whatever thread the ObjC block gets released on. >+ >+ * UIProcess/API/APIIconLoadingClient.h: >+ (API::IconLoadingClient::getLoadDecisionForIcon): >+ * UIProcess/API/glib/WebKitIconLoadingClient.cpp: >+ * UIProcess/API/mac/WKView.mm: >+ (-[WKView maybeInstallIconLoadingClient]): >+ * UIProcess/Cocoa/IconLoadingDelegate.h: >+ * UIProcess/Cocoa/IconLoadingDelegate.mm: >+ (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon): >+ > 2018-06-24 Michael Catanzaro <mcatanzaro@igalia.com> > > Unreviewed, fix GTK debug build after r233131 >diff --git a/Source/WebKit/UIProcess/API/APIIconLoadingClient.h b/Source/WebKit/UIProcess/API/APIIconLoadingClient.h >index bd697e82441e2cb544f2e1e16d3a4bc900b66cd6..6f9e7af9c9809233b6a565ec3e380be0aacd567e 100644 >--- a/Source/WebKit/UIProcess/API/APIIconLoadingClient.h >+++ b/Source/WebKit/UIProcess/API/APIIconLoadingClient.h >@@ -27,6 +27,7 @@ > > #include "GenericCallback.h" > #include <WebCore/LinkIcon.h> >+#include <wtf/CompletionHandler.h> > #include <wtf/Function.h> > > namespace IPC { >@@ -39,7 +40,8 @@ class IconLoadingClient { > public: > virtual ~IconLoadingClient() { } > >- virtual void getLoadDecisionForIcon(const WebCore::LinkIcon&, WTF::Function<void (WTF::Function<void (API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) { >+ virtual void getLoadDecisionForIcon(const WebCore::LinkIcon&, WTF::CompletionHandler<void(WTF::Function<void(API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) >+ { > completionHandler(nullptr); > } > }; >diff --git a/Source/WebKit/UIProcess/API/glib/WebKitIconLoadingClient.cpp b/Source/WebKit/UIProcess/API/glib/WebKitIconLoadingClient.cpp >index 6599d5fa67292fc9da257d950ab56b9044b25dc0..b8f01fb24ff27654c0ad609add324195ee41ca59 100644 >--- a/Source/WebKit/UIProcess/API/glib/WebKitIconLoadingClient.cpp >+++ b/Source/WebKit/UIProcess/API/glib/WebKitIconLoadingClient.cpp >@@ -33,7 +33,7 @@ public: > } > > private: >- void getLoadDecisionForIcon(const WebCore::LinkIcon& icon, Function<void (Function<void (API::Data*, CallbackBase::Error)>&&)>&& completionHandler) override >+ void getLoadDecisionForIcon(const WebCore::LinkIcon& icon, CompletionHandler<void(Function<void(API::Data*, CallbackBase::Error)>&&)>&& completionHandler) override > { > // WebCore can send non HTTP icons. > if (!icon.url.protocolIsInHTTPFamily()) { >diff --git a/Source/WebKit/UIProcess/API/mac/WKView.mm b/Source/WebKit/UIProcess/API/mac/WKView.mm >index f68e9815c18873e2efa30ef2af981f79891e0cd4..a18e0fb780fef5c5d61fc02ac82c1b92c8d5850e 100644 >--- a/Source/WebKit/UIProcess/API/mac/WKView.mm >+++ b/Source/WebKit/UIProcess/API/mac/WKView.mm >@@ -883,10 +883,12 @@ - (void)maybeInstallIconLoadingClient > private: > typedef void (^IconLoadCompletionHandler)(NSData*); > >- void getLoadDecisionForIcon(const WebCore::LinkIcon& linkIcon, WTF::Function<void (WTF::Function<void (API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) override { >+ void getLoadDecisionForIcon(const WebCore::LinkIcon& linkIcon, WTF::CompletionHandler<void(WTF::Function<void(API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) override >+ { > RetainPtr<_WKLinkIconParameters> parameters = adoptNS([[_WKLinkIconParameters alloc] _initWithLinkIcon:linkIcon]); > > [m_wkView performSelector:delegateSelector() withObject:parameters.get() withObject:BlockPtr<void (IconLoadCompletionHandler)>::fromCallable([completionHandler = WTFMove(completionHandler)](IconLoadCompletionHandler loadCompletionHandler) { >+ ASSERT(RunLoop::isMain()); > if (loadCompletionHandler) { > completionHandler([loadCompletionHandler = BlockPtr<void (NSData *)>(loadCompletionHandler)](API::Data* data, WebKit::CallbackBase::Error error) { > if (error != CallbackBase::Error::None || !data) >diff --git a/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.h b/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.h >index f89fa0ce715fbc7a5244463da5b30fdb2f169a05..4cbb5d2f25bf8514d0e545d020c77374ae84e8ea 100644 >--- a/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.h >+++ b/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.h >@@ -55,7 +55,7 @@ private: > ~IconLoadingClient(); > > private: >- void getLoadDecisionForIcon(const WebCore::LinkIcon&, WTF::Function<void (WTF::Function<void (API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) override; >+ void getLoadDecisionForIcon(const WebCore::LinkIcon&, WTF::CompletionHandler<void(WTF::Function<void(API::Data*, WebKit::CallbackBase::Error)>&&)>&&) override; > > IconLoadingDelegate& m_iconLoadingDelegate; > }; >diff --git a/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm b/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm >index 48b812dc26a94a46a135f69dbd85555b12a614b6..819bbbd9ddd9fe464b34067237e7704eec7a7582 100644 >--- a/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm >+++ b/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm >@@ -72,7 +72,7 @@ IconLoadingDelegate::IconLoadingClient::~IconLoadingClient() > > typedef void (^IconLoadCompletionHandler)(NSData*); > >-void IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon(const WebCore::LinkIcon& linkIcon, WTF::Function<void (WTF::Function<void (API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) >+void IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon(const WebCore::LinkIcon& linkIcon, WTF::CompletionHandler<void(WTF::Function<void(API::Data*, WebKit::CallbackBase::Error)>&&)>&& completionHandler) > { > if (!m_iconLoadingDelegate.m_delegateMethods.webViewShouldLoadIconWithParametersCompletionHandler) { > completionHandler(nullptr); >@@ -88,6 +88,7 @@ void IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon(const WebCor > RetainPtr<_WKLinkIconParameters> parameters = adoptNS([[_WKLinkIconParameters alloc] _initWithLinkIcon:linkIcon]); > > [delegate webView:m_iconLoadingDelegate.m_webView shouldLoadIconWithParameters:parameters.get() completionHandler:BlockPtr<void (IconLoadCompletionHandler loadCompletionHandler)>::fromCallable([completionHandler = WTFMove(completionHandler)] (IconLoadCompletionHandler loadCompletionHandler) { >+ ASSERT(RunLoop::isMain()); > if (loadCompletionHandler) { > completionHandler([loadCompletionHandler = Block_copy(loadCompletionHandler)](API::Data* data, WebKit::CallbackBase::Error error) { > if (error != CallbackBase::Error::None || !data)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187007
: 343515