Source/WebKit2/ChangeLog

112016-06-14 Chris Dumez <cdumez@apple.com>
22
 3 Avoid constructing a AuthenticationChallenge unnecessarily in the NetworkLoad constructor
 4 https://bugs.webkit.org/show_bug.cgi?id=158746
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Avoid constructing a AuthenticationChallenge unnecessarily in the
 9 NetworkLoad constructor by using WTF::Optional<> for this data
 10 member.
 11
 12 * NetworkProcess/NetworkLoad.cpp:
 13 (WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
 14 * NetworkProcess/NetworkLoad.h:
 15
 162016-06-14 Chris Dumez <cdumez@apple.com>
 17
318 Reduce copying of NetworkLoadParameters
419 https://bugs.webkit.org/show_bug.cgi?id=158744
520

Source/WebKit2/NetworkProcess/NetworkLoad.cpp

@@void NetworkLoad::continueCanAuthenticateAgainstProtectionSpace(bool result)
359359 ASSERT(m_challengeCompletionHandler);
360360 auto completionHandler = std::exchange(m_challengeCompletionHandler, nullptr);
361361 if (!result) {
362  if (m_task && m_task->allowsSpecificHTTPSCertificateForHost(m_challenge))
363  completionHandler(AuthenticationChallengeDisposition::UseCredential, serverTrustCredential(m_challenge));
 362 if (m_task && m_task->allowsSpecificHTTPSCertificateForHost(*m_challenge))
 363 completionHandler(AuthenticationChallengeDisposition::UseCredential, serverTrustCredential(*m_challenge));
364364 else
365365 completionHandler(AuthenticationChallengeDisposition::RejectProtectionSpace, { });
366366 return;
367367 }
368368
369  if (m_challenge.protectionSpace().authenticationScheme() == ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested) {
370  completionHandler(AuthenticationChallengeDisposition::UseCredential, serverTrustCredential(m_challenge));
 369 if (m_challenge->protectionSpace().authenticationScheme() == ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested) {
 370 completionHandler(AuthenticationChallengeDisposition::UseCredential, serverTrustCredential(*m_challenge));
371371 return;
372372 }
373373

@@void NetworkLoad::continueCanAuthenticateAgainstProtectionSpace(bool result)
378378
379379 if (m_task) {
380380 if (auto* pendingDownload = m_task->pendingDownload())
381  NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(*pendingDownload, m_challenge, completionHandler);
 381 NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(*pendingDownload, *m_challenge, completionHandler);
382382 else
383  NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.webPageID, m_parameters.webFrameID, m_challenge, completionHandler);
 383 NetworkProcess::singleton().authenticationManager().didReceiveAuthenticationChallenge(m_parameters.webPageID, m_parameters.webFrameID, *m_challenge, completionHandler);
384384 }
385385#endif
386386 if (m_handle)

Source/WebKit2/NetworkProcess/NetworkLoad.h

3030#include "NetworkLoadParameters.h"
3131#include "RemoteNetworkingContext.h"
3232#include <WebCore/ResourceHandleClient.h>
 33#include <wtf/Optional.h>
3334
3435#if USE(NETWORK_SESSION)
3536#include "DownloadID.h"

@@private:
123124 const NetworkLoadParameters m_parameters;
124125#if USE(NETWORK_SESSION)
125126 RefPtr<NetworkDataTask> m_task;
126  WebCore::AuthenticationChallenge m_challenge;
 127 Optional<WebCore::AuthenticationChallenge> m_challenge;
127128 ChallengeCompletionHandler m_challengeCompletionHandler;
128129 ResponseCompletionHandler m_responseCompletionHandler;
129130 RedirectCompletionHandler m_redirectCompletionHandler;