Reduce ResourceResponse copying
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Jun 2016 22:02:55 +0000 (22:02 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Jun 2016 22:02:55 +0000 (22:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158232

Reviewed by Darin Adler.

Source/WebCore:

No new tests.  No change in behavior except removing an unnecessary copy on cocoa platforms.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didSendData):
(WebCore::ResourceLoader::didReceiveResponse):
* loader/ResourceLoader.h:
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::createResourceHandle):
(WebCore::ApplicationCacheGroup::didReceiveResponse):
* loader/appcache/ApplicationCacheGroup.h:
* platform/graphics/PlatformMediaResourceLoader.h:
(WebCore::PlatformMediaResourceClient::~PlatformMediaResourceClient):
(WebCore::PlatformMediaResourceClient::responseReceived):
(WebCore::PlatformMediaResourceClient::redirectReceived):
(WebCore::PlatformMediaResourceClient::shouldCacheResponse):
(WebCore::PlatformMediaResourceClient::dataSent):
* platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(ResourceHandleStreamingClient::willSendRequest):
(ResourceHandleStreamingClient::didReceiveResponse):
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::notifyResponseOnSuccess):
(WebCore::BlobResourceHandle::notifyResponseOnError):
(WebCore::BlobResourceHandle::notifyReceiveData):
* platform/network/DataURL.cpp:
(WebCore::handleDataURL):
* platform/network/PingHandle.h:
(WebCore::PingHandle::PingHandle):
* platform/network/ResourceHandleClient.cpp:
(WebCore::ResourceHandleClient::willSendRequestAsync):
(WebCore::ResourceHandleClient::didReceiveResponseAsync):
* platform/network/ResourceHandleClient.h:
(WebCore::ResourceHandleClient::didSendData):
(WebCore::ResourceHandleClient::didReceiveResponse):
(WebCore::ResourceHandleClient::didReceiveData):
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::ResourceResponseBase):
(WebCore::ResourceResponseBase::includeCertificateInfo):
(WebCore::ResourceResponseBase::suggestedFilename):
(WebCore::ResourceResponseBase::certificateInfo): Deleted.
* platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::certificateInfo):
(WebCore::ResourceResponseBase::encode):
(WebCore::ResourceResponseBase::decode):
(WebCore::ResourceResponseBase::containsCertificateInfo): Deleted.
* platform/network/SynchronousLoaderClient.cpp:
(WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace):
(WebCore::SynchronousLoaderClient::didReceiveResponse):
(WebCore::SynchronousLoaderClient::didReceiveData):
* platform/network/SynchronousLoaderClient.h:
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData):
* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
(-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::nextMultipartResponsePartCallback):
(WebCore::sendRequestCallback):

Source/WebKit2:

* NetworkProcess/Downloads/PendingDownload.h:
* NetworkProcess/NetworkDataTask.h:
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::continueDidReceiveResponse):
(WebKit::NetworkLoad::sharedDidReceiveResponse):
(WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
(WebKit::NetworkLoad::didReceiveChallenge):
(WebKit::NetworkLoad::didReceiveResponseNetworkSession):
(WebKit::NetworkLoad::didReceiveResponseAsync):
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/NetworkLoadClient.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::retrieveCacheEntry):
(WebKit::NetworkResourceLoader::abort):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/PingLoad.h:
* NetworkProcess/cache/NetworkCacheCoders.h:
(WebKit::NetworkCache::Coder<Optional<T>>::encode):
(WebKit::NetworkCache::Coder<Optional<T>>::decode):
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
(WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
* NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTask::didCompleteWithError):
(WebKit::NetworkDataTask::didReceiveResponse):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::url):
(WebKit::WebFrame::certificateInfo):
(WebKit::WebFrame::innerText):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@201943 268f45cc-cd09-0410-ab3c-d52691b4dbfc

37 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
Source/WebCore/loader/appcache/ApplicationCacheGroup.h
Source/WebCore/platform/graphics/PlatformMediaResourceLoader.h
Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
Source/WebCore/platform/network/BlobResourceHandle.cpp
Source/WebCore/platform/network/DataURL.cpp
Source/WebCore/platform/network/PingHandle.h
Source/WebCore/platform/network/ResourceHandleClient.cpp
Source/WebCore/platform/network/ResourceHandleClient.h
Source/WebCore/platform/network/ResourceResponseBase.cpp
Source/WebCore/platform/network/ResourceResponseBase.h
Source/WebCore/platform/network/SynchronousLoaderClient.cpp
Source/WebCore/platform/network/SynchronousLoaderClient.h
Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp
Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/Downloads/PendingDownload.h
Source/WebKit2/NetworkProcess/NetworkDataTask.h
Source/WebKit2/NetworkProcess/NetworkLoad.cpp
Source/WebKit2/NetworkProcess/NetworkLoad.h
Source/WebKit2/NetworkProcess/NetworkLoadClient.h
Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit2/NetworkProcess/NetworkResourceLoader.h
Source/WebKit2/NetworkProcess/PingLoad.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheCoders.h
Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp
Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoad.h
Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

index 41c3185..48608e7 100644 (file)
@@ -1,3 +1,73 @@
+2016-06-10  Alex Christensen  <achristensen@webkit.org>
+
+        Reduce ResourceResponse copying
+        https://bugs.webkit.org/show_bug.cgi?id=158232
+
+        Reviewed by Darin Adler.
+
+        No new tests.  No change in behavior except removing an unnecessary copy on cocoa platforms.
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::didSendData):
+        (WebCore::ResourceLoader::didReceiveResponse):
+        * loader/ResourceLoader.h:
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::createResourceHandle):
+        (WebCore::ApplicationCacheGroup::didReceiveResponse):
+        * loader/appcache/ApplicationCacheGroup.h:
+        * platform/graphics/PlatformMediaResourceLoader.h:
+        (WebCore::PlatformMediaResourceClient::~PlatformMediaResourceClient):
+        (WebCore::PlatformMediaResourceClient::responseReceived):
+        (WebCore::PlatformMediaResourceClient::redirectReceived):
+        (WebCore::PlatformMediaResourceClient::shouldCacheResponse):
+        (WebCore::PlatformMediaResourceClient::dataSent):
+        * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (ResourceHandleStreamingClient::willSendRequest):
+        (ResourceHandleStreamingClient::didReceiveResponse):
+        * platform/network/BlobResourceHandle.cpp:
+        (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
+        (WebCore::BlobResourceHandle::notifyResponseOnError):
+        (WebCore::BlobResourceHandle::notifyReceiveData):
+        * platform/network/DataURL.cpp:
+        (WebCore::handleDataURL):
+        * platform/network/PingHandle.h:
+        (WebCore::PingHandle::PingHandle):
+        * platform/network/ResourceHandleClient.cpp:
+        (WebCore::ResourceHandleClient::willSendRequestAsync):
+        (WebCore::ResourceHandleClient::didReceiveResponseAsync):
+        * platform/network/ResourceHandleClient.h:
+        (WebCore::ResourceHandleClient::didSendData):
+        (WebCore::ResourceHandleClient::didReceiveResponse):
+        (WebCore::ResourceHandleClient::didReceiveData):
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::ResourceResponseBase):
+        (WebCore::ResourceResponseBase::includeCertificateInfo):
+        (WebCore::ResourceResponseBase::suggestedFilename):
+        (WebCore::ResourceResponseBase::certificateInfo): Deleted.
+        * platform/network/ResourceResponseBase.h:
+        (WebCore::ResourceResponseBase::certificateInfo):
+        (WebCore::ResourceResponseBase::encode):
+        (WebCore::ResourceResponseBase::decode):
+        (WebCore::ResourceResponseBase::containsCertificateInfo): Deleted.
+        * platform/network/SynchronousLoaderClient.cpp:
+        (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace):
+        (WebCore::SynchronousLoaderClient::didReceiveResponse):
+        (WebCore::SynchronousLoaderClient::didReceiveData):
+        * platform/network/SynchronousLoaderClient.h:
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
+        (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
+        * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData):
+        * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
+        (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
+        * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
+        (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::nextMultipartResponsePartCallback):
+        (WebCore::sendRequestCallback):
+
 2016-06-09  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add SPI to disable spellchecking on auto-fillable text fields
index 9bd806c..9129d58 100644 (file)
@@ -637,7 +637,7 @@ void ResourceLoader::didSendData(ResourceHandle*, unsigned long long bytesSent,
     didSendData(bytesSent, totalBytesToBeSent);
 }
 
-void ResourceLoader::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
+void ResourceLoader::didReceiveResponse(ResourceHandle*, ResourceResponse&& response)
 {
     if (documentLoader()->applicationCacheHost()->maybeLoadFallbackForResponse(this, response))
         return;
index d207934..49fd91b 100644 (file)
@@ -185,7 +185,7 @@ private:
     // ResourceHandleClient
     ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&& redirectResponse) override;
     void didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
-    void didReceiveResponse(ResourceHandle*, const ResourceResponse&) override;
+    void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override;
     void didReceiveData(ResourceHandle*, const char*, unsigned, int encodedDataLength) override;
     void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedDataLength) override;
     void didFinishLoading(ResourceHandle*, double finishTime) override;
index 156c3b5..594cce6 100644 (file)
@@ -489,7 +489,7 @@ RefPtr<ResourceHandle> ApplicationCacheGroup::createResourceHandle(const URL& ur
     return handle;
 }
 
-void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, const ResourceResponse& response)
+void ApplicationCacheGroup::didReceiveResponse(ResourceHandle* handle, ResourceResponse&& response)
 {
     ASSERT(m_frame);
     InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_frame);
index 9b917cb..e21b371 100644 (file)
@@ -108,7 +108,7 @@ private:
     // the existing client callback cannot be used, so assume that any client that enables application cache also wants it to use credential storage.
     bool shouldUseCredentialStorage(ResourceHandle*) override { return true; }
 
-    void didReceiveResponse(ResourceHandle*, const ResourceResponse&) override;
+    void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override;
     void didReceiveData(ResourceHandle*, const char*, unsigned length, int encodedDataLength) override;
     void didFinishLoading(ResourceHandle*, double finishTime) override;
     void didFail(ResourceHandle*, const ResourceError&) override;
index 9293d3f..96035fc 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef PlatformMediaResourceLoader_h
-#define PlatformMediaResourceLoader_h
+#pragma once
 
 #if ENABLE(VIDEO)
 
@@ -91,4 +90,3 @@ protected:
 } // namespace WebCore
 
 #endif
-#endif
index 7526b01..0cf4dcb 100644 (file)
@@ -96,7 +96,7 @@ class ResourceHandleStreamingClient : public ResourceHandleClient, public Stream
         char* getOrCreateReadBuffer(size_t requestedSize, size_t& actualSize) override;
 #endif
         ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) override;
-        void didReceiveResponse(ResourceHandle*, const ResourceResponse&) override;
+        void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override;
         void didReceiveData(ResourceHandle*, const char*, unsigned, int) override;
         void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedLength) override;
         void didFinishLoading(ResourceHandle*, double /*finishTime*/) override;
@@ -1090,7 +1090,7 @@ ResourceRequest ResourceHandleStreamingClient::willSendRequest(ResourceHandle*,
     return WTFMove(request);
 }
 
-void ResourceHandleStreamingClient::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
+void ResourceHandleStreamingClient::didReceiveResponse(ResourceHandle*, ResourceResponse&& response)
 {
     handleResponseReceived(response);
 }
index 2da0ce2..74749da 100644 (file)
@@ -83,7 +83,7 @@ class BlobResourceSynchronousLoader : public ResourceHandleClient {
 public:
     BlobResourceSynchronousLoader(ResourceError&, ResourceResponse&, Vector<char>&);
 
-    void didReceiveResponse(ResourceHandle*, const ResourceResponse&) override;
+    void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override;
     void didFail(ResourceHandle*, const ResourceError&) override;
 
 private:
@@ -99,7 +99,7 @@ BlobResourceSynchronousLoader::BlobResourceSynchronousLoader(ResourceError& erro
 {
 }
 
-void BlobResourceSynchronousLoader::didReceiveResponse(ResourceHandle* handle, const ResourceResponse& response)
+void BlobResourceSynchronousLoader::didReceiveResponse(ResourceHandle* handle, ResourceResponse&& response)
 {
     // We cannot handle the size that is more than maximum integer.
     if (response.expectedContentLength() > INT_MAX) {
@@ -583,9 +583,9 @@ void BlobResourceHandle::notifyResponseOnSuccess()
     // It's currently client's responsibility to know that didReceiveResponseAsync cannot be used to convert a
     // load into a download or blobs.
     if (usesAsyncCallbacks())
-        client()->didReceiveResponseAsync(this, response);
+        client()->didReceiveResponseAsync(this, WTFMove(response));
     else
-        client()->didReceiveResponse(this, response);
+        client()->didReceiveResponse(this, WTFMove(response));
 }
 
 void BlobResourceHandle::notifyResponseOnError()
@@ -615,9 +615,9 @@ void BlobResourceHandle::notifyResponseOnError()
     // Note that we don't wait for continueDidReceiveResponse when using didReceiveResponseAsync.
     // This is not formally correct, but the client has to be a no-op anyway, because blobs can't be downloaded.
     if (usesAsyncCallbacks())
-        client()->didReceiveResponseAsync(this, response);
+        client()->didReceiveResponseAsync(this, WTFMove(response));
     else
-        client()->didReceiveResponse(this, response);
+        client()->didReceiveResponse(this, WTFMove(response));
 }
 
 void BlobResourceHandle::notifyReceiveData(const char* data, int bytesRead)
index 005dcd1..4dc4832 100644 (file)
@@ -76,25 +76,22 @@ void handleDataURL(ResourceHandle* handle)
 
     if (base64) {
         data = decodeURLEscapeSequences(data);
-        handle->client()->didReceiveResponse(handle, response);
+        handle->client()->didReceiveResponse(handle, WTFMove(response));
 
         // didReceiveResponse might cause the client to be deleted.
         if (handle->client()) {
             Vector<char> out;
-            if (base64Decode(data, out, Base64IgnoreSpacesAndNewLines) && out.size() > 0) {
-                response.setExpectedContentLength(out.size());
+            if (base64Decode(data, out, Base64IgnoreSpacesAndNewLines) && out.size() > 0)
                 handle->client()->didReceiveData(handle, out.data(), out.size(), 0);
-            }
         }
     } else {
         TextEncoding encoding(charset);
         data = decodeURLEscapeSequences(data, encoding);
-        handle->client()->didReceiveResponse(handle, response);
+        handle->client()->didReceiveResponse(handle, WTFMove(response));
 
         // didReceiveResponse might cause the client to be deleted.
         if (handle->client()) {
             CString encodedData = encoding.encode(data, URLEncodedEntitiesForUnencodables);
-            response.setExpectedContentLength(encodedData.length());
             if (encodedData.length())
                 handle->client()->didReceiveData(handle, encodedData.data(), encodedData.length(), 0);
         }
index 9045f11..13eb9cc 100644 (file)
@@ -56,7 +56,7 @@ public:
     }
 
 private:
-    void didReceiveResponse(ResourceHandle*, const ResourceResponse&) override { delete this; }
+    void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override { delete this; }
     void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int) override { delete this; };
     void didFinishLoading(ResourceHandle*, double) override { delete this; }
     void didFail(ResourceHandle*, const ResourceError&) override { delete this; }
index 0ec2981..f7357bf 100644 (file)
@@ -50,7 +50,7 @@ void ResourceHandleClient::willSendRequestAsync(ResourceHandle* handle, Resource
     handle->continueWillSendRequest(WTFMove(request));
 }
 
-void ResourceHandleClient::didReceiveResponseAsync(ResourceHandle* handle, const ResourceResponse&)
+void ResourceHandleClient::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&&)
 {
     handle->continueDidReceiveResponse();
 }
index c4d56aa..03efbf5 100644 (file)
@@ -71,7 +71,7 @@ namespace WebCore {
         WEBCORE_EXPORT virtual ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&&);
         virtual void didSendData(ResourceHandle*, unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
 
-        virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&) { }
+        virtual void didReceiveResponse(ResourceHandle*, ResourceResponse&&) { }
         
         virtual void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) { }
         WEBCORE_EXPORT virtual void didReceiveBuffer(ResourceHandle*, Ref<SharedBuffer>&&, int encodedDataLength);
@@ -89,7 +89,7 @@ namespace WebCore {
         WEBCORE_EXPORT virtual void willSendRequestAsync(ResourceHandle*, ResourceRequest&&, ResourceResponse&&);
 
         // Client will call ResourceHandle::continueDidReceiveResponse() when ready.
-        WEBCORE_EXPORT virtual void didReceiveResponseAsync(ResourceHandle*, const ResourceResponse&);
+        WEBCORE_EXPORT virtual void didReceiveResponseAsync(ResourceHandle*, ResourceResponse&&);
 
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
         // Client will pass an updated request using ResourceHandle::continueCanAuthenticateAgainstProtectionSpace() when ready.
index 72fc6a8..f334c5c 100644 (file)
@@ -47,7 +47,6 @@ inline const ResourceResponse& ResourceResponseBase::asResourceResponse() const
 ResourceResponseBase::ResourceResponseBase()
     : m_isNull(true)
     , m_expectedContentLength(0)
-    , m_includesCertificateInfo(false)
     , m_httpStatusCode(0)
 {
 }
@@ -58,7 +57,7 @@ ResourceResponseBase::ResourceResponseBase(const URL& url, const String& mimeTyp
     , m_mimeType(mimeType)
     , m_expectedContentLength(expectedLength)
     , m_textEncodingName(textEncodingName)
-    , m_includesCertificateInfo(true) // Empty but valid for synthetic responses.
+    , m_certificateInfo(CertificateInfo()) // Empty but valid for synthetic responses.
     , m_httpStatusCode(0)
 {
 }
@@ -184,15 +183,9 @@ void ResourceResponseBase::setTextEncodingName(const String& encodingName)
 
 void ResourceResponseBase::includeCertificateInfo() const
 {
-    if (m_includesCertificateInfo)
+    if (m_certificateInfo)
         return;
     m_certificateInfo = static_cast<const ResourceResponse*>(this)->platformCertificateInfo();
-    m_includesCertificateInfo = true;
-}
-
-CertificateInfo ResourceResponseBase::certificateInfo() const
-{
-    return m_certificateInfo;
 }
 
 String ResourceResponseBase::suggestedFilename() const
index 58124f0..50c5f5e 100644 (file)
@@ -114,8 +114,7 @@ public:
     WEBCORE_EXPORT String suggestedFilename() const;
 
     WEBCORE_EXPORT void includeCertificateInfo() const;
-    bool containsCertificateInfo() const { return m_includesCertificateInfo; }
-    WEBCORE_EXPORT CertificateInfo certificateInfo() const;
+    WEBCORE_EXPORT const Optional<CertificateInfo>& certificateInfo() const { return m_certificateInfo; };
     
     // These functions return parsed values of the corresponding response headers.
     // NaN means that the header was not present or had invalid value.
@@ -190,8 +189,8 @@ protected:
     HTTPHeaderMap m_httpHeaderFields;
     mutable ResourceLoadTiming m_resourceLoadTiming;
 
-    mutable bool m_includesCertificateInfo;
-    mutable CertificateInfo m_certificateInfo;
+#define RESOURCE_RESPONSE_BASE_CERT_INFO_OPTIONAL
+    mutable Optional<CertificateInfo> m_certificateInfo;
 
     int m_httpStatusCode;
 
@@ -236,9 +235,7 @@ void ResourceResponseBase::encode(Encoder& encoder) const
     encoder << m_httpHeaderFields;
     encoder << m_resourceLoadTiming;
     encoder << m_httpStatusCode;
-    encoder << m_includesCertificateInfo;
-    if (m_includesCertificateInfo)
-        encoder << m_certificateInfo;
+    encoder << m_certificateInfo;
     encoder.encodeEnum(m_source);
     encoder.encodeEnum(m_type);
     encoder << m_isRedirected;
@@ -274,12 +271,8 @@ bool ResourceResponseBase::decode(Decoder& decoder, ResourceResponseBase& respon
         return false;
     if (!decoder.decode(response.m_httpStatusCode))
         return false;
-    if (!decoder.decode(response.m_includesCertificateInfo))
+    if (!decoder.decode(response.m_certificateInfo))
         return false;
-    if (response.m_includesCertificateInfo) {
-        if (!decoder.decode(response.m_certificateInfo))
-            return false;
-    }
     if (!decoder.decodeEnum(response.m_source))
         return false;
     if (!decoder.decodeEnum(response.m_type))
index 83e79e0..87c994b 100644 (file)
@@ -62,9 +62,9 @@ bool SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace(ResourceHand
 }
 #endif
 
-void SynchronousLoaderClient::didReceiveResponse(ResourceHandle*, const ResourceResponse& response)
+void SynchronousLoaderClient::didReceiveResponse(ResourceHandle*, ResourceResponse&& response)
 {
-    m_response = response;
+    m_response = WTFMove(response);
 }
 
 void SynchronousLoaderClient::didReceiveData(ResourceHandle*, const char* data, unsigned length, int /*encodedDataLength*/)
index 877f9f5..9ca0e6a 100644 (file)
@@ -48,7 +48,7 @@ private:
     ResourceRequest willSendRequest(ResourceHandle*, ResourceRequest&&, ResourceResponse&&) override;
     bool shouldUseCredentialStorage(ResourceHandle*) override;
     void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) override;
-    void didReceiveResponse(ResourceHandle*, const ResourceResponse&) override;
+    void didReceiveResponse(ResourceHandle*, ResourceResponse&&) override;
     void didReceiveData(ResourceHandle*, const char*, unsigned, int /*encodedDataLength*/) override;
     void didFinishLoading(ResourceHandle*, double /*finishTime*/) override;
     void didFail(ResourceHandle*, const ResourceError&) override;
index 8f334a4..84b7a3e 100644 (file)
@@ -161,7 +161,7 @@ void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse
         UNUSED_PARAM(connection);
 #endif
         
-        m_handle->client()->didReceiveResponseAsync(m_handle, resourceResponse);
+        m_handle->client()->didReceiveResponseAsync(m_handle, WTFMove(resourceResponse));
     });
     dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
 }
index d5a4dd5..19a6dd9 100644 (file)
@@ -180,7 +180,7 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLC
     UNUSED_PARAM(connection);
 #endif
     
-    m_handle->client()->didReceiveResponse(m_handle, resourceResponse);
+    m_handle->client()->didReceiveResponse(m_handle, WTFMove(resourceResponse));
 }
 
 void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData(CFDataRef data, CFIndex originalLength)
index ff154e5..bacf3ab 100644 (file)
@@ -169,7 +169,7 @@ using namespace WebCore;
     UNUSED_PARAM(connection);
 #endif
     
-    m_handle->client()->didReceiveResponse(m_handle, resourceResponse);
+    m_handle->client()->didReceiveResponse(m_handle, WTFMove(resourceResponse));
 }
 
 #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
index 02f1a4f..3620073 100644 (file)
@@ -215,7 +215,7 @@ using namespace WebCore;
 #else
         UNUSED_PARAM(connection);
 #endif
-        m_handle->client()->didReceiveResponseAsync(m_handle, resourceResponse);
+        m_handle->client()->didReceiveResponseAsync(m_handle, WTFMove(resourceResponse));
     });
 
     dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
index a4894a6..c9aa8c8 100644 (file)
@@ -136,7 +136,7 @@ public:
     }
 #endif // SOUP_CHECK_VERSION(2, 49, 91)
 
-    void didReceiveResponse(ResourceHandle*, const ResourceResponse& response) override
+    void didReceiveResponse(ResourceHandle*, ResourceResponse&& response) override
     {
         m_response = response;
     }
@@ -654,9 +654,9 @@ static void nextMultipartResponsePartCallback(GObject* /*source*/, GAsyncResult*
     d->m_previousPosition = 0;
 
     if (handle->client()->usesAsyncCallbacks())
-        handle->client()->didReceiveResponseAsync(handle.get(), d->m_response);
+        handle->client()->didReceiveResponseAsync(handle.get(), ResourceResponse(d->m_response));
     else {
-        handle->client()->didReceiveResponse(handle.get(), d->m_response);
+        handle->client()->didReceiveResponse(handle.get(), ResourceResponse(d->m_response));
         continueAfterDidReceiveResponse(handle.get());
     }
 }
@@ -718,9 +718,9 @@ static void sendRequestCallback(GObject*, GAsyncResult* result, gpointer data)
         d->m_inputStream = inputStream;
 
     if (d->client()->usesAsyncCallbacks())
-        handle->client()->didReceiveResponseAsync(handle.get(), d->m_response);
+        handle->client()->didReceiveResponseAsync(handle.get(), ResourceResponse(d->m_response));
     else {
-        handle->client()->didReceiveResponse(handle.get(), d->m_response);
+        handle->client()->didReceiveResponse(handle.get(), ResourceResponse(d->m_response));
         continueAfterDidReceiveResponse(handle.get());
     }
 }
index db41619..531d803 100644 (file)
@@ -1,3 +1,44 @@
+2016-06-10  Alex Christensen  <achristensen@webkit.org>
+
+        Reduce ResourceResponse copying
+        https://bugs.webkit.org/show_bug.cgi?id=158232
+
+        Reviewed by Darin Adler.
+
+        * NetworkProcess/Downloads/PendingDownload.h:
+        * NetworkProcess/NetworkDataTask.h:
+        * NetworkProcess/NetworkLoad.cpp:
+        (WebKit::NetworkLoad::continueDidReceiveResponse):
+        (WebKit::NetworkLoad::sharedDidReceiveResponse):
+        (WebKit::NetworkLoad::sharedWillSendRedirectedRequest):
+        (WebKit::NetworkLoad::didReceiveChallenge):
+        (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
+        (WebKit::NetworkLoad::didReceiveResponseAsync):
+        * NetworkProcess/NetworkLoad.h:
+        * NetworkProcess/NetworkLoadClient.h:
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::retrieveCacheEntry):
+        (WebKit::NetworkResourceLoader::abort):
+        * NetworkProcess/NetworkResourceLoader.h:
+        * NetworkProcess/PingLoad.h:
+        * NetworkProcess/cache/NetworkCacheCoders.h:
+        (WebKit::NetworkCache::Coder<Optional<T>>::encode):
+        (WebKit::NetworkCache::Coder<Optional<T>>::decode):
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
+        (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoad.h:
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTask::didCompleteWithError):
+        (WebKit::NetworkDataTask::didReceiveResponse):
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
+        * WebProcess/WebPage/WebFrame.cpp:
+        (WebKit::WebFrame::url):
+        (WebKit::WebFrame::certificateInfo):
+        (WebKit::WebFrame::innerText):
+
 2016-06-09  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add SPI to disable spellchecking on auto-fillable text fields
index bab1d44..9b659b8 100644 (file)
@@ -55,7 +55,7 @@ private:
     void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) override;
     bool isSynchronous() const override { return false; }
     void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse) override;
-    ShouldContinueDidReceiveResponse didReceiveResponse(const WebCore::ResourceResponse&) override { return ShouldContinueDidReceiveResponse::No; };
+    ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) override { return ShouldContinueDidReceiveResponse::No; };
     void didReceiveBuffer(Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) override { };
     void didFinishLoading(double finishTime) override { };
     void didFailLoading(const WebCore::ResourceError&) override;
index d6cd0d4..0ceee82 100644 (file)
@@ -70,7 +70,7 @@ class NetworkDataTaskClient {
 public:
     virtual void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler) = 0;
     virtual void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler) = 0;
-    virtual void didReceiveResponseNetworkSession(const WebCore::ResourceResponse&, ResponseCompletionHandler) = 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;
@@ -100,7 +100,7 @@ public:
     void didSendData(uint64_t totalBytesSent, uint64_t totalBytesExpectedToSend);
     void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler);
     void didCompleteWithError(const WebCore::ResourceError&);
-    void didReceiveResponse(const WebCore::ResourceResponse&, ResponseCompletionHandler);
+    void didReceiveResponse(WebCore::ResourceResponse&&, ResponseCompletionHandler);
     void didReceiveData(Ref<WebCore::SharedBuffer>&&);
     void didBecomeDownload();
     
index 08080a3..a147e18 100644 (file)
@@ -153,14 +153,13 @@ void NetworkLoad::continueDidReceiveResponse()
         m_handle->continueDidReceiveResponse();
 }
 
-NetworkLoadClient::ShouldContinueDidReceiveResponse NetworkLoad::sharedDidReceiveResponse(const ResourceResponse& receivedResponse)
+NetworkLoadClient::ShouldContinueDidReceiveResponse NetworkLoad::sharedDidReceiveResponse(ResourceResponse&& response)
 {
-    ResourceResponse response = receivedResponse;
     response.setSource(ResourceResponse::Source::Network);
     if (m_parameters.needsCertificateInfo)
         response.includeCertificateInfo();
 
-    return m_client.didReceiveResponse(response);
+    return m_client.didReceiveResponse(WTFMove(response));
 }
 
 void NetworkLoad::sharedWillSendRedirectedRequest(ResourceRequest&& request, ResourceResponse&& redirectResponse)
@@ -239,12 +238,12 @@ void NetworkLoad::didReceiveChallenge(const AuthenticationChallenge& challenge,
         m_client.canAuthenticateAgainstProtectionSpaceAsync(challenge.protectionSpace());
 }
 
-void NetworkLoad::didReceiveResponseNetworkSession(const 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());
-    else if (sharedDidReceiveResponse(response) == NetworkLoadClient::ShouldContinueDidReceiveResponse::Yes)
+    else if (sharedDidReceiveResponse(WTFMove(response)) == NetworkLoadClient::ShouldContinueDidReceiveResponse::Yes)
         completionHandler(PolicyUse);
     else
         m_responseCompletionHandler = completionHandler;
@@ -287,10 +286,10 @@ void NetworkLoad::cannotShowURL()
     
 #endif
 
-void NetworkLoad::didReceiveResponseAsync(ResourceHandle* handle, const ResourceResponse& receivedResponse)
+void NetworkLoad::didReceiveResponseAsync(ResourceHandle* handle, ResourceResponse&& receivedResponse)
 {
     ASSERT_UNUSED(handle, handle == m_handle);
-    if (sharedDidReceiveResponse(receivedResponse) == NetworkLoadClient::ShouldContinueDidReceiveResponse::Yes)
+    if (sharedDidReceiveResponse(WTFMove(receivedResponse)) == NetworkLoadClient::ShouldContinueDidReceiveResponse::Yes)
         m_handle->continueDidReceiveResponse();
 }
 
index 4a20664..c891003 100644 (file)
@@ -67,7 +67,7 @@ public:
     // NetworkDataTaskClient
     void willPerformHTTPRedirection(WebCore::ResourceResponse&&, WebCore::ResourceRequest&&, RedirectCompletionHandler) final;
     void didReceiveChallenge(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler) final;
-    void didReceiveResponseNetworkSession(const WebCore::ResourceResponse&, ResponseCompletionHandler) final;
+    void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler) final;
     void didReceiveData(Ref<WebCore::SharedBuffer>&&) final;
     void didCompleteWithError(const WebCore::ResourceError&) final;
     void didBecomeDownload() final;
@@ -78,7 +78,7 @@ public:
     // ResourceHandleClient
     void willSendRequestAsync(WebCore::ResourceHandle*, WebCore::ResourceRequest&&, WebCore::ResourceResponse&& redirectResponse) override;
     void didSendData(WebCore::ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override;
-    void didReceiveResponseAsync(WebCore::ResourceHandle*, const WebCore::ResourceResponse&) override;
+    void didReceiveResponseAsync(WebCore::ResourceHandle*, WebCore::ResourceResponse&&) override;
     void didReceiveData(WebCore::ResourceHandle*, const char*, unsigned, int encodedDataLength) override;
     void didReceiveBuffer(WebCore::ResourceHandle*, Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) override;
     void didFinishLoading(WebCore::ResourceHandle*, double finishTime) override;
@@ -116,7 +116,7 @@ public:
 #endif
 
 private:
-    NetworkLoadClient::ShouldContinueDidReceiveResponse sharedDidReceiveResponse(const WebCore::ResourceResponse&);
+    NetworkLoadClient::ShouldContinueDidReceiveResponse sharedDidReceiveResponse(WebCore::ResourceResponse&&);
     void sharedWillSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceResponse&&);
 
     NetworkLoadClient& m_client;
index 00a27ac..1616daf 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef NetworkLoadClient_h
-#define NetworkLoadClient_h
+#pragma once
 
 #include <WebCore/ResourceError.h>
 #include <WebCore/ResourceRequest.h>
@@ -52,7 +51,7 @@ public:
     virtual void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) = 0;
     virtual void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse) = 0;
     enum class ShouldContinueDidReceiveResponse { No, Yes };
-    virtual ShouldContinueDidReceiveResponse didReceiveResponse(const WebCore::ResourceResponse&) = 0;
+    virtual ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) = 0;
     virtual void didReceiveBuffer(Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) = 0;
     virtual void didFinishLoading(double finishTime) = 0;
     virtual void didFailLoading(const WebCore::ResourceError&) = 0;
@@ -62,6 +61,3 @@ public:
 };
 
 } // namespace WebKit
-
-#endif // NetworkLoadClient_h
-
index 91c5a41..c64f8a9 100644 (file)
@@ -178,7 +178,7 @@ void NetworkResourceLoader::retrieveCacheEntry(const ResourceRequest& request)
             loader->dispatchWillSendRequestForCacheEntry(WTFMove(entry));
             return;
         }
-        if (loader->m_parameters.needsCertificateInfo && !entry->response().containsCertificateInfo()) {
+        if (loader->m_parameters.needsCertificateInfo && !entry->response().certificateInfo()) {
             loader->startNetworkLoad(request);
             return;
         }
@@ -274,7 +274,7 @@ void NetworkResourceLoader::abort()
     cleanup();
 }
 
-auto NetworkResourceLoader::didReceiveResponse(const ResourceResponse& receivedResponse) -> ShouldContinueDidReceiveResponse
+auto NetworkResourceLoader::didReceiveResponse(ResourceResponse&& receivedResponse) -> ShouldContinueDidReceiveResponse
 {
     NETWORKRESOURCELOADER_LOG_ALWAYS("Received network resource response: loader = %p, pageID = %llu, frameID = %llu, isMainResource = %d, isSynchronous = %d, httpStatusCode = %d", this, m_parameters.webPageID, m_parameters.webFrameID, isMainResource(), isSynchronous(), receivedResponse.httpStatusCode());
 
index 2f374e2..c422f1d 100644 (file)
@@ -88,7 +88,7 @@ public:
     void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) override;
     bool isSynchronous() const override;
     void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&&) override;
-    ShouldContinueDidReceiveResponse didReceiveResponse(const WebCore::ResourceResponse&) override;
+    ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) override;
     void didReceiveBuffer(Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) override;
     void didFinishLoading(double finishTime) override;
     void didFailLoading(const WebCore::ResourceError&) override;
index 1eb8453..b40b682 100644 (file)
@@ -58,7 +58,7 @@ private:
         completionHandler(AuthenticationChallengeDisposition::Cancel, { });
         delete this;
     }
-    void didReceiveResponseNetworkSession(const WebCore::ResourceResponse&, ResponseCompletionHandler completionHandler) override
+    void didReceiveResponseNetworkSession(WebCore::ResourceResponse&&, ResponseCompletionHandler completionHandler) override
     {
         completionHandler(WebCore::PolicyAction::PolicyIgnore);
         delete this;
index 0fc5039..3e9e228 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef NetworkCacheCoders_h
-#define NetworkCacheCoders_h
+#pragma once
 
 #if ENABLE(NETWORK_CACHE)
 
@@ -81,6 +80,38 @@ template<typename Rep, typename Period> struct Coder<std::chrono::duration<Rep,
     }
 };
 
+template<typename T> struct Coder<Optional<T>> {
+    static void encode(Encoder& encoder, const Optional<T>& optional)
+    {
+        if (!optional) {
+            encoder << false;
+            return;
+        }
+        
+        encoder << true;
+        encoder << optional.value();
+    }
+    
+    static bool decode(Decoder& decoder, Optional<T>& optional)
+    {
+        bool isEngaged;
+        if (!decoder.decode(isEngaged))
+            return false;
+        
+        if (!isEngaged) {
+            optional = Nullopt;
+            return true;
+        }
+        
+        T value;
+        if (!decoder.decode(value))
+            return false;
+        
+        optional = WTFMove(value);
+        return true;
+    }
+};
+
 template<typename KeyType, typename ValueType> struct Coder<WTF::KeyValuePair<KeyType, ValueType>> {
     static void encode(Encoder& encoder, const WTF::KeyValuePair<KeyType, ValueType>& pair)
     {
@@ -267,4 +298,3 @@ template<> struct Coder<WebCore::HTTPHeaderMap> {
 }
 }
 #endif
-#endif
index 23ac4fd..e7fedd3 100644 (file)
@@ -70,7 +70,7 @@ void SpeculativeLoad::willSendRedirectedRequest(ResourceRequest&&, ResourceReque
     abort();
 }
 
-auto SpeculativeLoad::didReceiveResponse(const ResourceResponse& receivedResponse) -> ShouldContinueDidReceiveResponse
+auto SpeculativeLoad::didReceiveResponse(ResourceResponse&& receivedResponse) -> ShouldContinueDidReceiveResponse
 {
     m_response = receivedResponse;
 
index a9b61ac..bc543ee 100644 (file)
@@ -57,7 +57,7 @@ private:
     void canAuthenticateAgainstProtectionSpaceAsync(const WebCore::ProtectionSpace&) override { }
     bool isSynchronous() const override { return false; }
     void willSendRedirectedRequest(WebCore::ResourceRequest&&, WebCore::ResourceRequest&& redirectRequest, WebCore::ResourceResponse&& redirectResponse) override;
-    ShouldContinueDidReceiveResponse didReceiveResponse(const WebCore::ResourceResponse&) override;
+    ShouldContinueDidReceiveResponse didReceiveResponse(WebCore::ResourceResponse&&) override;
     void didReceiveBuffer(Ref<WebCore::SharedBuffer>&&, int reportedEncodedDataLength) override;
     void didFinishLoading(double finishTime) override;
     void didFailLoading(const WebCore::ResourceError&) override;
index af059ae..18f5c09 100644 (file)
@@ -165,10 +165,10 @@ void NetworkDataTask::didCompleteWithError(const WebCore::ResourceError& error)
         m_client->didCompleteWithError(error);
 }
 
-void NetworkDataTask::didReceiveResponse(const WebCore::ResourceResponse& response, ResponseCompletionHandler completionHandler)
+void NetworkDataTask::didReceiveResponse(WebCore::ResourceResponse&& response, ResponseCompletionHandler completionHandler)
 {
     if (m_client)
-        m_client->didReceiveResponseNetworkSession(response, completionHandler);
+        m_client->didReceiveResponseNetworkSession(WTFMove(response), completionHandler);
     else {
         ASSERT_NOT_REACHED();
         completionHandler(WebCore::PolicyAction::PolicyIgnore);
index f0810b5..3a8ff47 100644 (file)
@@ -247,7 +247,7 @@ static NSURLSessionAuthChallengeDisposition toNSURLSessionAuthChallengeDispositi
         WebCore::ResourceResponse resourceResponse(response);
         copyTimingData([dataTask _timingData], resourceResponse.resourceLoadTiming());
         auto completionHandlerCopy = Block_copy(completionHandler);
-        networkDataTask->didReceiveResponse(resourceResponse, [completionHandlerCopy, taskIdentifier](WebCore::PolicyAction policyAction) {
+        networkDataTask->didReceiveResponse(WTFMove(resourceResponse), [completionHandlerCopy, taskIdentifier](WebCore::PolicyAction policyAction) {
             LOG(NetworkSession, "%llu didReceiveResponse completionHandler (cancel)", taskIdentifier);
             completionHandlerCopy(toNSURLSessionResponseDisposition(policyAction));
             Block_release(completionHandlerCopy);
index 76a425d..a147f20 100644 (file)
@@ -468,7 +468,7 @@ void WebFrameLoaderClient::dispatchDidCommitLoad()
 
     // Notify the UIProcess.
 
-    webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), documentLoader.response().certificateInfo(), m_frame->coreFrame()->document()->isPluginDocument(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+    webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), documentLoader.response().certificateInfo().valueOrCompute([] { return CertificateInfo(); }), m_frame->coreFrame()->document()->isPluginDocument(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
     webPage->didCommitLoad(m_frame);
 }
 
index 44d7736..2b5540d 100644 (file)
@@ -397,16 +397,16 @@ String WebFrame::url() const
     return documentLoader->url().string();
 }
 
-WebCore::CertificateInfo WebFrame::certificateInfo() const
+CertificateInfo WebFrame::certificateInfo() const
 {
     if (!m_coreFrame)
-        return CertificateInfo();
+        return { };
 
     DocumentLoader* documentLoader = m_coreFrame->loader().documentLoader();
     if (!documentLoader)
-        return CertificateInfo();
+        return { };
 
-    return documentLoader->response().certificateInfo();
+    return documentLoader->response().certificateInfo().valueOrCompute([] { return CertificateInfo(); });
 }
 
 String WebFrame::innerText() const