<!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>[192062] trunk/Source/WebKit2</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/192062">192062</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-11-05 11:25:29 -0800 (Thu, 05 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WK2] Clean up / Modernize NetworkResourceLoader
https://bugs.webkit.org/show_bug.cgi?id=150922
Reviewed by Andreas Kling.
Clean up / Modernize NetworkResourceLoader.
* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::filesInBlob):
* NetworkProcess/FileAPI/NetworkBlobRegistry.h:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
(WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::SynchronousLoadData::SynchronousLoadData):
(WebKit::sendReplyToSynchronousRequest):
(WebKit::NetworkResourceLoader::NetworkResourceLoader):
(WebKit::NetworkResourceLoader::startNetworkLoad):
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::willSendRedirectedRequest):
(WebKit::NetworkResourceLoader::bufferingTimerFired):
(WebKit::NetworkResourceLoader::sendBufferMaybeAborting):
(WebKit::NetworkResourceLoader::validateCacheEntry):
(WebKit::NetworkResourceLoader::messageSenderConnection):
(WebKit::NetworkResourceLoader::invalidateSandboxExtensions):
(WebKit::NetworkResourceLoader::~NetworkResourceLoader): Deleted.
(WebKit::NetworkResourceLoader::didReceiveBuffer): Deleted.
(WebKit::NetworkResourceLoader::didRetrieveCacheEntry): Deleted.
(WebKit::NetworkResourceLoader::consumeSandboxExtensions): Deleted.
(WebKit::NetworkResourceLoader::sendAbortingOnFailure): Deleted.
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/mac/NetworkDiskCacheMonitor.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistrycpp">trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistryh">trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcesscpp">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessh">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkResourceLoaderh">trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitorh">trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (192061 => 192062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-11-05 19:22:42 UTC (rev 192061)
+++ trunk/Source/WebKit2/ChangeLog        2015-11-05 19:25:29 UTC (rev 192062)
</span><span class="lines">@@ -1,5 +1,41 @@
</span><span class="cx"> 2015-11-05 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><ins>+ [WK2] Clean up / Modernize NetworkResourceLoader
+ https://bugs.webkit.org/show_bug.cgi?id=150922
+
+ Reviewed by Andreas Kling.
+
+ Clean up / Modernize NetworkResourceLoader.
+
+ * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
+ (WebKit::NetworkBlobRegistry::filesInBlob):
+ * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
+ * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+ (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
+ (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
+ * NetworkProcess/NetworkConnectionToWebProcess.h:
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::SynchronousLoadData::SynchronousLoadData):
+ (WebKit::sendReplyToSynchronousRequest):
+ (WebKit::NetworkResourceLoader::NetworkResourceLoader):
+ (WebKit::NetworkResourceLoader::startNetworkLoad):
+ (WebKit::NetworkResourceLoader::didFinishLoading):
+ (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
+ (WebKit::NetworkResourceLoader::bufferingTimerFired):
+ (WebKit::NetworkResourceLoader::sendBufferMaybeAborting):
+ (WebKit::NetworkResourceLoader::validateCacheEntry):
+ (WebKit::NetworkResourceLoader::messageSenderConnection):
+ (WebKit::NetworkResourceLoader::invalidateSandboxExtensions):
+ (WebKit::NetworkResourceLoader::~NetworkResourceLoader): Deleted.
+ (WebKit::NetworkResourceLoader::didReceiveBuffer): Deleted.
+ (WebKit::NetworkResourceLoader::didRetrieveCacheEntry): Deleted.
+ (WebKit::NetworkResourceLoader::consumeSandboxExtensions): Deleted.
+ (WebKit::NetworkResourceLoader::sendAbortingOnFailure): Deleted.
+ * NetworkProcess/NetworkResourceLoader.h:
+ * NetworkProcess/mac/NetworkDiskCacheMonitor.h:
+
+2015-11-05 Chris Dumez <cdumez@apple.com>
+
</ins><span class="cx"> Regression(r192038): Safari cannot load any pages
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=150937
</span><span class="cx"> <rdar://problem/23413859>
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp (192061 => 192062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp        2015-11-05 19:22:42 UTC (rev 192061)
+++ trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp        2015-11-05 19:25:29 UTC (rev 192062)
</span><span class="lines">@@ -131,9 +131,9 @@
</span><span class="cx"> m_blobsForConnection.remove(connection);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Vector<RefPtr<BlobDataFileReference>> NetworkBlobRegistry::filesInBlob(NetworkConnectionToWebProcess* connection, const WebCore::URL& url)
</del><ins>+Vector<RefPtr<BlobDataFileReference>> NetworkBlobRegistry::filesInBlob(NetworkConnectionToWebProcess& connection, const WebCore::URL& url)
</ins><span class="cx"> {
</span><del>- if (!m_blobsForConnection.contains(connection) || !m_blobsForConnection.find(connection)->value.contains(url))
</del><ins>+ if (!m_blobsForConnection.contains(&connection) || !m_blobsForConnection.find(&connection)->value.contains(url))
</ins><span class="cx"> return Vector<RefPtr<BlobDataFileReference>>();
</span><span class="cx">
</span><span class="cx"> ASSERT(blobRegistry().isBlobRegistryImpl());
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h (192061 => 192062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h        2015-11-05 19:22:42 UTC (rev 192061)
+++ trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h        2015-11-05 19:25:29 UTC (rev 192062)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">
</span><span class="cx"> void connectionToWebProcessDidClose(NetworkConnectionToWebProcess*);
</span><span class="cx">
</span><del>- Vector<RefPtr<WebCore::BlobDataFileReference>> filesInBlob(NetworkConnectionToWebProcess*, const WebCore::URL&);
</del><ins>+ Vector<RefPtr<WebCore::BlobDataFileReference>> filesInBlob(NetworkConnectionToWebProcess&, const WebCore::URL&);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> ~NetworkBlobRegistry();
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (192061 => 192062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp        2015-11-05 19:22:42 UTC (rev 192061)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp        2015-11-05 19:25:29 UTC (rev 192062)
</span><span class="lines">@@ -118,14 +118,14 @@
</span><span class="cx">
</span><span class="cx"> void NetworkConnectionToWebProcess::scheduleResourceLoad(const NetworkResourceLoadParameters& loadParameters)
</span><span class="cx"> {
</span><del>- auto loader = NetworkResourceLoader::create(loadParameters, this);
</del><ins>+ auto loader = NetworkResourceLoader::create(loadParameters, *this);
</ins><span class="cx"> m_networkResourceLoaders.add(loadParameters.identifier, loader.ptr());
</span><span class="cx"> loader->start();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void NetworkConnectionToWebProcess::performSynchronousLoad(const NetworkResourceLoadParameters& loadParameters, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> reply)
</del><ins>+void NetworkConnectionToWebProcess::performSynchronousLoad(const NetworkResourceLoadParameters& loadParameters, RefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>&& reply)
</ins><span class="cx"> {
</span><del>- auto loader = NetworkResourceLoader::create(loadParameters, this, reply);
</del><ins>+ auto loader = NetworkResourceLoader::create(loadParameters, *this, WTF::move(reply));
</ins><span class="cx"> m_networkResourceLoaders.add(loadParameters.identifier, loader.ptr());
</span><span class="cx"> loader->start();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h (192061 => 192062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h        2015-11-05 19:22:42 UTC (rev 192061)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h        2015-11-05 19:25:29 UTC (rev 192062)
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx"> void didReceiveSyncNetworkConnectionToWebProcessMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&);
</span><span class="cx">
</span><span class="cx"> void scheduleResourceLoad(const NetworkResourceLoadParameters&);
</span><del>- void performSynchronousLoad(const NetworkResourceLoadParameters&, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>);
</del><ins>+ void performSynchronousLoad(const NetworkResourceLoadParameters&, RefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>&&);
</ins><span class="cx"> void loadPing(const NetworkResourceLoadParameters&);
</span><span class="cx"> void prefetchDNS(const String&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (192061 => 192062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2015-11-05 19:22:42 UTC (rev 192061)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2015-11-05 19:25:29 UTC (rev 192062)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -34,11 +34,7 @@
</span><span class="cx"> #include "NetworkCache.h"
</span><span class="cx"> #include "NetworkConnectionToWebProcess.h"
</span><span class="cx"> #include "NetworkLoad.h"
</span><del>-#include "NetworkProcess.h"
</del><span class="cx"> #include "NetworkProcessConnectionMessages.h"
</span><del>-#include "NetworkResourceLoadParameters.h"
-#include "ShareableResource.h"
-#include "SharedMemory.h"
</del><span class="cx"> #include "WebCoreArgumentCoders.h"
</span><span class="cx"> #include "WebResourceLoaderMessages.h"
</span><span class="cx"> #include <WebCore/BlobDataFileReference.h>
</span><span class="lines">@@ -48,25 +44,25 @@
</span><span class="cx"> #include <WebCore/SharedBuffer.h>
</span><span class="cx"> #include <WebCore/SynchronousLoaderClient.h>
</span><span class="cx"> #include <wtf/CurrentTime.h>
</span><del>-#include <wtf/MainThread.h>
</del><ins>+#include <wtf/RunLoop.h>
</ins><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> struct NetworkResourceLoader::SynchronousLoadData {
</span><del>- SynchronousLoadData(PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> reply)
- : delayedReply(reply)
</del><ins>+ SynchronousLoadData(RefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>&& reply)
+ : delayedReply(WTF::move(reply))
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(delayedReply);
</span><span class="cx"> }
</span><del>- WebCore::ResourceRequest currentRequest;
</del><ins>+ ResourceRequest currentRequest;
</ins><span class="cx"> RefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> delayedReply;
</span><del>- WebCore::ResourceResponse response;
- WebCore::ResourceError error;
</del><ins>+ ResourceResponse response;
+ ResourceError error;
</ins><span class="cx"> };
</span><span class="cx">
</span><del>-static void sendReplyToSynchronousRequest(NetworkResourceLoader::SynchronousLoadData& data, const WebCore::SharedBuffer* buffer)
</del><ins>+static void sendReplyToSynchronousRequest(NetworkResourceLoader::SynchronousLoadData& data, const SharedBuffer* buffer)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(data.delayedReply);
</span><span class="cx"> ASSERT(!data.response.isNull() || !data.error.isNull());
</span><span class="lines">@@ -79,13 +75,9 @@
</span><span class="cx"> data.delayedReply = nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-NetworkResourceLoader::NetworkResourceLoader(const NetworkResourceLoadParameters& parameters, NetworkConnectionToWebProcess* connection, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> synchronousReply)
</del><ins>+NetworkResourceLoader::NetworkResourceLoader(const NetworkResourceLoadParameters& parameters, NetworkConnectionToWebProcess& connection, RefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>&& synchronousReply)
</ins><span class="cx"> : m_parameters(parameters)
</span><span class="cx"> , m_connection(connection)
</span><del>- , m_bytesReceived(0)
- , m_bufferedDataEncodedDataLength(0)
- , m_didConvertHandleToDownload(false)
- , m_didConsumeSandboxExtensions(false)
</del><span class="cx"> , m_defersLoading(parameters.defersLoading)
</span><span class="cx"> , m_bufferingTimer(*this, &NetworkResourceLoader::bufferingTimerFired)
</span><span class="cx"> {
</span><span class="lines">@@ -95,7 +87,7 @@
</span><span class="cx"> ASSERT((m_parameters.webPageID && m_parameters.webFrameID) || m_parameters.clientCredentialPolicy == DoNotAskClientForAnyCredentials);
</span><span class="cx">
</span><span class="cx"> if (originalRequest().httpBody()) {
</span><del>- for (const FormDataElement& element : originalRequest().httpBody()->elements()) {
</del><ins>+ for (const auto& element : originalRequest().httpBody()->elements()) {
</ins><span class="cx"> if (element.m_type == FormDataElement::Type::EncodedBlob)
</span><span class="cx"> m_fileReferences.appendVector(NetworkBlobRegistry::singleton().filesInBlob(connection, element.m_url));
</span><span class="cx"> }
</span><span class="lines">@@ -107,7 +99,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (synchronousReply)
</span><del>- m_synchronousLoadData = std::make_unique<SynchronousLoadData>(synchronousReply);
</del><ins>+ m_synchronousLoadData = std::make_unique<SynchronousLoadData>(WTF::move(synchronousReply));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> NetworkResourceLoader::~NetworkResourceLoader()
</span><span class="lines">@@ -165,11 +157,11 @@
</span><span class="cx"> consumeSandboxExtensions();
</span><span class="cx">
</span><span class="cx"> if (isSynchronous() || m_parameters.maximumBufferingTime > 0_ms)
</span><del>- m_bufferedData = WebCore::SharedBuffer::create();
</del><ins>+ m_bufferedData = SharedBuffer::create();
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(NETWORK_CACHE)
</span><span class="cx"> if (NetworkCache::singleton().isEnabled())
</span><del>- m_bufferedDataForCache = WebCore::SharedBuffer::create();
</del><ins>+ m_bufferedDataForCache = SharedBuffer::create();
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> NetworkLoadParameters parameters = m_parameters;
</span><span class="lines">@@ -275,9 +267,8 @@
</span><span class="cx"> #if ENABLE(NETWORK_CACHE)
</span><span class="cx"> shouldContinueDidReceiveResponse = shouldContinueDidReceiveResponse || m_cacheEntryForValidation;
</span><span class="cx"> #endif
</span><del>- if (!shouldContinueDidReceiveResponse)
- return ShouldContinueDidReceiveResponse::No;
- return ShouldContinueDidReceiveResponse::Yes;
</del><ins>+
+ return shouldContinueDidReceiveResponse ? ShouldContinueDidReceiveResponse::Yes : ShouldContinueDidReceiveResponse::No;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void NetworkResourceLoader::didReceiveBuffer(RefPtr<SharedBuffer>&& buffer, int reportedEncodedDataLength)
</span><span class="lines">@@ -319,18 +310,18 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> bool allowStale = originalRequest().cachePolicy() >= ReturnCacheDataElseLoad;
</span><del>- bool hasCacheableRedirect = m_response.isHTTP() && WebCore::redirectChainAllowsReuse(m_redirectChainCacheStatus, allowStale ? WebCore::ReuseExpiredRedirection : WebCore::DoNotReuseExpiredRedirection);
</del><ins>+ bool hasCacheableRedirect = m_response.isHTTP() && redirectChainAllowsReuse(m_redirectChainCacheStatus, allowStale ? ReuseExpiredRedirection : DoNotReuseExpiredRedirection);
</ins><span class="cx"> if (hasCacheableRedirect && m_redirectChainCacheStatus.status == RedirectChainCacheStatus::CachedRedirection) {
</span><span class="cx"> // Maybe we should cache the actual redirects instead of the end result?
</span><span class="cx"> auto now = std::chrono::system_clock::now();
</span><del>- auto responseEndOfValidity = now + WebCore::computeFreshnessLifetimeForHTTPFamily(m_response, now) - WebCore::computeCurrentAge(m_response, now);
</del><ins>+ auto responseEndOfValidity = now + computeFreshnessLifetimeForHTTPFamily(m_response, now) - computeCurrentAge(m_response, now);
</ins><span class="cx"> hasCacheableRedirect = responseEndOfValidity <= m_redirectChainCacheStatus.endOfValidity;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- bool isPrivate = sessionID().isEphemeral();
- if (m_bufferedDataForCache && hasCacheableRedirect && !isPrivate) {
</del><ins>+ bool isPrivateSession = sessionID().isEphemeral();
+ if (m_bufferedDataForCache && hasCacheableRedirect && !isPrivateSession) {
</ins><span class="cx"> // Keep the connection alive.
</span><del>- RefPtr<NetworkConnectionToWebProcess> connection(connectionToWebProcess());
</del><ins>+ RefPtr<NetworkConnectionToWebProcess> connection(&connectionToWebProcess());
</ins><span class="cx"> RefPtr<NetworkResourceLoader> loader(this);
</span><span class="cx"> NetworkCache::singleton().store(originalRequest(), m_response, WTF::move(m_bufferedDataForCache), [loader, connection](NetworkCache::MappedBody& mappedBody) {
</span><span class="cx"> #if ENABLE(SHAREABLE_RESOURCE)
</span><span class="lines">@@ -350,7 +341,7 @@
</span><span class="cx"> if (isSynchronous())
</span><span class="cx"> sendReplyToSynchronousRequest(*m_synchronousLoadData, m_bufferedData.get());
</span><span class="cx"> else {
</span><del>- if (m_bufferedData && m_bufferedData->size()) {
</del><ins>+ if (m_bufferedData && !m_bufferedData->isEmpty()) {
</ins><span class="cx"> // FIXME: Pass a real value or remove the encoded data size feature.
</span><span class="cx"> bool shouldContinue = sendBufferMaybeAborting(*m_bufferedData, -1);
</span><span class="cx"> if (!shouldContinue)
</span><span class="lines">@@ -382,7 +373,7 @@
</span><span class="cx"> void NetworkResourceLoader::willSendRedirectedRequest(const ResourceRequest& request, const ResourceResponse& redirectResponse)
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(NETWORK_CACHE)
</span><del>- WebCore::updateRedirectChainStatus(m_redirectChainCacheStatus, redirectResponse);
</del><ins>+ updateRedirectChainStatus(m_redirectChainCacheStatus, redirectResponse);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> if (isSynchronous()) {
</span><span class="lines">@@ -434,25 +425,25 @@
</span><span class="cx"> ASSERT(m_bufferedData);
</span><span class="cx"> ASSERT(m_networkLoad);
</span><span class="cx">
</span><del>- if (!m_bufferedData->size())
</del><ins>+ if (m_bufferedData->isEmpty())
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> IPC::SharedBufferDataReference dataReference(m_bufferedData.get());
</span><span class="cx"> size_t encodedLength = m_bufferedDataEncodedDataLength;
</span><span class="cx">
</span><del>- m_bufferedData = WebCore::SharedBuffer::create();
</del><ins>+ m_bufferedData = SharedBuffer::create();
</ins><span class="cx"> m_bufferedDataEncodedDataLength = 0;
</span><span class="cx">
</span><span class="cx"> sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveData(dataReference, encodedLength));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool NetworkResourceLoader::sendBufferMaybeAborting(const WebCore::SharedBuffer& buffer, size_t encodedDataLength)
</del><ins>+bool NetworkResourceLoader::sendBufferMaybeAborting(SharedBuffer& buffer, size_t encodedDataLength)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!isSynchronous());
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> ShareableResource::Handle shareableResourceHandle;
</span><del>- NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(shareableResourceHandle, const_cast<WebCore::SharedBuffer&>(buffer));
</del><ins>+ NetworkResourceLoader::tryGetShareableHandleFromSharedBuffer(shareableResourceHandle, buffer);
</ins><span class="cx"> if (!shareableResourceHandle.isNull()) {
</span><span class="cx"> send(Messages::WebResourceLoader::DidReceiveResource(shareableResourceHandle, currentTime()));
</span><span class="cx"> abort();
</span><span class="lines">@@ -460,7 +451,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- IPC::SharedBufferDataReference dataReference(&const_cast<WebCore::SharedBuffer&>(buffer));
</del><ins>+ IPC::SharedBufferDataReference dataReference(&buffer);
</ins><span class="cx"> return sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveData(dataReference, encodedDataLength));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -507,12 +498,12 @@
</span><span class="cx"> // and we should not overwrite the existing conditional headers.
</span><span class="cx"> ResourceRequest revalidationRequest = originalRequest();
</span><span class="cx"> if (!revalidationRequest.isConditional()) {
</span><del>- String eTag = entry->response().httpHeaderField(WebCore::HTTPHeaderName::ETag);
- String lastModified = entry->response().httpHeaderField(WebCore::HTTPHeaderName::LastModified);
</del><ins>+ String eTag = entry->response().httpHeaderField(HTTPHeaderName::ETag);
+ String lastModified = entry->response().httpHeaderField(HTTPHeaderName::LastModified);
</ins><span class="cx"> if (!eTag.isEmpty())
</span><del>- revalidationRequest.setHTTPHeaderField(WebCore::HTTPHeaderName::IfNoneMatch, eTag);
</del><ins>+ revalidationRequest.setHTTPHeaderField(HTTPHeaderName::IfNoneMatch, eTag);
</ins><span class="cx"> if (!lastModified.isEmpty())
</span><del>- revalidationRequest.setHTTPHeaderField(WebCore::HTTPHeaderName::IfModifiedSince, lastModified);
</del><ins>+ revalidationRequest.setHTTPHeaderField(HTTPHeaderName::IfModifiedSince, lastModified);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_cacheEntryForValidation = WTF::move(entry);
</span><span class="lines">@@ -523,7 +514,7 @@
</span><span class="cx">
</span><span class="cx"> IPC::Connection* NetworkResourceLoader::messageSenderConnection()
</span><span class="cx"> {
</span><del>- return connectionToWebProcess()->connection();
</del><ins>+ return connectionToWebProcess().connection();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void NetworkResourceLoader::consumeSandboxExtensions()
</span><span class="lines">@@ -551,11 +542,11 @@
</span><span class="cx"> extension->revoke();
</span><span class="cx"> for (auto& fileReference : m_fileReferences)
</span><span class="cx"> fileReference->revokeFileAccess();
</span><ins>+
+ m_didConsumeSandboxExtensions = false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_fileReferences.clear();
</span><del>-
- m_didConsumeSandboxExtensions = false;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<typename T>
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (192061 => 192062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2015-11-05 19:22:42 UTC (rev 192061)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2015-11-05 19:25:29 UTC (rev 192062)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -29,14 +29,10 @@
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="cx">
</span><span class="cx"> #include "MessageSender.h"
</span><del>-#include "NetworkCache.h"
</del><span class="cx"> #include "NetworkConnectionToWebProcessMessages.h"
</span><span class="cx"> #include "NetworkLoadClient.h"
</span><span class="cx"> #include "NetworkResourceLoadParameters.h"
</span><span class="cx"> #include "ShareableResource.h"
</span><del>-#include <WebCore/CacheValidation.h>
-#include <WebCore/ResourceLoaderOptions.h>
-#include <WebCore/SessionID.h>
</del><span class="cx"> #include <WebCore/Timer.h>
</span><span class="cx"> #include <wtf/Optional.h>
</span><span class="cx">
</span><span class="lines">@@ -48,25 +44,20 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="cx"> class NetworkConnectionToWebProcess;
</span><del>-class NetworkResourceLoadParameters;
</del><span class="cx"> class NetworkLoad;
</span><span class="cx"> class SandboxExtension;
</span><span class="cx">
</span><del>-class NetworkResourceLoader
- : public RefCounted<NetworkResourceLoader>
- , public NetworkLoadClient
- , public IPC::MessageSender {
</del><ins>+namespace NetworkCache {
+class Entry;
+}
+
+class NetworkResourceLoader final : public RefCounted<NetworkResourceLoader>, public NetworkLoadClient, public IPC::MessageSender {
</ins><span class="cx"> public:
</span><del>- static Ref<NetworkResourceLoader> create(const NetworkResourceLoadParameters& parameters, NetworkConnectionToWebProcess* connection)
</del><ins>+ static Ref<NetworkResourceLoader> create(const NetworkResourceLoadParameters& parameters, NetworkConnectionToWebProcess& connection, RefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>&& reply = nullptr)
</ins><span class="cx"> {
</span><del>- return adoptRef(*new NetworkResourceLoader(parameters, connection, nullptr));
</del><ins>+ return adoptRef(*new NetworkResourceLoader(parameters, connection, WTF::move(reply)));
</ins><span class="cx"> }
</span><del>-
- static Ref<NetworkResourceLoader> create(const NetworkResourceLoadParameters& parameters, NetworkConnectionToWebProcess* connection, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> reply)
- {
- return adoptRef(*new NetworkResourceLoader(parameters, connection, reply));
- }
- ~NetworkResourceLoader();
</del><ins>+ virtual ~NetworkResourceLoader();
</ins><span class="cx">
</span><span class="cx"> const WebCore::ResourceRequest& originalRequest() const { return m_parameters.request; }
</span><span class="cx">
</span><span class="lines">@@ -100,7 +91,7 @@
</span><span class="cx"> WebCore::SharedBuffer* bufferedData() { return m_bufferedData.get(); }
</span><span class="cx"> const WebCore::ResourceResponse& response() const { return m_response; }
</span><span class="cx">
</span><del>- NetworkConnectionToWebProcess* connectionToWebProcess() const { return m_connection.get(); }
</del><ins>+ NetworkConnectionToWebProcess& connectionToWebProcess() { return m_connection; }
</ins><span class="cx"> WebCore::SessionID sessionID() const { return m_parameters.sessionID; }
</span><span class="cx"> ResourceLoadIdentifier identifier() const { return m_parameters.identifier; }
</span><span class="cx">
</span><span class="lines">@@ -117,7 +108,7 @@
</span><span class="cx"> virtual void didFailLoading(const WebCore::ResourceError&) override;
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- NetworkResourceLoader(const NetworkResourceLoadParameters&, NetworkConnectionToWebProcess*, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>);
</del><ins>+ NetworkResourceLoader(const NetworkResourceLoadParameters&, NetworkConnectionToWebProcess&, RefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>&&);
</ins><span class="cx">
</span><span class="cx"> // IPC::MessageSender
</span><span class="cx"> virtual IPC::Connection* messageSenderConnection() override;
</span><span class="lines">@@ -137,7 +128,7 @@
</span><span class="cx">
</span><span class="cx"> void startBufferingTimerIfNeeded();
</span><span class="cx"> void bufferingTimerFired();
</span><del>- bool sendBufferMaybeAborting(const WebCore::SharedBuffer&, size_t encodedDataLength);
</del><ins>+ bool sendBufferMaybeAborting(WebCore::SharedBuffer&, size_t encodedDataLength);
</ins><span class="cx">
</span><span class="cx"> void consumeSandboxExtensions();
</span><span class="cx"> void invalidateSandboxExtensions();
</span><span class="lines">@@ -146,22 +137,22 @@
</span><span class="cx">
</span><span class="cx"> const NetworkResourceLoadParameters m_parameters;
</span><span class="cx">
</span><del>- RefPtr<NetworkConnectionToWebProcess> m_connection;
</del><ins>+ Ref<NetworkConnectionToWebProcess> m_connection;
</ins><span class="cx">
</span><span class="cx"> std::unique_ptr<NetworkLoad> m_networkLoad;
</span><span class="cx">
</span><span class="cx"> WebCore::ResourceResponse m_response;
</span><span class="cx">
</span><del>- size_t m_bytesReceived;
- size_t m_bufferedDataEncodedDataLength;
</del><ins>+ size_t m_bytesReceived { 0 };
+ size_t m_bufferedDataEncodedDataLength { 0 };
</ins><span class="cx"> RefPtr<WebCore::SharedBuffer> m_bufferedData;
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<SynchronousLoadData> m_synchronousLoadData;
</span><span class="cx"> Vector<RefPtr<WebCore::BlobDataFileReference>> m_fileReferences;
</span><span class="cx">
</span><del>- bool m_didConvertHandleToDownload;
- bool m_didConsumeSandboxExtensions;
- bool m_defersLoading;
</del><ins>+ bool m_didConvertHandleToDownload { false };
+ bool m_didConsumeSandboxExtensions { false };
+ bool m_defersLoading { false };
</ins><span class="cx">
</span><span class="cx"> WebCore::Timer m_bufferingTimer;
</span><span class="cx"> #if ENABLE(NETWORK_CACHE)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessmacNetworkDiskCacheMonitorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h (192061 => 192062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h        2015-11-05 19:22:42 UTC (rev 192061)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkDiskCacheMonitor.h        2015-11-05 19:25:29 UTC (rev 192062)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> virtual IPC::Connection* messageSenderConnection() override;
</span><span class="cx"> virtual uint64_t messageSenderDestinationID() override;
</span><span class="cx">
</span><del>- RefPtr<NetworkConnectionToWebProcess> m_connectionToWebProcess;
</del><ins>+ Ref<NetworkConnectionToWebProcess> m_connectionToWebProcess;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>