Diff
Modified: trunk/Source/WebKit2/ChangeLog (202183 => 202184)
--- trunk/Source/WebKit2/ChangeLog 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/ChangeLog 2016-06-17 23:27:28 UTC (rev 202184)
@@ -1,3 +1,45 @@
+2016-06-17 Chris Dumez <cdu...@apple.com>
+
+ Use WTF::NoncopyableFunction in NetworkDataTaskClient
+ https://bugs.webkit.org/show_bug.cgi?id=158887
+
+ Reviewed by Alex Christensen.
+
+ Use WTF::NoncopyableFunction in NetworkDataTaskClient instead of std::function
+ and consistently move it around. This avoids some unnecessary copying.
+
+ * NetworkProcess/Downloads/DownloadManager.cpp:
+ (WebKit::DownloadManager::willDecidePendingDownloadDestination):
+ (WebKit::DownloadManager::continueDecidePendingDownloadDestination):
+ * NetworkProcess/Downloads/DownloadManager.h:
+ * NetworkProcess/NetworkDataTask.h:
+ * NetworkProcess/NetworkLoad.cpp:
+ (WebKit::NetworkLoad::willPerformHTTPRedirection):
+ (WebKit::NetworkLoad::didReceiveChallenge):
+ (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
+ (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
+ * NetworkProcess/NetworkLoad.h:
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::findPendingDownloadLocation):
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/PingLoad.h:
+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+ (WebKit::NetworkDataTask::didReceiveChallenge):
+ (WebKit::NetworkDataTask::didReceiveResponse):
+ (WebKit::NetworkDataTask::willPerformHTTPRedirection):
+ (WebKit::NetworkDataTask::tryPasswordBasedAuthentication):
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
+ * Shared/Authentication/AuthenticationManager.cpp:
+ (WebKit::AuthenticationManager::addChallengeToChallengeMap):
+ (WebKit::AuthenticationManager::coalesceChallengesMatching):
+ (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
+ (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
+ (WebKit::AuthenticationManager::useCredentialForSingleChallenge):
+ * Shared/Authentication/AuthenticationManager.h:
+ * Shared/Authentication/mac/AuthenticationManager.mac.mm:
+ (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
+
2016-06-17 Antoine Quint <grao...@apple.com>
Web video playback controls should have RTL volume slider
Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp 2016-06-17 23:27:28 UTC (rev 202184)
@@ -95,7 +95,7 @@
pendingDownload->continueWillSendRequest(WTFMove(request));
}
-void DownloadManager::willDecidePendingDownloadDestination(NetworkDataTask& networkDataTask, ResponseCompletionHandler completionHandler)
+void DownloadManager::willDecidePendingDownloadDestination(NetworkDataTask& networkDataTask, ResponseCompletionHandler&& completionHandler)
{
auto downloadID = networkDataTask.pendingDownloadID();
auto pendingDownload = m_pendingDownloads.take(downloadID);
@@ -107,8 +107,8 @@
void DownloadManager::continueDecidePendingDownloadDestination(DownloadID downloadID, String destination, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite)
{
auto pair = m_downloadsWaitingForDestination.take(downloadID);
- auto networkDataTask = pair.first;
- auto completionHandler = pair.second;
+ auto networkDataTask = WTFMove(pair.first);
+ auto completionHandler = WTFMove(pair.second);
if (!networkDataTask || !completionHandler)
return;
Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h 2016-06-17 23:27:28 UTC (rev 202184)
@@ -79,7 +79,7 @@
std::pair<RefPtr<NetworkDataTask>, std::unique_ptr<PendingDownload>> dataTaskBecameDownloadTask(DownloadID, std::unique_ptr<Download>&&);
void continueCanAuthenticateAgainstProtectionSpace(DownloadID, bool canAuthenticate);
void continueWillSendRequest(DownloadID, WebCore::ResourceRequest&&);
- void willDecidePendingDownloadDestination(NetworkDataTask&, ResponseCompletionHandler);
+ void willDecidePendingDownloadDestination(NetworkDataTask&, ResponseCompletionHandler&&);
void continueDecidePendingDownloadDestination(DownloadID, String destination, const SandboxExtension::Handle&, bool allowOverwrite);
#else
void convertHandleToDownload(DownloadID, WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.h (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.h 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkDataTask.h 2016-06-17 23:27:28 UTC (rev 202184)
@@ -33,6 +33,7 @@
#include <WebCore/ResourceLoaderOptions.h>
#include <WebCore/ResourceRequest.h>
#include <WebCore/Timer.h>
+#include <wtf/NoncopyableFunction.h>
#include <wtf/RetainPtr.h>
#include <wtf/text/WTFString.h>
@@ -62,15 +63,15 @@
RejectProtectionSpace
};
-typedef std::function<void(const WebCore::ResourceRequest&)> RedirectCompletionHandler;
-typedef std::function<void(AuthenticationChallengeDisposition, const WebCore::Credential&)> ChallengeCompletionHandler;
-typedef std::function<void(WebCore::PolicyAction)> ResponseCompletionHandler;
+typedef NoncopyableFunction<void(const WebCore::ResourceRequest&)> RedirectCompletionHandler;
+typedef NoncopyableFunction<void(AuthenticationChallengeDisposition, const WebCore::Credential&)> ChallengeCompletionHandler;
+typedef NoncopyableFunction<void(WebCore::PolicyAction)> ResponseCompletionHandler;
class NetworkDataTaskClient {
public:
- virtual void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler) = 0;
- virtual void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler) = 0;
- virtual void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler) = 0;
+ virtual void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&&) = 0;
+ virtual void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&) = 0;
+ virtual void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler&&) = 0;
virtual void didReceiveData(Ref<WebCore::SharedBuffer>&&) = 0;
virtual void didCompleteWithError(const WebCore::ResourceError&) = 0;
virtual void didBecomeDownload() = 0;
@@ -98,9 +99,9 @@
~NetworkDataTask();
void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend);
- void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler);
+ void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&);
void didCompleteWithError(const WebCore::ResourceError&);
- void didReceiveResponse(WebCore::ResourceResponse&&, ResponseCompletionHandler);
+ void didReceiveResponse(WebCore::ResourceResponse&&, ResponseCompletionHandler&&);
void didReceiveData(Ref<WebCore::SharedBuffer>&&);
void didBecomeDownload();
@@ -126,14 +127,14 @@
const WebCore::ResourceRequest& firstRequest() const { return m_firstRequest; }
WebCore::ResourceRequest currentRequest();
String suggestedFilename();
- void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler);
+ void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&&);
void transferSandboxExtensionToDownload(Download&);
bool allowsSpecificHTTPSCertificateForHost(const WebCore::AuthenticationChallenge&);
private:
NetworkDataTask(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ContentSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect);
- bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler);
+ bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, const ChallengeCompletionHandler&);
enum FailureType {
NoFailure,
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp 2016-06-17 23:27:28 UTC (rev 202184)
@@ -205,14 +205,14 @@
m_task->setPendingDownload(pendingDownload);
}
-void NetworkLoad::willPerformHTTPRedirection(ResourceResponse&& response, ResourceRequest&& request, RedirectCompletionHandler completionHandler)
+void NetworkLoad::willPerformHTTPRedirection(ResourceResponse&& response, ResourceRequest&& request, RedirectCompletionHandler&& completionHandler)
{
ASSERT(!m_redirectCompletionHandler);
- m_redirectCompletionHandler = completionHandler;
+ m_redirectCompletionHandler = WTFMove(completionHandler);
sharedWillSendRedirectedRequest(WTFMove(request), WTFMove(response));
}
-void NetworkLoad::didReceiveChallenge(const AuthenticationChallenge& challenge, std::function<void(AuthenticationChallengeDisposition, const Credential&)> completionHandler)
+void NetworkLoad::didReceiveChallenge(const AuthenticationChallenge& challenge, ChallengeCompletionHandler&& completionHandler)
{
// NetworkResourceLoader does not know whether the request is cross origin, so Web process computes an applicable credential policy for it.
ASSERT(m_parameters.clientCredentialPolicy != DoNotAskClientForCrossOriginCredentials);
@@ -227,7 +227,7 @@
return;
}
- m_challengeCompletionHandler = completionHandler;
+ m_challengeCompletionHandler = WTFMove(completionHandler);
m_challenge = challenge;
if (m_client.isSynchronous()) {
@@ -240,15 +240,15 @@
m_client.canAuthenticateAgainstProtectionSpaceAsync(challenge.protectionSpace());
}
-void NetworkLoad::didReceiveResponseNetworkSession(ResourceResponse&& response, ResponseCompletionHandler completionHandler)
+void NetworkLoad::didReceiveResponseNetworkSession(ResourceResponse&& response, ResponseCompletionHandler&& completionHandler)
{
ASSERT(isMainThread());
if (m_task && m_task->pendingDownloadID().downloadID())
- NetworkProcess::singleton().findPendingDownloadLocation(*m_task.get(), completionHandler, m_task->currentRequest());
+ NetworkProcess::singleton().findPendingDownloadLocation(*m_task.get(), WTFMove(completionHandler), m_task->currentRequest());
else if (sharedDidReceiveResponse(WTFMove(response)) == NetworkLoadClient::ShouldContinueDidReceiveResponse::Yes)
completionHandler(PolicyUse);
else
- m_responseCompletionHandler = completionHandler;
+ m_responseCompletionHandler = WTFMove(completionHandler);
}
void NetworkLoad::didReceiveData(Ref<SharedBuffer>&& buffer)
@@ -380,9 +380,9 @@
if (m_task) {
if (auto* pendingDownload = m_task->pendingDownload())
- NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(*pendingDownload, *m_challenge, completionHandler);
+ NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(*pendingDownload, *m_challenge, WTFMove(completionHandler));
else
- NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.webPageID, m_parameters.webFrameID, *m_challenge, completionHandler);
+ NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.webPageID, m_parameters.webFrameID, *m_challenge, WTFMove(completionHandler));
}
#endif
if (m_handle)
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.h 2016-06-17 23:27:28 UTC (rev 202184)
@@ -66,9 +66,9 @@
DownloadID pendingDownloadID() { return m_task->pendingDownloadID(); }
// NetworkDataTaskClient
- void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler) final;
- void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler) final;
- void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler) final;
+ void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&&) final;
+ void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&) final;
+ void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler&&) final;
void didReceiveData(Ref<WebCore::SharedBuffer>&&) final;
void didCompleteWithError(const WebCore::ResourceError&) final;
void didBecomeDownload() final;
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2016-06-17 23:27:28 UTC (rev 202184)
@@ -496,12 +496,12 @@
downloadProxyConnection()->send(Messages::DownloadProxy::DidCancel({ }), downloadID.downloadID());
}
-void NetworkProcess::findPendingDownloadLocation(NetworkDataTask& networkDataTask, ResponseCompletionHandler completionHandler, const ResourceRequest& updatedRequest)
+void NetworkProcess::findPendingDownloadLocation(NetworkDataTask& networkDataTask, ResponseCompletionHandler&& completionHandler, const ResourceRequest& updatedRequest)
{
uint64_t destinationID = networkDataTask.pendingDownloadID().downloadID();
downloadProxyConnection()->send(Messages::DownloadProxy::DidStart(updatedRequest, String()), destinationID);
- downloadManager().willDecidePendingDownloadDestination(networkDataTask, completionHandler);
+ downloadManager().willDecidePendingDownloadDestination(networkDataTask, WTFMove(completionHandler));
downloadProxyConnection()->send(Messages::DownloadProxy::DecideDestinationWithSuggestedFilenameAsync(networkDataTask.pendingDownloadID(), networkDataTask.suggestedFilename()), destinationID);
}
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h 2016-06-17 23:27:28 UTC (rev 202184)
@@ -106,7 +106,7 @@
#endif
#if USE(NETWORK_SESSION)
- void findPendingDownloadLocation(NetworkDataTask&, ResponseCompletionHandler, const WebCore::ResourceRequest&);
+ void findPendingDownloadLocation(NetworkDataTask&, ResponseCompletionHandler&&, const WebCore::ResourceRequest&);
#endif
void prefetchDNS(const String&);
Modified: trunk/Source/WebKit2/NetworkProcess/PingLoad.h (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/PingLoad.h 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/PingLoad.h 2016-06-17 23:27:28 UTC (rev 202184)
@@ -48,17 +48,17 @@
}
private:
- void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler completionHandler) override
+ void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler&& completionHandler) override
{
completionHandler({ });
delete this;
}
- void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler completionHandler) override
+ void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&& completionHandler) override
{
completionHandler(AuthenticationChallengeDisposition::Cancel, { });
delete this;
}
- void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler completionHandler) override
+ void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler&& completionHandler) override
{
completionHandler(WebCore::PolicyAction::PolicyIgnore);
delete this;
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2016-06-17 23:27:28 UTC (rev 202184)
@@ -139,7 +139,7 @@
m_client->didSendData(totalBytesSent, totalBytesExpectedToSend);
}
-void NetworkDataTask::didReceiveChallenge(const WebCore::AuthenticationChallenge& challenge, ChallengeCompletionHandler completionHandler)
+void NetworkDataTask::didReceiveChallenge(const WebCore::AuthenticationChallenge& challenge, ChallengeCompletionHandler&& completionHandler)
{
// Proxy authentication is handled by CFNetwork internally. We can get here if the user cancels
// CFNetwork authentication dialog, and we shouldn't ask the client to display another one in that case.
@@ -152,7 +152,7 @@
return;
if (m_client)
- m_client->didReceiveChallenge(challenge, completionHandler);
+ m_client->didReceiveChallenge(challenge, WTFMove(completionHandler));
else {
ASSERT_NOT_REACHED();
completionHandler(AuthenticationChallengeDisposition::PerformDefaultHandling, { });
@@ -165,10 +165,10 @@
m_client->didCompleteWithError(error);
}
-void NetworkDataTask::didReceiveResponse(WebCore::ResourceResponse&& response, ResponseCompletionHandler completionHandler)
+void NetworkDataTask::didReceiveResponse(WebCore::ResourceResponse&& response, ResponseCompletionHandler&& completionHandler)
{
if (m_client)
- m_client->didReceiveResponseNetworkSession(WTFMove(response), completionHandler);
+ m_client->didReceiveResponseNetworkSession(WTFMove(response), WTFMove(completionHandler));
else {
ASSERT_NOT_REACHED();
completionHandler(WebCore::PolicyAction::PolicyIgnore);
@@ -187,7 +187,7 @@
m_client->didBecomeDownload();
}
-void NetworkDataTask::willPerformHTTPRedirection(WebCore::ResourceResponse&& redirectResponse, WebCore::ResourceRequest&& request, RedirectCompletionHandler completionHandler)
+void NetworkDataTask::willPerformHTTPRedirection(WebCore::ResourceResponse&& redirectResponse, WebCore::ResourceRequest&& request, RedirectCompletionHandler&& completionHandler)
{
if (redirectResponse.httpStatusCode() == 307 || redirectResponse.httpStatusCode() == 308) {
ASSERT(m_lastHTTPMethod == request.httpMethod());
@@ -232,7 +232,7 @@
}
if (m_client)
- m_client->willPerformHTTPRedirection(WTFMove(redirectResponse), WTFMove(request), completionHandler);
+ m_client->willPerformHTTPRedirection(WTFMove(redirectResponse), WTFMove(request), WTFMove(completionHandler));
else {
ASSERT_NOT_REACHED();
completionHandler({ });
@@ -279,7 +279,7 @@
m_task.get()._pathToDownloadTaskFile = filename;
}
-bool NetworkDataTask::tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge& challenge, ChallengeCompletionHandler completionHandler)
+bool NetworkDataTask::tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge& challenge, const ChallengeCompletionHandler& completionHandler)
{
if (!challenge.protectionSpace().isPasswordBased())
return false;
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (202183 => 202184)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-06-17 23:27:28 UTC (rev 202184)
@@ -197,7 +197,7 @@
completionHandlerCopy(toNSURLSessionAuthChallengeDisposition(disposition), credential.nsCredential());
Block_release(completionHandlerCopy);
};
- networkDataTask->didReceiveChallenge(challenge, challengeCompletionHandler);
+ networkDataTask->didReceiveChallenge(challenge, WTFMove(challengeCompletionHandler));
} else {
LOG(NetworkSession, "%llu didReceiveChallenge completionHandler (cancel)", taskIdentifier);
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, nil);
Modified: trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp (202183 => 202184)
--- trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp 2016-06-17 23:27:28 UTC (rev 202184)
@@ -68,12 +68,12 @@
m_process->addMessageReceiver(Messages::AuthenticationManager::messageReceiverName(), *this);
}
-uint64_t AuthenticationManager::addChallengeToChallengeMap(const Challenge& challenge)
+uint64_t AuthenticationManager::addChallengeToChallengeMap(Challenge&& challenge)
{
ASSERT(RunLoop::isMain());
uint64_t challengeID = generateAuthenticationChallengeID();
- m_challenges.set(challengeID, challenge);
+ m_challenges.set(challengeID, WTFMove(challenge));
return challengeID;
}
@@ -91,9 +91,11 @@
Vector<uint64_t> AuthenticationManager::coalesceChallengesMatching(uint64_t challengeID) const
{
- auto challenge = m_challenges.get(challengeID);
- ASSERT(!challenge.challenge.isNull());
+ auto iterator = m_challenges.find(challengeID);
+ ASSERT(iterator != m_challenges.end());
+ auto& challenge = iterator->value;
+
Vector<uint64_t> challengesToCoalesce;
challengesToCoalesce.append(challengeID);
@@ -128,12 +130,12 @@
}
#if USE(NETWORK_SESSION)
-void AuthenticationManager::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler completionHandler)
+void AuthenticationManager::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler&& completionHandler)
{
ASSERT(pageID);
ASSERT(frameID);
- uint64_t challengeID = addChallengeToChallengeMap({pageID, authenticationChallenge, completionHandler});
+ uint64_t challengeID = addChallengeToChallengeMap({ pageID, authenticationChallenge, WTFMove(completionHandler) });
// Coalesce challenges in the same protection space and in the same page.
if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
@@ -142,10 +144,10 @@
m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
}
-void AuthenticationManager::didReceiveAuthenticationChallenge(PendingDownload& pendingDownload, const WebCore::AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler completionHandler)
+void AuthenticationManager::didReceiveAuthenticationChallenge(PendingDownload& pendingDownload, const WebCore::AuthenticationChallenge& authenticationChallenge, ChallengeCompletionHandler&& completionHandler)
{
uint64_t dummyPageID = 0;
- uint64_t challengeID = addChallengeToChallengeMap({dummyPageID, authenticationChallenge, completionHandler});
+ uint64_t challengeID = addChallengeToChallengeMap({ dummyPageID, authenticationChallenge, WTFMove(completionHandler) });
// Coalesce challenges in the same protection space and in the same page.
if (shouldCoalesceChallenge(dummyPageID, challengeID, authenticationChallenge))
@@ -188,7 +190,7 @@
// Currently, only Mac knows how to respond to authentication challenges with certificate info.
#if !HAVE(SEC_IDENTITY)
-bool AuthenticationManager::tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const CertificateInfo&, ChallengeCompletionHandler)
+bool AuthenticationManager::tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const CertificateInfo&, const ChallengeCompletionHandler&)
{
return false;
}
@@ -208,7 +210,7 @@
ASSERT(!challenge.challenge.isNull());
#if USE(NETWORK_SESSION)
- auto completionHandler = challenge.completionHandler;
+ auto completionHandler = WTFMove(challenge.completionHandler);
#else
ChallengeCompletionHandler completionHandler = nullptr;
#endif
@@ -222,7 +224,7 @@
// FIXME: Remove the use of AuthenticationClient in WebKit2 once NETWORK_SESSION is used for all loads.
if (completionHandler) {
ASSERT(!coreClient);
- challenge.completionHandler(AuthenticationChallengeDisposition::UseCredential, credential);
+ completionHandler(AuthenticationChallengeDisposition::UseCredential, credential);
return;
}
#endif
Modified: trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h (202183 => 202184)
--- trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h 2016-06-17 23:27:28 UTC (rev 202184)
@@ -56,8 +56,8 @@
static const char* supplementName();
#if USE(NETWORK_SESSION)
- void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler);
- void didReceiveAuthenticationChallenge(PendingDownload&, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler);
+ void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&);
+ void didReceiveAuthenticationChallenge(PendingDownload&, const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&&);
void continueCanAuthenticateAgainstProtectionSpace(DownloadID, bool canAuthenticate);
#endif
// Called for resources in the WebProcess (NetworkProcess disabled)
@@ -94,9 +94,9 @@
// IPC::MessageReceiver
void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
- bool tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const WebCore::CertificateInfo&, ChallengeCompletionHandler);
+ bool tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const WebCore::CertificateInfo&, const ChallengeCompletionHandler&);
- uint64_t addChallengeToChallengeMap(const Challenge&);
+ uint64_t addChallengeToChallengeMap(Challenge&&);
bool shouldCoalesceChallenge(uint64_t pageID, uint64_t challengeID, const WebCore::AuthenticationChallenge&) const;
void useCredentialForSingleChallenge(uint64_t challengeID, const WebCore::Credential&, const WebCore::CertificateInfo&);
Modified: trunk/Source/WebKit2/Shared/Authentication/mac/AuthenticationManager.mac.mm (202183 => 202184)
--- trunk/Source/WebKit2/Shared/Authentication/mac/AuthenticationManager.mac.mm 2016-06-17 22:24:52 UTC (rev 202183)
+++ trunk/Source/WebKit2/Shared/Authentication/mac/AuthenticationManager.mac.mm 2016-06-17 23:27:28 UTC (rev 202184)
@@ -66,7 +66,7 @@
// FIXME: This function creates an identity from a certificate, which should not be needed. We should pass an identity over IPC (as we do on iOS).
-bool AuthenticationManager::tryUseCertificateInfoForChallenge(const AuthenticationChallenge& challenge, const CertificateInfo& certificateInfo, ChallengeCompletionHandler completionHandler)
+bool AuthenticationManager::tryUseCertificateInfoForChallenge(const AuthenticationChallenge& challenge, const CertificateInfo& certificateInfo, const ChallengeCompletionHandler& completionHandler)
{
if (certificateInfo.isEmpty())
return false;