<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[201603] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/201603">201603</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-06-02 11:17:47 -0700 (Thu, 02 Jun 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Overhaul cross-thread use of ResourceRequest, ResourceResponse, and ResourceError.
https://bugs.webkit.org/show_bug.cgi?id=158293
Reviewed by Darin Adler.
Source/WebCore:
No new tests (Refactor, no behavior change).
* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
(WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::removeRequestFromSessionCaches):
* platform/network/ResourceErrorBase.cpp:
(WebCore::ResourceErrorBase::isolatedCopy):
(WebCore::ResourceErrorBase::copy): Deleted.
* platform/network/ResourceErrorBase.h:
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::isolatedCopy):
(WebCore::ResourceRequestBase::setAsIsolatedCopy):
(WebCore::ResourceRequestBase::adopt): Deleted.
Made copyData private, and made "adopt" be "isolatedCopy".
Rest of the changes are all re-indenting the file.
* platform/network/ResourceRequestBase.h:
(WebCore::ResourceRequestBase::responseContentDispositionEncodingFallbackArray):
(WebCore::ResourceRequestBase::reportUploadProgress):
(WebCore::ResourceRequestBase::setReportUploadProgress):
(WebCore::ResourceRequestBase::reportLoadTiming):
(WebCore::ResourceRequestBase::setReportLoadTiming):
(WebCore::ResourceRequestBase::reportRawHeaders):
(WebCore::ResourceRequestBase::setReportRawHeaders):
(WebCore::ResourceRequestBase::hiddenFromInspector):
(WebCore::ResourceRequestBase::setHiddenFromInspector):
(WebCore::ResourceRequestBase::requester):
(WebCore::ResourceRequestBase::setRequester):
(WebCore::ResourceRequestBase::encodingRequiresPlatformData):
(WebCore::ResourceRequestBase::ResourceRequestBase):
(WebCore::ResourceRequestBase::platformCompare):
(WebCore::operator==):
(WebCore::operator!=):
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::isolatedCopy):
(WebCore::ResourceResponseBase::adopt): Deleted.
* platform/network/ResourceResponseBase.h:
* platform/network/cf/ResourceError.h:
(WebCore::ResourceError::isolatedCopy): Deleted.
Removed platform-specific isolatedCopy, and re-indented the header:
* platform/network/cf/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
(WebCore::ResourceRequest::encodingRequiresPlatformData):
(WebCore::ResourceRequest::cachePartition):
(WebCore::ResourceRequest::setCachePartition):
(WebCore::ResourceRequest::setDomainForCachePartition):
(WebCore::ResourceRequest::resourcePrioritiesEnabled):
(WebCore::ResourceRequest::isolatedCopy): Deleted.
* platform/network/cf/ResourceResponse.h:
(WebCore::ResourceResponse::isolatedCopy): Deleted.
Source/WebKit2:
* NetworkProcess/cache/NetworkCacheEntry.cpp:
(WebKit::NetworkCache::Entry::Entry):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderWorkerThreadableLoadercpp">trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheMemoryCachecpp">trunk/Source/WebCore/loader/cache/MemoryCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceErrorBasecpp">trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceErrorBaseh">trunk/Source/WebCore/platform/network/ResourceErrorBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceRequestBasecpp">trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceRequestBaseh">trunk/Source/WebCore/platform/network/ResourceRequestBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBasecpp">trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBaseh">trunk/Source/WebCore/platform/network/ResourceResponseBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceErrorh">trunk/Source/WebCore/platform/network/cf/ResourceError.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceRequesth">trunk/Source/WebCore/platform/network/cf/ResourceRequest.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceResponseh">trunk/Source/WebCore/platform/network/cf/ResourceResponse.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheEntrycpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/ChangeLog        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -1,3 +1,72 @@
</span><ins>+2016-06-02 Brady Eidson <beidson@apple.com>
+
+ Overhaul cross-thread use of ResourceRequest, ResourceResponse, and ResourceError.
+ https://bugs.webkit.org/show_bug.cgi?id=158293
+
+ Reviewed by Darin Adler.
+
+ No new tests (Refactor, no behavior change).
+
+ * loader/WorkerThreadableLoader.cpp:
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
+ (WebCore::WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck):
+
+ * loader/cache/MemoryCache.cpp:
+ (WebCore::MemoryCache::removeRequestFromSessionCaches):
+
+ * platform/network/ResourceErrorBase.cpp:
+ (WebCore::ResourceErrorBase::isolatedCopy):
+ (WebCore::ResourceErrorBase::copy): Deleted.
+ * platform/network/ResourceErrorBase.h:
+
+ * platform/network/ResourceRequestBase.cpp:
+ (WebCore::ResourceRequestBase::isolatedCopy):
+ (WebCore::ResourceRequestBase::setAsIsolatedCopy):
+ (WebCore::ResourceRequestBase::adopt): Deleted.
+
+ Made copyData private, and made "adopt" be "isolatedCopy".
+ Rest of the changes are all re-indenting the file.
+ * platform/network/ResourceRequestBase.h:
+ (WebCore::ResourceRequestBase::responseContentDispositionEncodingFallbackArray):
+ (WebCore::ResourceRequestBase::reportUploadProgress):
+ (WebCore::ResourceRequestBase::setReportUploadProgress):
+ (WebCore::ResourceRequestBase::reportLoadTiming):
+ (WebCore::ResourceRequestBase::setReportLoadTiming):
+ (WebCore::ResourceRequestBase::reportRawHeaders):
+ (WebCore::ResourceRequestBase::setReportRawHeaders):
+ (WebCore::ResourceRequestBase::hiddenFromInspector):
+ (WebCore::ResourceRequestBase::setHiddenFromInspector):
+ (WebCore::ResourceRequestBase::requester):
+ (WebCore::ResourceRequestBase::setRequester):
+ (WebCore::ResourceRequestBase::encodingRequiresPlatformData):
+ (WebCore::ResourceRequestBase::ResourceRequestBase):
+ (WebCore::ResourceRequestBase::platformCompare):
+ (WebCore::operator==):
+ (WebCore::operator!=):
+
+ * platform/network/ResourceResponseBase.cpp:
+ (WebCore::ResourceResponseBase::isolatedCopy):
+ (WebCore::ResourceResponseBase::adopt): Deleted.
+ * platform/network/ResourceResponseBase.h:
+
+ * platform/network/cf/ResourceError.h:
+ (WebCore::ResourceError::isolatedCopy): Deleted.
+
+ Removed platform-specific isolatedCopy, and re-indented the header:
+ * platform/network/cf/ResourceRequest.h:
+ (WebCore::ResourceRequest::ResourceRequest):
+ (WebCore::ResourceRequest::encodingRequiresPlatformData):
+ (WebCore::ResourceRequest::cachePartition):
+ (WebCore::ResourceRequest::setCachePartition):
+ (WebCore::ResourceRequest::setDomainForCachePartition):
+ (WebCore::ResourceRequest::resourcePrioritiesEnabled):
+ (WebCore::ResourceRequest::isolatedCopy): Deleted.
+
+ * platform/network/cf/ResourceResponse.h:
+ (WebCore::ResourceResponse::isolatedCopy): Deleted.
+
</ins><span class="cx"> 2016-06-02 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Modernize various lambda captures
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderWorkerThreadableLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -96,17 +96,16 @@
</span><span class="cx"> auto contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(*securityOrigin);
</span><span class="cx"> contentSecurityPolicyCopy->copyStateFrom(contentSecurityPolicy);
</span><span class="cx">
</span><del>- m_loaderProxy.postTaskToLoader([this, requestData = request.copyData(), options = options.isolatedCopy(), contentSecurityPolicyCopy = WTFMove(contentSecurityPolicyCopy), outgoingReferrer = outgoingReferrer.isolatedCopy()](ScriptExecutionContext& context) mutable {
</del><ins>+ m_loaderProxy.postTaskToLoader([this, request = request.isolatedCopy(), options = options.isolatedCopy(), contentSecurityPolicyCopy = WTFMove(contentSecurityPolicyCopy), outgoingReferrer = outgoingReferrer.isolatedCopy()](ScriptExecutionContext& context) mutable {
</ins><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> Document& document = downcast<Document>(context);
</span><span class="cx">
</span><del>- auto request = ResourceRequest::adopt(WTFMove(requestData));
- request->setHTTPReferrer(outgoingReferrer);
</del><ins>+ request.setHTTPReferrer(outgoingReferrer);
</ins><span class="cx">
</span><span class="cx"> // FIXME: If the a site requests a local resource, then this will return a non-zero value but the sync path
</span><span class="cx"> // will return a 0 value. Either this should return 0 or the other code path should do a callback with
</span><span class="cx"> // a failure.
</span><del>- m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, *request, *options, WTFMove(contentSecurityPolicyCopy));
</del><ins>+ m_mainThreadLoader = DocumentThreadableLoader::create(document, *this, request, *options, WTFMove(contentSecurityPolicyCopy));
</ins><span class="cx"> ASSERT(m_mainThreadLoader || m_loadingFinished);
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="lines">@@ -163,10 +162,9 @@
</span><span class="cx"> void WorkerThreadableLoader::MainThreadBridge::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
</span><span class="cx"> {
</span><span class="cx"> Ref<ThreadableLoaderClientWrapper> protectedWorkerClientWrapper = *m_workerClientWrapper;
</span><del>- m_loaderProxy.postTaskForModeToWorkerGlobalScope([protectedWorkerClientWrapper = WTFMove(protectedWorkerClientWrapper), identifier, responseData = response.copyData()] (ScriptExecutionContext& context) mutable {
</del><ins>+ m_loaderProxy.postTaskForModeToWorkerGlobalScope([protectedWorkerClientWrapper = WTFMove(protectedWorkerClientWrapper), identifier, response = response.isolatedCopy()] (ScriptExecutionContext& context) mutable {
</ins><span class="cx"> ASSERT_UNUSED(context, context.isWorkerGlobalScope());
</span><del>- auto response(ResourceResponse::adopt(WTFMove(responseData)));
- protectedWorkerClientWrapper->didReceiveResponse(identifier, *response);
</del><ins>+ protectedWorkerClientWrapper->didReceiveResponse(identifier, response);
</ins><span class="cx"> }, m_taskMode);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -194,20 +192,18 @@
</span><span class="cx"> void WorkerThreadableLoader::MainThreadBridge::didFail(const ResourceError& error)
</span><span class="cx"> {
</span><span class="cx"> m_loadingFinished = true;
</span><del>- Ref<ThreadableLoaderClientWrapper> protectedWorkerClientWrapper = *m_workerClientWrapper;
- m_loaderProxy.postTaskForModeToWorkerGlobalScope([protectedWorkerClientWrapper = WTFMove(protectedWorkerClientWrapper), error = error.copy()] (ScriptExecutionContext& context) mutable {
</del><ins>+ m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper = Ref<ThreadableLoaderClientWrapper>(*m_workerClientWrapper), error = error.isolatedCopy()] (ScriptExecutionContext& context) mutable {
</ins><span class="cx"> ASSERT_UNUSED(context, context.isWorkerGlobalScope());
</span><del>- protectedWorkerClientWrapper->didFail(error);
</del><ins>+ workerClientWrapper->didFail(error);
</ins><span class="cx"> }, m_taskMode);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck(const ResourceError& error)
</span><span class="cx"> {
</span><span class="cx"> m_loadingFinished = true;
</span><del>- Ref<ThreadableLoaderClientWrapper> protectedWorkerClientWrapper = *m_workerClientWrapper;
- m_loaderProxy.postTaskForModeToWorkerGlobalScope([protectedWorkerClientWrapper = WTFMove(protectedWorkerClientWrapper), error = error.copy()] (ScriptExecutionContext& context) mutable {
</del><ins>+ m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper = Ref<ThreadableLoaderClientWrapper>(*m_workerClientWrapper), error = error.isolatedCopy()] (ScriptExecutionContext& context) mutable {
</ins><span class="cx"> ASSERT_UNUSED(context, context.isWorkerGlobalScope());
</span><del>- protectedWorkerClientWrapper->didFailAccessControlCheck(error);
</del><ins>+ workerClientWrapper->didFailAccessControlCheck(error);
</ins><span class="cx"> }, m_taskMode);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheMemoryCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -655,10 +655,8 @@
</span><span class="cx"> void MemoryCache::removeRequestFromSessionCaches(ScriptExecutionContext& context, const ResourceRequest& request)
</span><span class="cx"> {
</span><span class="cx"> if (is<WorkerGlobalScope>(context)) {
</span><del>- CrossThreadResourceRequestData* requestData = request.copyData().release();
- downcast<WorkerGlobalScope>(context).thread().workerLoaderProxy().postTaskToLoader([requestData] (ScriptExecutionContext& context) {
- auto request(ResourceRequest::adopt(std::unique_ptr<CrossThreadResourceRequestData>(requestData)));
- MemoryCache::removeRequestFromSessionCaches(context, *request);
</del><ins>+ downcast<WorkerGlobalScope>(context).thread().workerLoaderProxy().postTaskToLoader([request = request.isolatedCopy()] (ScriptExecutionContext& context) {
+ MemoryCache::removeRequestFromSessionCaches(context, request);
</ins><span class="cx"> });
</span><span class="cx"> return;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceErrorBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">
</span><span class="cx"> const char* const errorDomainWebKitInternal = "WebKitInternal";
</span><span class="cx">
</span><del>-ResourceError ResourceErrorBase::copy() const
</del><ins>+ResourceError ResourceErrorBase::isolatedCopy() const
</ins><span class="cx"> {
</span><span class="cx"> lazyInit();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceErrorBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceErrorBase.h (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceErrorBase.h        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/platform/network/ResourceErrorBase.h        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef ResourceErrorBase_h
-#define ResourceErrorBase_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "URL.h"
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="lines">@@ -37,8 +36,7 @@
</span><span class="cx">
</span><span class="cx"> class ResourceErrorBase {
</span><span class="cx"> public:
</span><del>- // Makes a deep copy. Useful for when you need to use a ResourceError on another thread.
- ResourceError copy() const;
</del><ins>+ ResourceError isolatedCopy() const;
</ins><span class="cx">
</span><span class="cx"> bool isNull() const { return m_isNull; }
</span><span class="cx">
</span><span class="lines">@@ -99,5 +97,3 @@
</span><span class="cx"> inline bool operator!=(const ResourceError& a, const ResourceError& b) { return !(a == b); }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // ResourceErrorBase_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceRequestBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -49,20 +49,28 @@
</span><span class="cx"> return *static_cast<const ResourceRequest*>(this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::unique_ptr<ResourceRequest> ResourceRequestBase::adopt(std::unique_ptr<CrossThreadResourceRequestData> data)
</del><ins>+ResourceRequest ResourceRequestBase::isolatedCopy() const
</ins><span class="cx"> {
</span><del>- auto request = std::make_unique<ResourceRequest>();
- request->setURL(data->url);
- request->setCachePolicy(data->cachePolicy);
- request->setTimeoutInterval(data->timeoutInterval);
- request->setFirstPartyForCookies(data->firstPartyForCookies);
- request->setHTTPMethod(data->httpMethod);
- request->setPriority(data->priority);
- request->setRequester(data->requester);
</del><ins>+ ResourceRequest request;
+ request.setAsIsolatedCopy(*this);
+ return request;
+}
</ins><span class="cx">
</span><del>- request->updateResourceRequest();
- request->m_httpHeaderFields.adopt(WTFMove(data->httpHeaders));
</del><ins>+void ResourceRequestBase::setAsIsolatedCopy(const ResourceRequestBase& other)
+{
+ auto data = other.copyData();
</ins><span class="cx">
</span><ins>+ setURL(data->url);
+ setCachePolicy(data->cachePolicy);
+ setTimeoutInterval(data->timeoutInterval);
+ setFirstPartyForCookies(data->firstPartyForCookies);
+ setHTTPMethod(data->httpMethod);
+ setPriority(data->priority);
+ setRequester(data->requester);
+
+ updateResourceRequest();
+ m_httpHeaderFields.adopt(WTFMove(data->httpHeaders));
+
</ins><span class="cx"> size_t encodingCount = data->responseContentDispositionEncodingFallbackArray.size();
</span><span class="cx"> if (encodingCount > 0) {
</span><span class="cx"> String encoding1 = data->responseContentDispositionEncodingFallbackArray[0];
</span><span class="lines">@@ -74,12 +82,12 @@
</span><span class="cx"> encoding3 = data->responseContentDispositionEncodingFallbackArray[2];
</span><span class="cx"> }
</span><span class="cx"> ASSERT(encodingCount <= 3);
</span><del>- request->setResponseContentDispositionEncodingFallbackArray(encoding1, encoding2, encoding3);
</del><ins>+ setResponseContentDispositionEncodingFallbackArray(encoding1, encoding2, encoding3);
</ins><span class="cx"> }
</span><del>- request->setHTTPBody(data->httpBody.copyRef());
- request->setAllowCookies(data->allowCookies);
- request->doPlatformAdopt(WTFMove(data));
- return request;
</del><ins>+ setHTTPBody(data->httpBody.copyRef());
+ setAllowCookies(data->allowCookies);
+
+ const_cast<ResourceRequest&>(asResourceRequest()).doPlatformAdopt(WTFMove(data));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<CrossThreadResourceRequestData> ResourceRequestBase::copyData() const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceRequestBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.h (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceRequestBase.h        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.h        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -35,221 +35,222 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>- enum ResourceRequestCachePolicy {
- UseProtocolCachePolicy, // normal load
- ReloadIgnoringCacheData, // reload
- ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data
- ReturnCacheDataDontLoad // results of a post - allow stale data and only use cache
- };
</del><ins>+enum ResourceRequestCachePolicy {
+ UseProtocolCachePolicy, // normal load
+ ReloadIgnoringCacheData, // reload
+ ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data
+ ReturnCacheDataDontLoad // results of a post - allow stale data and only use cache
+};
</ins><span class="cx">
</span><del>- enum HTTPBodyUpdatePolicy {
- DoNotUpdateHTTPBody,
- UpdateHTTPBody
- };
</del><ins>+enum HTTPBodyUpdatePolicy {
+ DoNotUpdateHTTPBody,
+ UpdateHTTPBody
+};
</ins><span class="cx">
</span><del>- class ResourceRequest;
- struct CrossThreadResourceRequestData;
</del><ins>+class ResourceRequest;
+struct CrossThreadResourceRequestData;
</ins><span class="cx">
</span><del>- // Do not use this type directly. Use ResourceRequest instead.
- class ResourceRequestBase {
- WTF_MAKE_FAST_ALLOCATED;
- public:
- WEBCORE_EXPORT static std::unique_ptr<ResourceRequest> adopt(std::unique_ptr<CrossThreadResourceRequestData>);
</del><ins>+// Do not use this type directly. Use ResourceRequest instead.
+class ResourceRequestBase {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ ResourceRequest isolatedCopy() const;
+ WEBCORE_EXPORT void setAsIsolatedCopy(const ResourceRequestBase&);
</ins><span class="cx">
</span><del>- // Gets a copy of the data suitable for passing to another thread.
- WEBCORE_EXPORT std::unique_ptr<CrossThreadResourceRequestData> copyData() const;
</del><ins>+ WEBCORE_EXPORT bool isNull() const;
+ WEBCORE_EXPORT bool isEmpty() const;
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT bool isNull() const;
- WEBCORE_EXPORT bool isEmpty() const;
</del><ins>+ WEBCORE_EXPORT const URL& url() const;
+ WEBCORE_EXPORT void setURL(const URL& url);
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT const URL& url() const;
- WEBCORE_EXPORT void setURL(const URL& url);
</del><ins>+ WEBCORE_EXPORT void removeCredentials();
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT void removeCredentials();
</del><ins>+ WEBCORE_EXPORT ResourceRequestCachePolicy cachePolicy() const;
+ WEBCORE_EXPORT void setCachePolicy(ResourceRequestCachePolicy cachePolicy);
+
+ double timeoutInterval() const; // May return 0 when using platform default.
+ void setTimeoutInterval(double timeoutInterval);
+
+ WEBCORE_EXPORT const URL& firstPartyForCookies() const;
+ WEBCORE_EXPORT void setFirstPartyForCookies(const URL&);
+
+ WEBCORE_EXPORT const String& httpMethod() const;
+ WEBCORE_EXPORT void setHTTPMethod(const String& httpMethod);
+
+ WEBCORE_EXPORT const HTTPHeaderMap& httpHeaderFields() const;
+ WEBCORE_EXPORT void setHTTPHeaderFields(HTTPHeaderMap);
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT ResourceRequestCachePolicy cachePolicy() const;
- WEBCORE_EXPORT void setCachePolicy(ResourceRequestCachePolicy cachePolicy);
-
- double timeoutInterval() const; // May return 0 when using platform default.
- void setTimeoutInterval(double timeoutInterval);
-
- WEBCORE_EXPORT const URL& firstPartyForCookies() const;
- WEBCORE_EXPORT void setFirstPartyForCookies(const URL&);
-
- WEBCORE_EXPORT const String& httpMethod() const;
- WEBCORE_EXPORT void setHTTPMethod(const String& httpMethod);
-
- WEBCORE_EXPORT const HTTPHeaderMap& httpHeaderFields() const;
- WEBCORE_EXPORT void setHTTPHeaderFields(HTTPHeaderMap);
</del><ins>+ WEBCORE_EXPORT String httpHeaderField(const String& name) const;
+ WEBCORE_EXPORT String httpHeaderField(HTTPHeaderName) const;
+ WEBCORE_EXPORT void setHTTPHeaderField(const String& name, const String& value);
+ WEBCORE_EXPORT void setHTTPHeaderField(HTTPHeaderName, const String& value);
+ void addHTTPHeaderField(HTTPHeaderName, const String& value);
+ void addHTTPHeaderField(const String& name, const String& value);
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT String httpHeaderField(const String& name) const;
- WEBCORE_EXPORT String httpHeaderField(HTTPHeaderName) const;
- WEBCORE_EXPORT void setHTTPHeaderField(const String& name, const String& value);
- WEBCORE_EXPORT void setHTTPHeaderField(HTTPHeaderName, const String& value);
- void addHTTPHeaderField(HTTPHeaderName, const String& value);
- void addHTTPHeaderField(const String& name, const String& value);
</del><ins>+ // Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead.
+ template<size_t length> String httpHeaderField(const char (&)[length]) const = delete;
+ template<size_t length> void setHTTPHeaderField(const char (&)[length], const String&) = delete;
+ template<size_t length> void addHTTPHeaderField(const char (&)[length], const String&) = delete;
</ins><span class="cx">
</span><del>- // Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead.
- template<size_t length> String httpHeaderField(const char (&)[length]) const = delete;
- template<size_t length> void setHTTPHeaderField(const char (&)[length], const String&) = delete;
- template<size_t length> void addHTTPHeaderField(const char (&)[length], const String&) = delete;
</del><ins>+ WEBCORE_EXPORT void clearHTTPAuthorization();
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT void clearHTTPAuthorization();
</del><ins>+ WEBCORE_EXPORT String httpContentType() const;
+ WEBCORE_EXPORT void setHTTPContentType(const String&);
+ void clearHTTPContentType();
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT String httpContentType() const;
- WEBCORE_EXPORT void setHTTPContentType(const String&);
- void clearHTTPContentType();
</del><ins>+ WEBCORE_EXPORT String httpReferrer() const;
+ WEBCORE_EXPORT void setHTTPReferrer(const String&);
+ WEBCORE_EXPORT void clearHTTPReferrer();
+
+ String httpOrigin() const;
+ void setHTTPOrigin(const String&);
+ WEBCORE_EXPORT void clearHTTPOrigin();
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT String httpReferrer() const;
- WEBCORE_EXPORT void setHTTPReferrer(const String&);
- WEBCORE_EXPORT void clearHTTPReferrer();
-
- String httpOrigin() const;
- void setHTTPOrigin(const String&);
- WEBCORE_EXPORT void clearHTTPOrigin();
</del><ins>+ WEBCORE_EXPORT String httpUserAgent() const;
+ WEBCORE_EXPORT void setHTTPUserAgent(const String&);
+ void clearHTTPUserAgent();
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT String httpUserAgent() const;
- WEBCORE_EXPORT void setHTTPUserAgent(const String&);
- void clearHTTPUserAgent();
</del><ins>+ String httpAccept() const;
+ void setHTTPAccept(const String&);
+ void clearHTTPAccept();
</ins><span class="cx">
</span><del>- String httpAccept() const;
- void setHTTPAccept(const String&);
- void clearHTTPAccept();
</del><ins>+ void clearHTTPAcceptEncoding();
</ins><span class="cx">
</span><del>- void clearHTTPAcceptEncoding();
</del><ins>+ const Vector<String>& responseContentDispositionEncodingFallbackArray() const { return m_responseContentDispositionEncodingFallbackArray; }
+ WEBCORE_EXPORT void setResponseContentDispositionEncodingFallbackArray(const String& encoding1, const String& encoding2 = String(), const String& encoding3 = String());
</ins><span class="cx">
</span><del>- const Vector<String>& responseContentDispositionEncodingFallbackArray() const { return m_responseContentDispositionEncodingFallbackArray; }
- WEBCORE_EXPORT void setResponseContentDispositionEncodingFallbackArray(const String& encoding1, const String& encoding2 = String(), const String& encoding3 = String());
</del><ins>+ WEBCORE_EXPORT FormData* httpBody() const;
+ WEBCORE_EXPORT void setHTTPBody(RefPtr<FormData>&&);
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT FormData* httpBody() const;
- WEBCORE_EXPORT void setHTTPBody(RefPtr<FormData>&&);
</del><ins>+ bool allowCookies() const;
+ void setAllowCookies(bool allowCookies);
</ins><span class="cx">
</span><del>- bool allowCookies() const;
- void setAllowCookies(bool allowCookies);
</del><ins>+ WEBCORE_EXPORT ResourceLoadPriority priority() const;
+ WEBCORE_EXPORT void setPriority(ResourceLoadPriority);
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT ResourceLoadPriority priority() const;
- WEBCORE_EXPORT void setPriority(ResourceLoadPriority);
</del><ins>+ WEBCORE_EXPORT bool isConditional() const;
+ WEBCORE_EXPORT void makeUnconditional();
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT bool isConditional() const;
- WEBCORE_EXPORT void makeUnconditional();
</del><ins>+ // Whether the associated ResourceHandleClient needs to be notified of
+ // upload progress made for that resource.
+ bool reportUploadProgress() const { return m_reportUploadProgress; }
+ void setReportUploadProgress(bool reportUploadProgress) { m_reportUploadProgress = reportUploadProgress; }
</ins><span class="cx">
</span><del>- // Whether the associated ResourceHandleClient needs to be notified of
- // upload progress made for that resource.
- bool reportUploadProgress() const { return m_reportUploadProgress; }
- void setReportUploadProgress(bool reportUploadProgress) { m_reportUploadProgress = reportUploadProgress; }
</del><ins>+ // Whether the timing information should be collected for the request.
+ bool reportLoadTiming() const { return m_reportLoadTiming; }
+ void setReportLoadTiming(bool reportLoadTiming) { m_reportLoadTiming = reportLoadTiming; }
</ins><span class="cx">
</span><del>- // Whether the timing information should be collected for the request.
- bool reportLoadTiming() const { return m_reportLoadTiming; }
- void setReportLoadTiming(bool reportLoadTiming) { m_reportLoadTiming = reportLoadTiming; }
</del><ins>+ // Whether actual headers being sent/received should be collected and reported for the request.
+ bool reportRawHeaders() const { return m_reportRawHeaders; }
+ void setReportRawHeaders(bool reportRawHeaders) { m_reportRawHeaders = reportRawHeaders; }
</ins><span class="cx">
</span><del>- // Whether actual headers being sent/received should be collected and reported for the request.
- bool reportRawHeaders() const { return m_reportRawHeaders; }
- void setReportRawHeaders(bool reportRawHeaders) { m_reportRawHeaders = reportRawHeaders; }
</del><ins>+ // Whether this request should be hidden from the Inspector.
+ bool hiddenFromInspector() const { return m_hiddenFromInspector; }
+ void setHiddenFromInspector(bool hiddenFromInspector) { m_hiddenFromInspector = hiddenFromInspector; }
</ins><span class="cx">
</span><del>- // Whether this request should be hidden from the Inspector.
- bool hiddenFromInspector() const { return m_hiddenFromInspector; }
- void setHiddenFromInspector(bool hiddenFromInspector) { m_hiddenFromInspector = hiddenFromInspector; }
</del><ins>+ enum class Requester { Unspecified, Main, XHR, Media };
+ Requester requester() const { return m_requester; }
+ void setRequester(Requester requester) { m_requester = requester; }
</ins><span class="cx">
</span><del>- enum class Requester { Unspecified, Main, XHR, Media };
- Requester requester() const { return m_requester; }
- void setRequester(Requester requester) { m_requester = requester; }
-
</del><span class="cx"> #if !PLATFORM(COCOA)
</span><del>- bool encodingRequiresPlatformData() const { return true; }
</del><ins>+ bool encodingRequiresPlatformData() const { return true; }
</ins><span class="cx"> #endif
</span><del>- template<class Encoder> void encodeWithoutPlatformData(Encoder&) const;
- template<class Decoder> bool decodeWithoutPlatformData(Decoder&);
</del><ins>+ template<class Encoder> void encodeWithoutPlatformData(Encoder&) const;
+ template<class Decoder> bool decodeWithoutPlatformData(Decoder&);
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT static double defaultTimeoutInterval(); // May return 0 when using platform default.
- WEBCORE_EXPORT static void setDefaultTimeoutInterval(double);
</del><ins>+ WEBCORE_EXPORT static double defaultTimeoutInterval(); // May return 0 when using platform default.
+ WEBCORE_EXPORT static void setDefaultTimeoutInterval(double);
</ins><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>- WEBCORE_EXPORT static bool defaultAllowCookies();
- WEBCORE_EXPORT static void setDefaultAllowCookies(bool);
</del><ins>+ WEBCORE_EXPORT static bool defaultAllowCookies();
+ WEBCORE_EXPORT static void setDefaultAllowCookies(bool);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- static bool compare(const ResourceRequest&, const ResourceRequest&);
</del><ins>+ static bool compare(const ResourceRequest&, const ResourceRequest&);
</ins><span class="cx">
</span><del>- protected:
- // Used when ResourceRequest is initialized from a platform representation of the request
- ResourceRequestBase()
- : m_platformRequestUpdated(true)
- , m_platformRequestBodyUpdated(true)
- {
- }
</del><ins>+protected:
+ // Used when ResourceRequest is initialized from a platform representation of the request
+ ResourceRequestBase()
+ : m_platformRequestUpdated(true)
+ , m_platformRequestBodyUpdated(true)
+ {
+ }
</ins><span class="cx">
</span><del>- ResourceRequestBase(const URL& url, ResourceRequestCachePolicy policy)
- : m_url(url)
- , m_timeoutInterval(s_defaultTimeoutInterval)
- , m_httpMethod(ASCIILiteral("GET"))
- , m_cachePolicy(policy)
</del><ins>+ ResourceRequestBase(const URL& url, ResourceRequestCachePolicy policy)
+ : m_url(url)
+ , m_timeoutInterval(s_defaultTimeoutInterval)
+ , m_httpMethod(ASCIILiteral("GET"))
+ , m_cachePolicy(policy)
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><del>- , m_allowCookies(true)
</del><ins>+ , m_allowCookies(true)
</ins><span class="cx"> #else
</span><del>- , m_allowCookies(ResourceRequestBase::defaultAllowCookies())
</del><ins>+ , m_allowCookies(ResourceRequestBase::defaultAllowCookies())
</ins><span class="cx"> #endif
</span><del>- , m_resourceRequestUpdated(true)
- , m_resourceRequestBodyUpdated(true)
- {
- }
</del><ins>+ , m_resourceRequestUpdated(true)
+ , m_resourceRequestBodyUpdated(true)
+ {
+ }
</ins><span class="cx">
</span><del>- void updatePlatformRequest(HTTPBodyUpdatePolicy = DoNotUpdateHTTPBody) const;
- void updateResourceRequest(HTTPBodyUpdatePolicy = DoNotUpdateHTTPBody) const;
</del><ins>+ void updatePlatformRequest(HTTPBodyUpdatePolicy = DoNotUpdateHTTPBody) const;
+ void updateResourceRequest(HTTPBodyUpdatePolicy = DoNotUpdateHTTPBody) const;
</ins><span class="cx">
</span><del>- // The ResourceRequest subclass may "shadow" this method to compare platform specific fields
- static bool platformCompare(const ResourceRequest&, const ResourceRequest&) { return true; }
</del><ins>+ // The ResourceRequest subclass may "shadow" this method to compare platform specific fields
+ static bool platformCompare(const ResourceRequest&, const ResourceRequest&) { return true; }
</ins><span class="cx">
</span><del>- URL m_url;
- double m_timeoutInterval; // 0 is a magic value for platform default on platforms that have one.
- URL m_firstPartyForCookies;
- String m_httpMethod;
- HTTPHeaderMap m_httpHeaderFields;
- Vector<String> m_responseContentDispositionEncodingFallbackArray;
- RefPtr<FormData> m_httpBody;
- ResourceRequestCachePolicy m_cachePolicy { UseProtocolCachePolicy };
- bool m_allowCookies { false };
- mutable bool m_resourceRequestUpdated { false };
- mutable bool m_platformRequestUpdated { false };
- mutable bool m_resourceRequestBodyUpdated { false };
- mutable bool m_platformRequestBodyUpdated { false };
- bool m_reportUploadProgress { false };
- bool m_reportLoadTiming { false };
- bool m_reportRawHeaders { false };
- bool m_hiddenFromInspector { false };
- ResourceLoadPriority m_priority { ResourceLoadPriority::Low };
- Requester m_requester { Requester::Unspecified };
</del><ins>+ URL m_url;
+ double m_timeoutInterval; // 0 is a magic value for platform default on platforms that have one.
+ URL m_firstPartyForCookies;
+ String m_httpMethod;
+ HTTPHeaderMap m_httpHeaderFields;
+ Vector<String> m_responseContentDispositionEncodingFallbackArray;
+ RefPtr<FormData> m_httpBody;
+ ResourceRequestCachePolicy m_cachePolicy { UseProtocolCachePolicy };
+ bool m_allowCookies { false };
+ mutable bool m_resourceRequestUpdated { false };
+ mutable bool m_platformRequestUpdated { false };
+ mutable bool m_resourceRequestBodyUpdated { false };
+ mutable bool m_platformRequestBodyUpdated { false };
+ bool m_reportUploadProgress { false };
+ bool m_reportLoadTiming { false };
+ bool m_reportRawHeaders { false };
+ bool m_hiddenFromInspector { false };
+ ResourceLoadPriority m_priority { ResourceLoadPriority::Low };
+ Requester m_requester { Requester::Unspecified };
</ins><span class="cx">
</span><del>- private:
- const ResourceRequest& asResourceRequest() const;
</del><ins>+private:
+ const ResourceRequest& asResourceRequest() const;
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT static double s_defaultTimeoutInterval;
</del><ins>+ // Gets a copy of the data suitable for passing to another thread.
+ std::unique_ptr<CrossThreadResourceRequestData> copyData() const;
+
+ WEBCORE_EXPORT static double s_defaultTimeoutInterval;
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>- static bool s_defaultAllowCookies;
</del><ins>+ static bool s_defaultAllowCookies;
</ins><span class="cx"> #endif
</span><del>- };
</del><ins>+};
</ins><span class="cx">
</span><del>- bool equalIgnoringHeaderFields(const ResourceRequestBase&, const ResourceRequestBase&);
</del><ins>+bool equalIgnoringHeaderFields(const ResourceRequestBase&, const ResourceRequestBase&);
</ins><span class="cx">
</span><del>- inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { return ResourceRequestBase::compare(a, b); }
- inline bool operator!=(ResourceRequest& a, const ResourceRequest& b) { return !(a == b); }
</del><ins>+inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { return ResourceRequestBase::compare(a, b); }
+inline bool operator!=(ResourceRequest& a, const ResourceRequest& b) { return !(a == b); }
</ins><span class="cx">
</span><del>- struct CrossThreadResourceRequestDataBase {
- URL url;
- ResourceRequestCachePolicy cachePolicy;
- double timeoutInterval;
- URL firstPartyForCookies;
- String httpMethod;
- std::unique_ptr<CrossThreadHTTPHeaderMapData> httpHeaders;
- Vector<String> responseContentDispositionEncodingFallbackArray;
- RefPtr<FormData> httpBody;
- bool allowCookies;
- ResourceLoadPriority priority;
- ResourceRequestBase::Requester requester;
- };
-
- WEBCORE_EXPORT unsigned initializeMaximumHTTPConnectionCountPerHost();
</del><ins>+struct CrossThreadResourceRequestDataBase {
+ URL url;
+ ResourceRequestCachePolicy cachePolicy;
+ double timeoutInterval;
+ URL firstPartyForCookies;
+ String httpMethod;
+ std::unique_ptr<CrossThreadHTTPHeaderMapData> httpHeaders;
+ Vector<String> responseContentDispositionEncodingFallbackArray;
+ RefPtr<FormData> httpBody;
+ bool allowCookies;
+ ResourceLoadPriority priority;
+ ResourceRequestBase::Requester requester;
+};
+
+WEBCORE_EXPORT unsigned initializeMaximumHTTPConnectionCountPerHost();
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>- WEBCORE_EXPORT void initializeHTTPConnectionSettingsOnStartup();
</del><ins>+WEBCORE_EXPORT void initializeHTTPConnectionSettingsOnStartup();
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> template<class Encoder>
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -63,23 +63,26 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::unique_ptr<ResourceResponse> ResourceResponseBase::adopt(std::unique_ptr<CrossThreadResourceResponseData> data)
</del><ins>+ResourceResponse ResourceResponseBase::isolatedCopy() const
</ins><span class="cx"> {
</span><del>- auto response = std::make_unique<ResourceResponse>();
- response->setURL(data->m_url);
- response->setMimeType(data->m_mimeType);
- response->setExpectedContentLength(data->m_expectedContentLength);
- response->setTextEncodingName(data->m_textEncodingName);
</del><ins>+ ResourceResponse response;
+ auto data = copyData();
</ins><span class="cx">
</span><del>- response->setHTTPStatusCode(data->m_httpStatusCode);
- response->setHTTPStatusText(data->m_httpStatusText);
- response->setHTTPVersion(data->m_httpVersion);
</del><ins>+ response.setURL(data->m_url);
+ response.setMimeType(data->m_mimeType);
+ response.setExpectedContentLength(data->m_expectedContentLength);
+ response.setTextEncodingName(data->m_textEncodingName);
</ins><span class="cx">
</span><del>- response->lazyInit(AllFields);
- response->m_httpHeaderFields.adopt(WTFMove(data->m_httpHeaders));
- response->m_resourceLoadTiming = data->m_resourceLoadTiming;
- response->m_type = data->m_type;
- response->doPlatformAdopt(WTFMove(data));
</del><ins>+ response.setHTTPStatusCode(data->m_httpStatusCode);
+ response.setHTTPStatusText(data->m_httpStatusText);
+ response.setHTTPVersion(data->m_httpVersion);
+
+ response.lazyInit(AllFields);
+ response.m_httpHeaderFields.adopt(WTFMove(data->m_httpHeaders));
+ response.m_resourceLoadTiming = data->m_resourceLoadTiming;
+ response.m_type = data->m_type;
+ response.doPlatformAdopt(WTFMove(data));
+
</ins><span class="cx"> return response;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -24,8 +24,7 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef ResourceResponseBase_h
-#define ResourceResponseBase_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "CacheValidation.h"
</span><span class="cx"> #include "CertificateInfo.h"
</span><span class="lines">@@ -47,11 +46,8 @@
</span><span class="cx"> class ResourceResponseBase {
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>- static std::unique_ptr<ResourceResponse> adopt(std::unique_ptr<CrossThreadResourceResponseData>);
</del><ins>+ ResourceResponse isolatedCopy() const;
</ins><span class="cx">
</span><del>- // Gets a copy of the data suitable for passing to another thread.
- std::unique_ptr<CrossThreadResourceResponseData> copyData() const;
-
</del><span class="cx"> bool isNull() const { return m_isNull; }
</span><span class="cx"> WEBCORE_EXPORT bool isHTTP() const;
</span><span class="cx">
</span><span class="lines">@@ -163,6 +159,9 @@
</span><span class="cx"> void parseCacheControlDirectives() const;
</span><span class="cx"> void updateHeaderParsedState(HTTPHeaderName);
</span><span class="cx">
</span><ins>+ // Gets a copy of the data suitable for passing to another thread.
+ std::unique_ptr<CrossThreadResourceResponseData> copyData() const;
+
</ins><span class="cx"> protected:
</span><span class="cx"> bool m_isNull;
</span><span class="cx"> URL m_url;
</span><span class="lines">@@ -293,5 +292,3 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // ResourceResponseBase_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceError.h (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceError.h        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/platform/network/cf/ResourceError.h        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef ResourceError_h
-#define ResourceError_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "ResourceErrorBase.h"
</span><span class="cx">
</span><span class="lines">@@ -61,8 +60,6 @@
</span><span class="cx"> WEBCORE_EXPORT CFErrorRef cfError() const;
</span><span class="cx"> WEBCORE_EXPORT operator CFErrorRef() const;
</span><span class="cx">
</span><del>- ResourceError isolatedCopy() const { return copy(); }
-
</del><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx"> ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, CFDataRef certificate);
</span><span class="lines">@@ -102,5 +99,3 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // ResourceError_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequest.h (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceRequest.h        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequest.h        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -38,120 +38,118 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>- class ResourceRequest : public ResourceRequestBase {
- public:
- ResourceRequest(const String& url)
- : ResourceRequestBase(URL(ParsedURLString, url), UseProtocolCachePolicy)
- {
- }
</del><ins>+class ResourceRequest : public ResourceRequestBase {
+public:
+ ResourceRequest(const String& url)
+ : ResourceRequestBase(URL(ParsedURLString, url), UseProtocolCachePolicy)
+ {
+ }
</ins><span class="cx">
</span><del>- ResourceRequest(const URL& url)
- : ResourceRequestBase(url, UseProtocolCachePolicy)
- {
- }
</del><ins>+ ResourceRequest(const URL& url)
+ : ResourceRequestBase(url, UseProtocolCachePolicy)
+ {
+ }
</ins><span class="cx">
</span><del>- ResourceRequest(const URL& url, const String& referrer, ResourceRequestCachePolicy policy = UseProtocolCachePolicy)
- : ResourceRequestBase(url, policy)
- {
- setHTTPReferrer(referrer);
- }
-
- ResourceRequest()
- : ResourceRequestBase(URL(), UseProtocolCachePolicy)
- {
- }
-
</del><ins>+ ResourceRequest(const URL& url, const String& referrer, ResourceRequestCachePolicy policy = UseProtocolCachePolicy)
+ : ResourceRequestBase(url, policy)
+ {
+ setHTTPReferrer(referrer);
+ }
+
+ ResourceRequest()
+ : ResourceRequestBase(URL(), UseProtocolCachePolicy)
+ {
+ }
+
</ins><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>- WEBCORE_EXPORT ResourceRequest(NSURLRequest *);
- void updateNSURLRequest();
- void clearOrUpdateNSURLRequest();
</del><ins>+ WEBCORE_EXPORT ResourceRequest(NSURLRequest *);
+ void updateNSURLRequest();
+ void clearOrUpdateNSURLRequest();
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- ResourceRequest(CFURLRequestRef cfRequest)
- : ResourceRequestBase()
- , m_cfRequest(cfRequest)
- {
- }
</del><ins>+ ResourceRequest(CFURLRequestRef cfRequest)
+ : ResourceRequestBase()
+ , m_cfRequest(cfRequest)
+ {
+ }
</ins><span class="cx"> #else
</span><del>- ResourceRequest(NSURLRequest *nsRequest)
- : ResourceRequestBase()
- , m_nsRequest(nsRequest)
- {
- }
</del><ins>+ ResourceRequest(NSURLRequest *nsRequest)
+ : ResourceRequestBase()
+ , m_nsRequest(nsRequest)
+ {
+ }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- ResourceRequest isolatedCopy() const { return *ResourceRequest::adopt(copyData()); }
</del><ins>+ WEBCORE_EXPORT void updateFromDelegatePreservingOldProperties(const ResourceRequest&);
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT void updateFromDelegatePreservingOldProperties(const ResourceRequest&);
-
</del><span class="cx"> #if PLATFORM(MAC)
</span><del>- void applyWebArchiveHackForMail();
</del><ins>+ void applyWebArchiveHackForMail();
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> #if USE(CFNETWORK)
</span><del>- bool encodingRequiresPlatformData() const { return m_httpBody || m_cfRequest; }
</del><ins>+ bool encodingRequiresPlatformData() const { return m_httpBody || m_cfRequest; }
</ins><span class="cx"> #else
</span><del>- bool encodingRequiresPlatformData() const { return m_httpBody || m_nsRequest; }
</del><ins>+ bool encodingRequiresPlatformData() const { return m_httpBody || m_nsRequest; }
</ins><span class="cx"> #endif
</span><del>- WEBCORE_EXPORT NSURLRequest *nsURLRequest(HTTPBodyUpdatePolicy) const;
</del><ins>+ WEBCORE_EXPORT NSURLRequest *nsURLRequest(HTTPBodyUpdatePolicy) const;
</ins><span class="cx">
</span><del>- WEBCORE_EXPORT static CFStringRef isUserInitiatedKey();
</del><ins>+ WEBCORE_EXPORT static CFStringRef isUserInitiatedKey();
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>- WEBCORE_EXPORT static String partitionName(const String& domain);
- const String& cachePartition() const { return m_cachePartition.isNull() ? emptyString() : m_cachePartition; }
- void setCachePartition(const String& cachePartition)
- {
- ASSERT(cachePartition == partitionName(cachePartition));
- m_cachePartition = cachePartition;
- }
- void setDomainForCachePartition(const String& domain) { m_cachePartition = partitionName(domain); }
</del><ins>+ WEBCORE_EXPORT static String partitionName(const String& domain);
+ const String& cachePartition() const { return m_cachePartition.isNull() ? emptyString() : m_cachePartition; }
+ void setCachePartition(const String& cachePartition)
+ {
+ ASSERT(cachePartition == partitionName(cachePartition));
+ m_cachePartition = cachePartition;
+ }
+ void setDomainForCachePartition(const String& domain) { m_cachePartition = partitionName(domain); }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA) || USE(CFNETWORK)
</span><del>- WEBCORE_EXPORT CFURLRequestRef cfURLRequest(HTTPBodyUpdatePolicy) const;
- void setStorageSession(CFURLStorageSessionRef);
</del><ins>+ WEBCORE_EXPORT CFURLRequestRef cfURLRequest(HTTPBodyUpdatePolicy) const;
+ void setStorageSession(CFURLStorageSessionRef);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- WEBCORE_EXPORT static bool httpPipeliningEnabled();
- WEBCORE_EXPORT static void setHTTPPipeliningEnabled(bool);
</del><ins>+ WEBCORE_EXPORT static bool httpPipeliningEnabled();
+ WEBCORE_EXPORT static void setHTTPPipeliningEnabled(bool);
</ins><span class="cx">
</span><del>- static bool resourcePrioritiesEnabled();
</del><ins>+ static bool resourcePrioritiesEnabled();
</ins><span class="cx">
</span><del>- private:
- friend class ResourceRequestBase;
</del><ins>+private:
+ friend class ResourceRequestBase;
</ins><span class="cx">
</span><del>- void doUpdatePlatformRequest();
- void doUpdateResourceRequest();
- void doUpdatePlatformHTTPBody();
- void doUpdateResourceHTTPBody();
</del><ins>+ void doUpdatePlatformRequest();
+ void doUpdateResourceRequest();
+ void doUpdatePlatformHTTPBody();
+ void doUpdateResourceHTTPBody();
</ins><span class="cx">
</span><del>- std::unique_ptr<CrossThreadResourceRequestData> doPlatformCopyData(std::unique_ptr<CrossThreadResourceRequestData>) const;
- void doPlatformAdopt(std::unique_ptr<CrossThreadResourceRequestData>);
</del><ins>+ std::unique_ptr<CrossThreadResourceRequestData> doPlatformCopyData(std::unique_ptr<CrossThreadResourceRequestData>) const;
+ void doPlatformAdopt(std::unique_ptr<CrossThreadResourceRequestData>);
</ins><span class="cx">
</span><span class="cx"> #if USE(CFNETWORK)
</span><del>- RetainPtr<CFURLRequestRef> m_cfRequest;
</del><ins>+ RetainPtr<CFURLRequestRef> m_cfRequest;
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>- RetainPtr<NSURLRequest> m_nsRequest;
</del><ins>+ RetainPtr<NSURLRequest> m_nsRequest;
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>- String m_cachePartition;
</del><ins>+ String m_cachePartition;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- static bool s_httpPipeliningEnabled;
- };
</del><ins>+ static bool s_httpPipeliningEnabled;
+};
</ins><span class="cx">
</span><del>- struct CrossThreadResourceRequestData : public CrossThreadResourceRequestDataBase {
</del><ins>+struct CrossThreadResourceRequestData : public CrossThreadResourceRequestDataBase {
</ins><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><del>- String m_cachePartition;
</del><ins>+ String m_cachePartition;
</ins><span class="cx"> #endif
</span><del>- };
</del><ins>+};
</ins><span class="cx">
</span><del>- inline bool ResourceRequest::resourcePrioritiesEnabled()
- {
</del><ins>+inline bool ResourceRequest::resourcePrioritiesEnabled()
+{
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> return true;
</span><span class="cx"> #elif PLATFORM(IOS)
</span><span class="lines">@@ -159,7 +157,6 @@
</span><span class="cx"> #elif PLATFORM(WIN)
</span><span class="cx"> return false;
</span><span class="cx"> #endif
</span><del>- }
</del><ins>+}
</ins><span class="cx">
</span><del>-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceResponseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceResponse.h (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceResponse.h        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebCore/platform/network/cf/ResourceResponse.h        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -72,8 +72,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>- ResourceResponse isolatedCopy() const { return *ResourceResponse::adopt(copyData()); }
-
</del><span class="cx"> unsigned memoryUsage() const
</span><span class="cx"> {
</span><span class="cx"> // FIXME: Find some programmatic lighweight way to calculate ResourceResponse and associated classes.
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebKit2/ChangeLog        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-06-02 Brady Eidson <beidson@apple.com>
+
+ Overhaul cross-thread use of ResourceRequest, ResourceResponse, and ResourceError.
+ https://bugs.webkit.org/show_bug.cgi?id=158293
+
+ Reviewed by Darin Adler.
+
+ * NetworkProcess/cache/NetworkCacheEntry.cpp:
+ (WebKit::NetworkCache::Entry::Entry):
+
</ins><span class="cx"> 2016-06-02 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Modernize various lambda captures
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheEntrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp (201602 => 201603)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp        2016-06-02 17:59:56 UTC (rev 201602)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheEntry.cpp        2016-06-02 18:17:47 UTC (rev 201603)
</span><span class="lines">@@ -54,10 +54,12 @@
</span><span class="cx"> , m_timeStamp(std::chrono::system_clock::now())
</span><span class="cx"> , m_response(response)
</span><span class="cx"> , m_varyingRequestHeaders(varyingRequestHeaders)
</span><del>- , m_redirectRequest(WebCore::ResourceRequest::adopt(redirectRequest.copyData())) // Don't include the underlying platform request object.
</del><span class="cx"> {
</span><span class="cx"> ASSERT(m_key.type() == "resource");
</span><span class="cx"> // Redirect body is not needed even if exists.
</span><ins>+
+ m_redirectRequest = std::make_unique<WebCore::ResourceRequest>();
+ m_redirectRequest->setAsIsolatedCopy(redirectRequest);
</ins><span class="cx"> m_redirectRequest->setHTTPBody(nullptr);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>