Changeset 268269 in webkit
- Timestamp:
- Oct 9, 2020, 11:03:20 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r268268 r268269 1 2020-10-09 Alex Christensen <achristensen@webkit.org> 2 3 Merge DownloadProxy::DidReceiveResponse and DownloadProxy::DecideDestinationWithSuggestedFilename into one message 4 https://bugs.webkit.org/show_bug.cgi?id=217519 5 6 Reviewed by Youenn Fablet. 7 8 No change in behavior. The current API has them as separate callbacks so we can have them as separate messages, 9 but future API probably won't, so let's merge them. 10 11 * NetworkProcess/NetworkProcess.cpp: 12 (WebKit::NetworkProcess::findPendingDownloadLocation): 13 * UIProcess/API/APIDownloadClient.h: 14 (API::DownloadClient::didReceiveAuthenticationChallenge): 15 (API::DownloadClient::decideDestinationWithSuggestedFilename): 16 (API::DownloadClient::didReceiveResponse): Deleted. 17 * UIProcess/API/C/WKContext.cpp: 18 (WKContextSetDownloadClient): 19 * UIProcess/Cocoa/LegacyDownloadClient.h: 20 * UIProcess/Cocoa/LegacyDownloadClient.mm: 21 (WebKit::LegacyDownloadClient::decideDestinationWithSuggestedFilename): 22 * UIProcess/Downloads/DownloadProxy.cpp: 23 (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): 24 (WebKit::DownloadProxy::didReceiveResponse): Deleted. 25 * UIProcess/Downloads/DownloadProxy.h: 26 * UIProcess/Downloads/DownloadProxy.messages.in: 27 1 28 2020-10-09 Kate Cheney <katherine_cheney@apple.com> 2 29 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r268261 r268269 2092 2092 { 2093 2093 uint64_t destinationID = networkDataTask.pendingDownloadID().toUInt64(); 2094 downloadProxyConnection()->send(Messages::DownloadProxy::DidReceiveResponse(response), destinationID);2095 2094 2096 2095 // As per https://html.spec.whatwg.org/#as-a-download (step 2), the filename from the Content-Disposition header … … 2099 2098 suggestedFilename = MIMETypeRegistry::appendFileExtensionIfNecessary(suggestedFilename, response.mimeType()); 2100 2099 2101 downloadProxyConnection()->sendWithAsyncReply(Messages::DownloadProxy::DecideDestinationWithSuggestedFilename( suggestedFilename), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler), networkDataTask = makeRef(networkDataTask)] (String&& destination, SandboxExtension::Handle&& sandboxExtensionHandle, AllowOverwrite allowOverwrite) mutable {2100 downloadProxyConnection()->sendWithAsyncReply(Messages::DownloadProxy::DecideDestinationWithSuggestedFilename(response, suggestedFilename), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler), networkDataTask = makeRef(networkDataTask)] (String&& destination, SandboxExtension::Handle&& sandboxExtensionHandle, AllowOverwrite allowOverwrite) mutable { 2102 2101 auto downloadID = networkDataTask->pendingDownloadID(); 2103 2102 if (destination.isEmpty()) -
trunk/Source/WebKit/UIProcess/API/APIDownloadClient.h
r268065 r268269 57 57 virtual void didStart(WebKit::DownloadProxy&) { } 58 58 virtual void didReceiveAuthenticationChallenge(WebKit::DownloadProxy&, WebKit::AuthenticationChallengeProxy& challenge) { challenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::Cancel); } 59 virtual void didReceiveResponse(WebKit::DownloadProxy&, const WebCore::ResourceResponse&) { }60 59 virtual void didReceiveData(WebKit::DownloadProxy&, uint64_t, uint64_t, uint64_t) { } 61 virtual void decideDestinationWithSuggestedFilename(WebKit::DownloadProxy&, const W TF::String&, Function<void(WebKit::AllowOverwrite, WTF::String)>&& completionHandler) { completionHandler(WebKit::AllowOverwrite::No, { }); }60 virtual void decideDestinationWithSuggestedFilename(WebKit::DownloadProxy&, const WebCore::ResourceResponse&, const WTF::String&, CompletionHandler<void(WebKit::AllowOverwrite, WTF::String)>&& completionHandler) { completionHandler(WebKit::AllowOverwrite::No, { }); } 62 61 virtual void didCreateDestination(WebKit::DownloadProxy&, const WTF::String&) { } 63 62 virtual void didFinish(WebKit::DownloadProxy&) { } -
trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp
r268065 r268269 191 191 m_client.didReceiveAuthenticationChallenge(m_context, WebKit::toAPI(&downloadProxy), WebKit::toAPI(&authenticationChallengeProxy), m_client.base.clientInfo); 192 192 } 193 void didReceiveResponse(WebKit::DownloadProxy& downloadProxy, const WebCore::ResourceResponse& response) final193 void didReceiveResponse(WebKit::DownloadProxy& downloadProxy, const WebCore::ResourceResponse& response) 194 194 { 195 195 if (!m_client.didReceiveResponse) … … 203 203 m_client.didReceiveData(m_context, WebKit::toAPI(&downloadProxy), length, m_client.base.clientInfo); 204 204 } 205 void decideDestinationWithSuggestedFilename(WebKit::DownloadProxy& downloadProxy, const String& filename, Function<void(WebKit::AllowOverwrite, WTF::String)>&& completionHandler) final 206 { 205 void decideDestinationWithSuggestedFilename(WebKit::DownloadProxy& downloadProxy, const WebCore::ResourceResponse& response, const String& filename, CompletionHandler<void(WebKit::AllowOverwrite, WTF::String)>&& completionHandler) final 206 { 207 didReceiveResponse(downloadProxy, response); 207 208 if (!m_client.decideDestinationWithSuggestedFilename) 208 209 return completionHandler(WebKit::AllowOverwrite::No, { }); -
trunk/Source/WebKit/UIProcess/API/glib/WebKitDownloadClient.cpp
r268065 r268269 71 71 } 72 72 73 void didReceiveResponse(DownloadProxy& downloadProxy, const ResourceResponse& resourceResponse) override73 void didReceiveResponse(DownloadProxy& downloadProxy, const ResourceResponse& resourceResponse) 74 74 { 75 75 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); … … 87 87 } 88 88 89 void decideDestinationWithSuggestedFilename(DownloadProxy& downloadProxy, const String& filename, Function<void(AllowOverwrite, String)>&& completionHandler) override89 void decideDestinationWithSuggestedFilename(DownloadProxy& downloadProxy, const ResourceResponse& resourceResponse, const String& filename, CompletionHandler<void(AllowOverwrite, String)>&& completionHandler) override 90 90 { 91 didReceiveResponse(downloadProxy, resourceResponse); 91 92 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); 92 93 bool allowOverwrite = false; -
trunk/Source/WebKit/UIProcess/Cocoa/LegacyDownloadClient.h
r268065 r268269 48 48 // From API::DownloadClient 49 49 void didStart(DownloadProxy&) final; 50 void didReceiveResponse(DownloadProxy&, const WebCore::ResourceResponse&) final;50 void didReceiveResponse(DownloadProxy&, const WebCore::ResourceResponse&); 51 51 void didReceiveData(DownloadProxy&, uint64_t, uint64_t, uint64_t) final; 52 void decideDestinationWithSuggestedFilename(DownloadProxy&, const String& suggestedFilename, Function<void(AllowOverwrite, String)>&&) final;52 void decideDestinationWithSuggestedFilename(DownloadProxy&, const WebCore::ResourceResponse&, const String& suggestedFilename, CompletionHandler<void(AllowOverwrite, String)>&&) final; 53 53 void didFinish(DownloadProxy&) final; 54 54 void didFail(DownloadProxy&, const WebCore::ResourceError&) final; -
trunk/Source/WebKit/UIProcess/Cocoa/LegacyDownloadClient.mm
r268065 r268269 186 186 } 187 187 188 void LegacyDownloadClient::decideDestinationWithSuggestedFilename(DownloadProxy& downloadProxy, const String& filename, Function<void(AllowOverwrite, String)>&& completionHandler) 189 { 188 void LegacyDownloadClient::decideDestinationWithSuggestedFilename(DownloadProxy& downloadProxy, const WebCore::ResourceResponse& response, const String& filename, CompletionHandler<void(AllowOverwrite, String)>&& completionHandler) 189 { 190 didReceiveResponse(downloadProxy, response); 191 190 192 #if USE(SYSTEM_PREVIEW) 191 193 if (downloadProxy.isSystemPreviewDownload()) { … … 207 209 completionHandler(allowOverwrite ? AllowOverwrite::Yes : AllowOverwrite::No, destination); 208 210 } else { 209 [m_delegate _download:wrapper(downloadProxy) decideDestinationWithSuggestedFilename:filename completionHandler:makeBlockPtr([checker = CompletionHandlerCallChecker::create(m_delegate.get().get(), @selector(_download:decideDestinationWithSuggestedFilename:completionHandler:)), completionHandler = WTFMove(completionHandler)] (BOOL allowOverwrite, NSString *destination) {211 [m_delegate _download:wrapper(downloadProxy) decideDestinationWithSuggestedFilename:filename completionHandler:makeBlockPtr([checker = CompletionHandlerCallChecker::create(m_delegate.get().get(), @selector(_download:decideDestinationWithSuggestedFilename:completionHandler:)), completionHandler = WTFMove(completionHandler)] (BOOL allowOverwrite, NSString *destination) mutable { 210 212 if (checker->completionHandlerHasBeenCalled()) 211 213 return; -
trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp
r268261 r268269 140 140 } 141 141 142 void DownloadProxy::didReceiveResponse(const ResourceResponse& response)143 {144 m_client->didReceiveResponse(*this, response);145 }146 147 142 void DownloadProxy::didReceiveData(uint64_t bytesWritten, uint64_t totalBytesWritten, uint64_t totalBytesExpectedToWrite) 148 143 { … … 150 145 } 151 146 152 void DownloadProxy::decideDestinationWithSuggestedFilename(const String& suggestedFilename, CompletionHandler<void(String, SandboxExtension::Handle, AllowOverwrite)>&& completionHandler)147 void DownloadProxy::decideDestinationWithSuggestedFilename(const WebCore::ResourceResponse& response, const String& suggestedFilename, CompletionHandler<void(String, SandboxExtension::Handle, AllowOverwrite)>&& completionHandler) 153 148 { 154 m_client->decideDestinationWithSuggestedFilename(*this, ResourceResponseBase::sanitizeSuggestedFilename(suggestedFilename), [completionHandler = WTFMove(completionHandler)] (AllowOverwrite allowOverwrite, String destination) mutable {149 m_client->decideDestinationWithSuggestedFilename(*this, response, ResourceResponseBase::sanitizeSuggestedFilename(suggestedFilename), [completionHandler = WTFMove(completionHandler)] (AllowOverwrite allowOverwrite, String destination) mutable { 155 150 SandboxExtension::Handle sandboxExtensionHandle; 156 151 if (!destination.isNull()) -
trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.h
r268261 r268269 111 111 void didStart(const WebCore::ResourceRequest&, const String& suggestedFilename); 112 112 void didReceiveAuthenticationChallenge(WebCore::AuthenticationChallenge&&, uint64_t challengeID); 113 void didReceiveResponse(const WebCore::ResourceResponse&);114 113 void didReceiveData(uint64_t bytesWritten, uint64_t totalBytesWritten, uint64_t totalBytesExpectedToWrite); 115 114 void shouldDecodeSourceDataOfMIMEType(const String& mimeType, bool& result); … … 118 117 void didFail(const WebCore::ResourceError&, const IPC::DataReference& resumeData); 119 118 void willSendRequest(WebCore::ResourceRequest&& redirectRequest, const WebCore::ResourceResponse& redirectResponse); 120 void decideDestinationWithSuggestedFilename(const String& suggestedFilename, CompletionHandler<void(String, SandboxExtension::Handle, AllowOverwrite)>&&);119 void decideDestinationWithSuggestedFilename(const WebCore::ResourceResponse&, const String& suggestedFilename, CompletionHandler<void(String, SandboxExtension::Handle, AllowOverwrite)>&&); 121 120 122 121 DownloadProxyMap& m_downloadProxyMap; -
trunk/Source/WebKit/UIProcess/Downloads/DownloadProxy.messages.in
r268261 r268269 25 25 DidReceiveAuthenticationChallenge(WebCore::AuthenticationChallenge challenge, uint64_t challengeID) 26 26 WillSendRequest(WebCore::ResourceRequest redirectRequest, WebCore::ResourceResponse redirectResponse)) 27 DecideDestinationWithSuggestedFilename( String suggestedFilename) -> (String filename, WebKit::SandboxExtension::Handle handle, enum:bool WebKit::AllowOverwrite allowOverwrite) Async27 DecideDestinationWithSuggestedFilename(WebCore::ResourceResponse response, String suggestedFilename) -> (String filename, WebKit::SandboxExtension::Handle handle, enum:bool WebKit::AllowOverwrite allowOverwrite) Async 28 28 29 DidReceiveResponse(WebCore::ResourceResponse response)30 29 DidReceiveData(uint64_t bytesWritten, uint64_t totalBytesWritten, uint64_t totalBytesExpectedToWrite) 31 30 DidCreateDestination(String path)
Note:
See TracChangeset
for help on using the changeset viewer.