<!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>[170509] tags/Safari-538.43/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/170509">170509</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2014-06-26 16:54:11 -0700 (Thu, 26 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/170503">r170503</a>.  &lt;rdar://problem/17271965&gt;</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#tagsSafari53843SourceWebCoreChangeLog">tags/Safari-538.43/Source/WebCore/ChangeLog</a></li>
<li><a href="#tagsSafari53843SourceWebCoreloaderResourceLoadSchedulercpp">tags/Safari-538.43/Source/WebCore/loader/ResourceLoadScheduler.cpp</a></li>
<li><a href="#tagsSafari53843SourceWebCoreplatformnetworkcfResourceRequesth">tags/Safari-538.43/Source/WebCore/platform/network/cf/ResourceRequest.h</a></li>
<li><a href="#tagsSafari53843SourceWebCoreplatformnetworkcfResourceRequestCFNetcpp">tags/Safari-538.43/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp</a></li>
<li><a href="#tagsSafari53843SourceWebCoreplatformnetworkmacResourceRequestMacmm">tags/Safari-538.43/Source/WebCore/platform/network/mac/ResourceRequestMac.mm</a></li>
<li><a href="#tagsSafari53843SourceWebKit2ChangeLog">tags/Safari-538.43/Source/WebKit2/ChangeLog</a></li>
<li><a href="#tagsSafari53843SourceWebKit2NetworkProcessmacNetworkResourceLoadSchedulerMacmm">tags/Safari-538.43/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="tagsSafari53843SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.43/Source/WebCore/ChangeLog (170508 => 170509)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.43/Source/WebCore/ChangeLog        2014-06-26 23:53:37 UTC (rev 170508)
+++ tags/Safari-538.43/Source/WebCore/ChangeLog        2014-06-26 23:54:11 UTC (rev 170509)
</span><span class="lines">@@ -1,5 +1,33 @@
</span><span class="cx"> 2014-06-26  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r170503
+
+    2014-06-26  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+            REGRESSION: Mountain Lion: Gmail's &quot;in new window&quot; view of mail threads is very slow to load its content
+            https://bugs.webkit.org/show_bug.cgi?id=133882
+            &lt;rdar://problem/17271965&gt;
+
+            Reviewed by Brady Eidson.
+
+            This goes to pre-r161796 behavior on 10.8 and 10.9. We schedule the requests internally,
+            and only give 6 of them to CFNetwork at a time. Except for synchronous requests,
+            which still use the improved approach, and don't count against 6 connections.
+
+            * loader/ResourceLoadScheduler.cpp:
+            (WebCore::ResourceLoadScheduler::scheduleLoad):
+            * platform/network/cf/ResourceRequest.h:
+            (WebCore::ResourceRequest::resourcePrioritiesEnabled):
+            * platform/network/cf/ResourceRequestCFNet.cpp:
+            (WebCore::ResourceRequest::doUpdatePlatformRequest):
+            (WebCore::ResourceRequest::doUpdateResourceRequest):
+            (WebCore::initializeMaximumHTTPConnectionCountPerHost): Deleted.
+            * platform/network/mac/ResourceRequestMac.mm:
+            (WebCore::ResourceRequest::doUpdateResourceRequest):
+            (WebCore::ResourceRequest::doUpdatePlatformRequest):
+
+2014-06-26  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
</ins><span class="cx">         Merge r170478
</span><span class="cx"> 
</span><span class="cx">     2014-06-26  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span></span></pre></div>
<a id="tagsSafari53843SourceWebCoreloaderResourceLoadSchedulercpp"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.43/Source/WebCore/loader/ResourceLoadScheduler.cpp (170508 => 170509)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.43/Source/WebCore/loader/ResourceLoadScheduler.cpp        2014-06-26 23:53:37 UTC (rev 170508)
+++ tags/Safari-538.43/Source/WebCore/loader/ResourceLoadScheduler.cpp        2014-06-26 23:54:11 UTC (rev 170509)
</span><span class="lines">@@ -163,7 +163,7 @@
</span><span class="cx">     host-&gt;schedule(resourceLoader, priority);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA) || USE(CFNETWORK)
</span><del>-    if (!isSuspendingPendingRequests()) {
</del><ins>+    if (ResourceRequest::resourcePrioritiesEnabled() &amp;&amp; !isSuspendingPendingRequests()) {
</ins><span class="cx">         // Serve all requests at once to keep the pipeline full at the network layer.
</span><span class="cx">         // FIXME: Does this code do anything useful, given that we also set maxRequestsInFlightPerHost to effectively unlimited on these platforms?
</span><span class="cx">         servePendingRequests(host, ResourceLoadPriorityVeryLow);
</span></span></pre></div>
<a id="tagsSafari53843SourceWebCoreplatformnetworkcfResourceRequesth"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.43/Source/WebCore/platform/network/cf/ResourceRequest.h (170508 => 170509)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.43/Source/WebCore/platform/network/cf/ResourceRequest.h        2014-06-26 23:53:37 UTC (rev 170508)
+++ tags/Safari-538.43/Source/WebCore/platform/network/cf/ResourceRequest.h        2014-06-26 23:54:11 UTC (rev 170509)
</span><span class="lines">@@ -108,6 +108,8 @@
</span><span class="cx">         static bool httpPipeliningEnabled();
</span><span class="cx">         static void setHTTPPipeliningEnabled(bool);
</span><span class="cx"> 
</span><ins>+        static bool resourcePrioritiesEnabled();
+
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">         static bool useQuickLookResourceCachingQuirks();
</span><span class="cx"> #endif
</span><span class="lines">@@ -150,6 +152,24 @@
</span><span class="cx"> #endif
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    inline bool ResourceRequest::resourcePrioritiesEnabled()
+    {
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 10100
+    return true;
+#elif PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &lt; 10100
+    // See &lt;rdar://problem/16518595&gt;, &lt;rdar://problem/17168793&gt; for issues we had before OS X 10.10.
+    // HTTP Pipelining could be enabled for experiments, but there is no point in doing so on old OS versions,
+    // and that can't work well because of the above issues.
+    ASSERT(!httpPipeliningEnabled());
+    return false;
+#elif PLATFORM(IOS)
+    return true;
+#elif PLATFORM(WIN)
+    return false;
+#endif
+    }
+
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ResourceRequest_h
</span></span></pre></div>
<a id="tagsSafari53843SourceWebCoreplatformnetworkcfResourceRequestCFNetcpp"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.43/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp (170508 => 170509)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.43/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp        2014-06-26 23:53:37 UTC (rev 170508)
+++ tags/Safari-538.43/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp        2014-06-26 23:54:11 UTC (rev 170509)
</span><span class="lines">@@ -156,7 +156,8 @@
</span><span class="cx">     if (httpPipeliningEnabled())
</span><span class="cx">         wkHTTPRequestEnablePipelining(cfRequest);
</span><span class="cx"> 
</span><del>-    wkSetHTTPRequestPriority(cfRequest, toPlatformRequestPriority(m_priority));
</del><ins>+    if (resourcePrioritiesEnabled())
+        wkSetHTTPRequestPriority(cfRequest, toPlatformRequestPriority(m_priority));
</ins><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(WIN)
</span><span class="cx">     wkCFURLRequestAllowAllPostCaching(cfRequest);
</span><span class="lines">@@ -282,7 +283,8 @@
</span><span class="cx">     }
</span><span class="cx">     m_allowCookies = CFURLRequestShouldHandleHTTPCookies(m_cfRequest.get());
</span><span class="cx"> 
</span><del>-    m_priority = toResourceLoadPriority(wkGetHTTPRequestPriority(m_cfRequest.get()));
</del><ins>+    if (resourcePrioritiesEnabled())
+        m_priority = toResourceLoadPriority(wkGetHTTPRequestPriority(m_cfRequest.get()));
</ins><span class="cx"> 
</span><span class="cx">     m_httpHeaderFields.clear();
</span><span class="cx">     if (CFDictionaryRef headers = CFURLRequestCopyAllHTTPHeaderFields(m_cfRequest.get())) {
</span><span class="lines">@@ -398,27 +400,32 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// FIXME: It is confusing that this function both sets connection count and determines maximum request count at network layer. This can and should be done separately.
</ins><span class="cx"> unsigned initializeMaximumHTTPConnectionCountPerHost()
</span><span class="cx"> {
</span><span class="cx">     static const unsigned preferredConnectionCount = 6;
</span><del>-    static const unsigned unlimitedConnectionCount = 10000;
</del><ins>+    static const unsigned unlimitedRequestCount = 10000;
</ins><span class="cx"> 
</span><del>-    wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
</del><ins>+    unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
</ins><span class="cx"> 
</span><span class="cx">     Boolean keyExistsAndHasValidFormat = false;
</span><span class="cx">     Boolean prefValue = CFPreferencesGetAppBooleanValue(CFSTR(&quot;WebKitEnableHTTPPipelining&quot;), kCFPreferencesCurrentApplication, &amp;keyExistsAndHasValidFormat);
</span><span class="cx">     if (keyExistsAndHasValidFormat)
</span><span class="cx">         ResourceRequest::setHTTPPipeliningEnabled(prefValue);
</span><span class="cx"> 
</span><ins>+    // Use WebCore scheduler when we can't use request priorities with CFNetwork.
+    if (!ResourceRequest::resourcePrioritiesEnabled())
+        return maximumHTTPConnectionCountPerHost;
+
</ins><span class="cx">     wkSetHTTPRequestMaximumPriority(toPlatformRequestPriority(ResourceLoadPriorityHighest));
</span><span class="cx"> #if !PLATFORM(WIN)
</span><span class="cx">     // FIXME: &lt;rdar://problem/9375609&gt; Implement minimum fast lane priority setting on Windows
</span><span class="cx">     wkSetHTTPRequestMinimumFastLanePriority(toPlatformRequestPriority(ResourceLoadPriorityMedium));
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    return unlimitedConnectionCount;
</del><ins>+    return unlimitedRequestCount;
</ins><span class="cx"> }
</span><del>-    
</del><ins>+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> void initializeHTTPConnectionSettingsOnStartup()
</span><span class="cx"> {
</span></span></pre></div>
<a id="tagsSafari53843SourceWebCoreplatformnetworkmacResourceRequestMacmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.43/Source/WebCore/platform/network/mac/ResourceRequestMac.mm (170508 => 170509)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.43/Source/WebCore/platform/network/mac/ResourceRequestMac.mm        2014-06-26 23:53:37 UTC (rev 170508)
+++ tags/Safari-538.43/Source/WebCore/platform/network/mac/ResourceRequestMac.mm        2014-06-26 23:54:11 UTC (rev 170509)
</span><span class="lines">@@ -109,7 +109,8 @@
</span><span class="cx">         m_httpMethod = method;
</span><span class="cx">     m_allowCookies = [m_nsRequest.get() HTTPShouldHandleCookies];
</span><span class="cx"> 
</span><del>-    m_priority = toResourceLoadPriority(wkGetHTTPRequestPriority([m_nsRequest.get() _CFURLRequest]));
</del><ins>+    if (ResourceRequest::resourcePrioritiesEnabled())
+        m_priority = toResourceLoadPriority(wkGetHTTPRequestPriority([m_nsRequest.get() _CFURLRequest]));
</ins><span class="cx"> 
</span><span class="cx">     NSDictionary *headers = [m_nsRequest.get() allHTTPHeaderFields];
</span><span class="cx">     NSEnumerator *e = [headers keyEnumerator];
</span><span class="lines">@@ -167,7 +168,8 @@
</span><span class="cx">     if (ResourceRequest::httpPipeliningEnabled())
</span><span class="cx">         wkHTTPRequestEnablePipelining([nsRequest _CFURLRequest]);
</span><span class="cx"> 
</span><del>-    wkSetHTTPRequestPriority([nsRequest _CFURLRequest], toPlatformRequestPriority(m_priority));
</del><ins>+    if (ResourceRequest::resourcePrioritiesEnabled())
+        wkSetHTTPRequestPriority([nsRequest _CFURLRequest], toPlatformRequestPriority(m_priority));
</ins><span class="cx"> 
</span><span class="cx">     [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()];
</span><span class="cx">     wkCFURLRequestAllowAllPostCaching([nsRequest _CFURLRequest]);
</span></span></pre></div>
<a id="tagsSafari53843SourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.43/Source/WebKit2/ChangeLog (170508 => 170509)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.43/Source/WebKit2/ChangeLog        2014-06-26 23:53:37 UTC (rev 170508)
+++ tags/Safari-538.43/Source/WebKit2/ChangeLog        2014-06-26 23:54:11 UTC (rev 170509)
</span><span class="lines">@@ -1,5 +1,21 @@
</span><span class="cx"> 2014-06-26  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r170503
+
+    2014-06-26  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+            REGRESSION: Mountain Lion: Gmail's &quot;in new window&quot; view of mail threads is very slow to load its content
+            https://bugs.webkit.org/show_bug.cgi?id=133882
+            &lt;rdar://problem/17271965&gt;
+
+            Reviewed by Brady Eidson.
+
+            * NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm:
+            (WebKit::NetworkResourceLoadScheduler::platformInitializeMaximumHTTPConnectionCountPerHost):
+            Same fix as in WebCore.
+
+2014-06-26  Lucas Forschler  &lt;lforschler@apple.com&gt;
+
</ins><span class="cx">         Merge r170492
</span><span class="cx"> 
</span><span class="cx">     2014-06-26  Ada Chan  &lt;adachan@apple.com&gt;
</span></span></pre></div>
<a id="tagsSafari53843SourceWebKit2NetworkProcessmacNetworkResourceLoadSchedulerMacmm"></a>
<div class="modfile"><h4>Modified: tags/Safari-538.43/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm (170508 => 170509)</h4>
<pre class="diff"><span>
<span class="info">--- tags/Safari-538.43/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm        2014-06-26 23:53:37 UTC (rev 170508)
+++ tags/Safari-538.43/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm        2014-06-26 23:54:11 UTC (rev 170509)
</span><span class="lines">@@ -40,19 +40,23 @@
</span><span class="cx"> void NetworkResourceLoadScheduler::platformInitializeMaximumHTTPConnectionCountPerHost()
</span><span class="cx"> {
</span><span class="cx">     static const unsigned preferredConnectionCount = 6;
</span><del>-    static const unsigned unlimitedConnectionCount = 10000;
</del><ins>+    static const unsigned unlimitedRequestCount = 10000;
</ins><span class="cx"> 
</span><del>-    WKInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
</del><ins>+    unsigned maximumHTTPConnectionCountPerHost = WKInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
</ins><span class="cx"> 
</span><span class="cx">     Boolean keyExistsAndHasValidFormat = false;
</span><span class="cx">     Boolean prefValue = CFPreferencesGetAppBooleanValue(CFSTR(&quot;WebKitEnableHTTPPipelining&quot;), kCFPreferencesCurrentApplication, &amp;keyExistsAndHasValidFormat);
</span><span class="cx">     if (keyExistsAndHasValidFormat)
</span><span class="cx">         ResourceRequest::setHTTPPipeliningEnabled(prefValue);
</span><span class="cx"> 
</span><del>-    WKSetHTTPRequestMaximumPriority(toPlatformRequestPriority(ResourceLoadPriorityHighest));
-    WKSetHTTPRequestMinimumFastLanePriority(toPlatformRequestPriority(ResourceLoadPriorityMedium));
-
-    m_maxRequestsInFlightPerHost = unlimitedConnectionCount;
</del><ins>+    if (ResourceRequest::resourcePrioritiesEnabled()) {
+        WKSetHTTPRequestMaximumPriority(toPlatformRequestPriority(ResourceLoadPriorityHighest));
+        WKSetHTTPRequestMinimumFastLanePriority(toPlatformRequestPriority(ResourceLoadPriorityMedium));
+        m_maxRequestsInFlightPerHost = unlimitedRequestCount;
+    } else {
+        // Use WebKit scheduler when we can't use request priorities with CFNetwork.
+        m_maxRequestsInFlightPerHost = maximumHTTPConnectionCountPerHost;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>