<!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>[173394] 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/173394">173394</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2014-09-08 13:01:43 -0700 (Mon, 08 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Buffer images on web process side
https://bugs.webkit.org/show_bug.cgi?id=136631
Reviewed by Darin Adler.
We can substantially reduce IPC and decoding time for large images by allowing some buffering.
This patch makes us buffer image data up to 0.5s before sending it over to the web process.
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::NetworkResourceLoader):
(WebKit::NetworkResourceLoader::cleanup):
(WebKit::NetworkResourceLoader::didReceiveBuffer):
Start the timer.
(WebKit::NetworkResourceLoader::didFinishLoading):
(WebKit::NetworkResourceLoader::startBufferingTimerIfNeeded):
(WebKit::NetworkResourceLoader::bufferingTimerFired):
(WebKit::NetworkResourceLoader::sendBuffer):
Send the data when the timer fires or the load finishes, whichever happens first.
* NetworkProcess/NetworkResourceLoader.h:
* Platform/IPC/ArgumentCoders.h:
Support encoding std::chrono::duration
* Shared/Network/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
(WebKit::NetworkResourceLoadParameters::encode):
(WebKit::NetworkResourceLoadParameters::decode):
* Shared/Network/NetworkResourceLoadParameters.h:
Pass maximimum buffering duration.
* WebProcess/Network/WebResourceLoadScheduler.cpp:
(WebKit::maximumBufferingTime):
Deterimine duration from the resource type.
Enabled full buffering for font resources. They are not decoded incrementally.
(WebKit::WebResourceLoadScheduler::scheduleLoad):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</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="#trunkSourceWebKit2PlatformIPCArgumentCodersh">trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h</a></li>
<li><a href="#trunkSourceWebKit2SharedNetworkNetworkResourceLoadParameterscpp">trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedNetworkNetworkResourceLoadParametersh">trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessNetworkWebResourceLoadSchedulercpp">trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (173393 => 173394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-09-08 18:59:15 UTC (rev 173393)
+++ trunk/Source/WebKit2/ChangeLog        2014-09-08 20:01:43 UTC (rev 173394)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2014-09-08 Antti Koivisto <antti@apple.com>
+
+ Buffer images on web process side
+ https://bugs.webkit.org/show_bug.cgi?id=136631
+
+ Reviewed by Darin Adler.
+
+ We can substantially reduce IPC and decoding time for large images by allowing some buffering.
+
+ This patch makes us buffer image data up to 0.5s before sending it over to the web process.
+
+ * NetworkProcess/NetworkResourceLoader.cpp:
+ (WebKit::NetworkResourceLoader::NetworkResourceLoader):
+ (WebKit::NetworkResourceLoader::cleanup):
+ (WebKit::NetworkResourceLoader::didReceiveBuffer):
+
+ Start the timer.
+
+ (WebKit::NetworkResourceLoader::didFinishLoading):
+ (WebKit::NetworkResourceLoader::startBufferingTimerIfNeeded):
+ (WebKit::NetworkResourceLoader::bufferingTimerFired):
+ (WebKit::NetworkResourceLoader::sendBuffer):
+
+ Send the data when the timer fires or the load finishes, whichever happens first.
+
+ * NetworkProcess/NetworkResourceLoader.h:
+ * Platform/IPC/ArgumentCoders.h:
+
+ Support encoding std::chrono::duration
+
+ * Shared/Network/NetworkResourceLoadParameters.cpp:
+ (WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
+ (WebKit::NetworkResourceLoadParameters::encode):
+ (WebKit::NetworkResourceLoadParameters::decode):
+ * Shared/Network/NetworkResourceLoadParameters.h:
+
+ Pass maximimum buffering duration.
+
+ * WebProcess/Network/WebResourceLoadScheduler.cpp:
+ (WebKit::maximumBufferingTime):
+
+ Deterimine duration from the resource type.
+ Enabled full buffering for font resources. They are not decoded incrementally.
+
+ (WebKit::WebResourceLoadScheduler::scheduleLoad):
+
</ins><span class="cx"> 2014-09-08 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> HAVE(VOUCHERS) is not available outside of WebKit2
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (173393 => 173394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2014-09-08 18:59:15 UTC (rev 173393)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp        2014-09-08 20:01:43 UTC (rev 173394)
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx"> data.m_delayedReply = nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-NetworkResourceLoader::NetworkResourceLoader(const NetworkResourceLoadParameters& parameters, NetworkConnectionToWebProcess* connection, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> reply)
</del><ins>+NetworkResourceLoader::NetworkResourceLoader(const NetworkResourceLoadParameters& parameters, NetworkConnectionToWebProcess* connection, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply> synchronousReply)
</ins><span class="cx"> : m_bytesReceived(0)
</span><span class="cx"> , m_handleConvertedToDownload(false)
</span><span class="cx"> , m_identifier(parameters.identifier)
</span><span class="lines">@@ -97,8 +97,11 @@
</span><span class="cx"> , m_shouldClearReferrerOnHTTPSToHTTPRedirect(parameters.shouldClearReferrerOnHTTPSToHTTPRedirect)
</span><span class="cx"> , m_isLoadingMainResource(parameters.isMainResource)
</span><span class="cx"> , m_defersLoading(parameters.defersLoading)
</span><ins>+ , m_maximumBufferingTime(parameters.maximumBufferingTime)
+ , m_bufferingTimer(this, &NetworkResourceLoader::bufferingTimerFired)
</ins><span class="cx"> , m_sandboxExtensionsAreConsumed(false)
</span><span class="cx"> , m_connection(connection)
</span><ins>+ , m_bufferedDataEncodedDataLength(0)
</ins><span class="cx"> {
</span><span class="cx"> // Either this loader has both a webPageID and webFrameID, or it is not allowed to ask the client for authentication credentials.
</span><span class="cx"> // FIXME: This is necessary because of the existence of EmptyFrameLoaderClient in WebCore.
</span><span class="lines">@@ -127,11 +130,11 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(RunLoop::isMain());
</span><span class="cx">
</span><del>- if (reply || parameters.shouldBufferResource)
</del><ins>+ if (synchronousReply || m_maximumBufferingTime > 0_ms)
</ins><span class="cx"> m_bufferedData = WebCore::SharedBuffer::create();
</span><span class="cx">
</span><del>- if (reply)
- m_synchronousLoadData = std::make_unique<SynchronousLoadData>(m_request, reply);
</del><ins>+ if (synchronousReply)
+ m_synchronousLoadData = std::make_unique<SynchronousLoadData>(m_request, synchronousReply);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> NetworkResourceLoader::~NetworkResourceLoader()
</span><span class="lines">@@ -183,6 +186,8 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(RunLoop::isMain());
</span><span class="cx">
</span><ins>+ m_bufferingTimer.stop();
+
</ins><span class="cx"> invalidateSandboxExtensions();
</span><span class="cx">
</span><span class="cx"> // Tell the scheduler about this finished loader soon so it can start more network requests.
</span><span class="lines">@@ -238,13 +243,18 @@
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void NetworkResourceLoader::didReceiveBuffer(ResourceHandle* handle, PassRefPtr<SharedBuffer> buffer, int encodedDataLength)
</del><ins>+void NetworkResourceLoader::didReceiveBuffer(ResourceHandle* handle, PassRefPtr<SharedBuffer> buffer, int reportedEncodedDataLength)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT_UNUSED(handle, handle == m_handle);
</span><span class="cx">
</span><ins>+ // FIXME: At least on OS X Yosemite we always get -1 from the resource handle.
+ unsigned encodedDataLength = reportedEncodedDataLength >= 0 ? reportedEncodedDataLength : buffer->size();
+
</ins><span class="cx"> m_bytesReceived += buffer->size();
</span><span class="cx"> if (m_bufferedData) {
</span><span class="cx"> m_bufferedData->append(buffer.get());
</span><ins>+ m_bufferedDataEncodedDataLength += encodedDataLength;
+ startBufferingTimerIfNeeded();
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> sendBuffer(buffer.get(), encodedDataLength);
</span><span class="lines">@@ -258,7 +268,7 @@
</span><span class="cx"> sendReplyToSynchronousRequest(*m_synchronousLoadData, m_bufferedData.get());
</span><span class="cx"> else {
</span><span class="cx"> if (m_bufferedData && m_bufferedData->size())
</span><del>- sendBuffer(m_bufferedData.get(), m_bufferedData->size());
</del><ins>+ sendBuffer(m_bufferedData.get(), -1);
</ins><span class="cx"> send(Messages::WebResourceLoader::DidFinishResourceLoad(finishTime));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -399,6 +409,29 @@
</span><span class="cx"> didFail(m_handle.get(), cancelledError(m_request));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void NetworkResourceLoader::startBufferingTimerIfNeeded()
+{
+ if (isSynchronous())
+ return;
+ if (m_bufferingTimer.isActive())
+ return;
+ m_bufferingTimer.startOneShot(m_maximumBufferingTime);
+}
+
+void NetworkResourceLoader::bufferingTimerFired(Timer<NetworkResourceLoader>&)
+{
+ ASSERT(m_bufferedData);
+ ASSERT(m_handle);
+ if (!m_bufferedData->size())
+ return;
+
+ IPC::SharedBufferDataReference dataReference(m_bufferedData.get());
+ sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveData(dataReference, m_bufferedDataEncodedDataLength));
+
+ m_bufferedData = WebCore::SharedBuffer::create();
+ m_bufferedDataEncodedDataLength = 0;
+}
+
</ins><span class="cx"> void NetworkResourceLoader::sendBuffer(WebCore::SharedBuffer* buffer, int encodedDataLength)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!isSynchronous());
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkResourceLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (173393 => 173394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2014-09-08 18:59:15 UTC (rev 173393)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h        2014-09-08 20:01:43 UTC (rev 173394)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include <WebCore/ResourceRequest.h>
</span><span class="cx"> #include <WebCore/ResourceResponse.h>
</span><span class="cx"> #include <WebCore/SessionID.h>
</span><ins>+#include <WebCore/Timer.h>
</ins><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> #include <wtf/RunLoop.h>
</span><span class="cx">
</span><span class="lines">@@ -161,6 +162,8 @@
</span><span class="cx">
</span><span class="cx"> void platformDidReceiveResponse(const WebCore::ResourceResponse&);
</span><span class="cx">
</span><ins>+ void startBufferingTimerIfNeeded();
+ void bufferingTimerFired(WebCore::Timer<NetworkResourceLoader>&);
</ins><span class="cx"> void sendBuffer(WebCore::SharedBuffer*, int encodedDataLength);
</span><span class="cx">
</span><span class="cx"> void consumeSandboxExtensions();
</span><span class="lines">@@ -190,7 +193,10 @@
</span><span class="cx"> bool m_shouldClearReferrerOnHTTPSToHTTPRedirect;
</span><span class="cx"> bool m_isLoadingMainResource;
</span><span class="cx"> bool m_defersLoading;
</span><ins>+ const std::chrono::milliseconds m_maximumBufferingTime;
</ins><span class="cx">
</span><ins>+ WebCore::Timer<NetworkResourceLoader> m_bufferingTimer;
+
</ins><span class="cx"> Vector<RefPtr<SandboxExtension>> m_requestBodySandboxExtensions;
</span><span class="cx"> Vector<RefPtr<SandboxExtension>> m_resourceSandboxExtensions;
</span><span class="cx"> Vector<RefPtr<WebCore::BlobDataFileReference>> m_fileReferences;
</span><span class="lines">@@ -199,6 +205,7 @@
</span><span class="cx"> RefPtr<NetworkConnectionToWebProcess> m_connection;
</span><span class="cx">
</span><span class="cx"> RefPtr<WebCore::SharedBuffer> m_bufferedData;
</span><ins>+ size_t m_bufferedDataEncodedDataLength;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCArgumentCodersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h (173393 => 173394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h        2014-09-08 18:59:15 UTC (rev 173393)
+++ trunk/Source/WebKit2/Platform/IPC/ArgumentCoders.h        2014-09-08 20:01:43 UTC (rev 173394)
</span><span class="lines">@@ -104,6 +104,22 @@
</span><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template<typename Rep, typename Period> struct ArgumentCoder<std::chrono::duration<Rep, Period>> {
+ static void encode(ArgumentEncoder& encoder, const std::chrono::duration<Rep, Period>& duration)
+ {
+ encoder << duration.count();
+ }
+
+ static bool decode(ArgumentDecoder& decoder, std::chrono::duration<Rep, Period>& result)
+ {
+ Rep count;
+ if (!decoder.decode(count))
+ return false;
+ result = std::chrono::duration<Rep, Period>(count);
+ return true;
+ }
+};
+
</ins><span class="cx"> template<typename KeyType, typename ValueType> struct ArgumentCoder<WTF::KeyValuePair<KeyType, ValueType>> {
</span><span class="cx"> static void encode(ArgumentEncoder& encoder, const WTF::KeyValuePair<KeyType, ValueType>& pair)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedNetworkNetworkResourceLoadParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp (173393 => 173394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp        2014-09-08 18:59:15 UTC (rev 173393)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp        2014-09-08 20:01:43 UTC (rev 173394)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> , shouldClearReferrerOnHTTPSToHTTPRedirect(true)
</span><span class="cx"> , isMainResource(false)
</span><span class="cx"> , defersLoading(false)
</span><del>- , shouldBufferResource(false)
</del><ins>+ , maximumBufferingTime(0_ms)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx"> encoder << shouldClearReferrerOnHTTPSToHTTPRedirect;
</span><span class="cx"> encoder << isMainResource;
</span><span class="cx"> encoder << defersLoading;
</span><del>- encoder << shouldBufferResource;
</del><ins>+ encoder << maximumBufferingTime;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool NetworkResourceLoadParameters::decode(IPC::ArgumentDecoder& decoder, NetworkResourceLoadParameters& result)
</span><span class="lines">@@ -146,7 +146,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> if (!decoder.decode(result.defersLoading))
</span><span class="cx"> return false;
</span><del>- if (!decoder.decode(result.shouldBufferResource))
</del><ins>+ if (!decoder.decode(result.maximumBufferingTime))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> return true;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedNetworkNetworkResourceLoadParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h (173393 => 173394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h        2014-09-08 18:59:15 UTC (rev 173393)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h        2014-09-08 20:01:43 UTC (rev 173394)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx"> bool shouldClearReferrerOnHTTPSToHTTPRedirect;
</span><span class="cx"> bool isMainResource;
</span><span class="cx"> bool defersLoading;
</span><del>- bool shouldBufferResource;
</del><ins>+ std::chrono::milliseconds maximumBufferingTime;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessNetworkWebResourceLoadSchedulercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (173393 => 173394)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp        2014-09-08 18:59:15 UTC (rev 173393)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp        2014-09-08 20:01:43 UTC (rev 173394)
</span><span class="lines">@@ -85,6 +85,35 @@
</span><span class="cx"> return loader.release();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static std::chrono::milliseconds maximumBufferingTime(CachedResource* resource)
+{
+ if (!resource)
+ return 0_ms;
+
+ switch (resource->type()) {
+ case CachedResource::CSSStyleSheet:
+ case CachedResource::Script:
+ case CachedResource::FontResource:
+ return std::chrono::milliseconds::max();
+ case CachedResource::ImageResource:
+ return 500_ms;
+ case CachedResource::MainResource:
+ case CachedResource::RawResource:
+ case CachedResource::SVGDocumentResource:
+#if ENABLE(LINK_PREFETCH)
+ case CachedResource::LinkPrefetch:
+ case CachedResource::LinkSubresource:
+#endif
+#if ENABLE(VIDEO_TRACK)
+ case CachedResource::TextTrackResource:
+#endif
+#if ENABLE(XSLT)
+ case CachedResource::XSLStyleSheet:
+#endif
+ return 0_ms;
+ }
+}
+
</ins><span class="cx"> void WebResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader, CachedResource* resource, bool shouldClearReferrerOnHTTPSToHTTPRedirect)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(resourceLoader);
</span><span class="lines">@@ -141,7 +170,7 @@
</span><span class="cx"> loadParameters.shouldClearReferrerOnHTTPSToHTTPRedirect = shouldClearReferrerOnHTTPSToHTTPRedirect;
</span><span class="cx"> loadParameters.isMainResource = resource && resource->type() == CachedResource::MainResource;
</span><span class="cx"> loadParameters.defersLoading = resourceLoader->defersLoading();
</span><del>- loadParameters.shouldBufferResource = resource && (resource->type() == CachedResource::CSSStyleSheet || resource->type() == CachedResource::Script);
</del><ins>+ loadParameters.maximumBufferingTime = maximumBufferingTime(resource);
</ins><span class="cx">
</span><span class="cx"> ASSERT((loadParameters.webPageID && loadParameters.webFrameID) || loadParameters.clientCredentialPolicy == DoNotAskClientForAnyCredentials);
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>