- Revision
- 170503
- Author
- [email protected]
- Date
- 2014-06-26 16:15:36 -0700 (Thu, 26 Jun 2014)
Log Message
REGRESSION: Mountain Lion: Gmail's "in new window" view of mail threads is very slow to load its content
https://bugs.webkit.org/show_bug.cgi?id=133882
<rdar://problem/17271965>
Reviewed by Brady Eidson.
Source/WebCore:
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):
Source/WebKit2:
* NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm:
(WebKit::NetworkResourceLoadScheduler::platformInitializeMaximumHTTPConnectionCountPerHost):
Same fix as in WebCore.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (170502 => 170503)
--- trunk/Source/WebCore/ChangeLog 2014-06-26 23:07:19 UTC (rev 170502)
+++ trunk/Source/WebCore/ChangeLog 2014-06-26 23:15:36 UTC (rev 170503)
@@ -1,3 +1,27 @@
+2014-06-26 Alexey Proskuryakov <[email protected]>
+
+ REGRESSION: Mountain Lion: Gmail's "in new window" view of mail threads is very slow to load its content
+ https://bugs.webkit.org/show_bug.cgi?id=133882
+ <rdar://problem/17271965>
+
+ 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 Brady Eidson <[email protected]>
Remove use of PlatformStrategies for Gamepad API.
Modified: trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp (170502 => 170503)
--- trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp 2014-06-26 23:07:19 UTC (rev 170502)
+++ trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp 2014-06-26 23:15:36 UTC (rev 170503)
@@ -163,7 +163,7 @@
host->schedule(resourceLoader, priority);
#if PLATFORM(COCOA) || USE(CFNETWORK)
- if (!isSuspendingPendingRequests()) {
+ if (ResourceRequest::resourcePrioritiesEnabled() && !isSuspendingPendingRequests()) {
// Serve all requests at once to keep the pipeline full at the network layer.
// FIXME: Does this code do anything useful, given that we also set maxRequestsInFlightPerHost to effectively unlimited on these platforms?
servePendingRequests(host, ResourceLoadPriorityVeryLow);
Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequest.h (170502 => 170503)
--- trunk/Source/WebCore/platform/network/cf/ResourceRequest.h 2014-06-26 23:07:19 UTC (rev 170502)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequest.h 2014-06-26 23:15:36 UTC (rev 170503)
@@ -108,6 +108,8 @@
static bool httpPipeliningEnabled();
static void setHTTPPipeliningEnabled(bool);
+ static bool resourcePrioritiesEnabled();
+
#if PLATFORM(COCOA)
static bool useQuickLookResourceCachingQuirks();
#endif
@@ -150,6 +152,24 @@
#endif
};
+ inline bool ResourceRequest::resourcePrioritiesEnabled()
+ {
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
+ return true;
+#elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 10100
+ // See <rdar://problem/16518595>, <rdar://problem/17168793> 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
+ }
+
+
} // namespace WebCore
#endif // ResourceRequest_h
Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp (170502 => 170503)
--- trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp 2014-06-26 23:07:19 UTC (rev 170502)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp 2014-06-26 23:15:36 UTC (rev 170503)
@@ -156,7 +156,8 @@
if (httpPipeliningEnabled())
wkHTTPRequestEnablePipelining(cfRequest);
- wkSetHTTPRequestPriority(cfRequest, toPlatformRequestPriority(m_priority));
+ if (resourcePrioritiesEnabled())
+ wkSetHTTPRequestPriority(cfRequest, toPlatformRequestPriority(m_priority));
#if !PLATFORM(WIN)
wkCFURLRequestAllowAllPostCaching(cfRequest);
@@ -282,7 +283,8 @@
}
m_allowCookies = CFURLRequestShouldHandleHTTPCookies(m_cfRequest.get());
- m_priority = toResourceLoadPriority(wkGetHTTPRequestPriority(m_cfRequest.get()));
+ if (resourcePrioritiesEnabled())
+ m_priority = toResourceLoadPriority(wkGetHTTPRequestPriority(m_cfRequest.get()));
m_httpHeaderFields.clear();
if (CFDictionaryRef headers = CFURLRequestCopyAllHTTPHeaderFields(m_cfRequest.get())) {
@@ -398,27 +400,32 @@
#endif
}
+// 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.
unsigned initializeMaximumHTTPConnectionCountPerHost()
{
static const unsigned preferredConnectionCount = 6;
- static const unsigned unlimitedConnectionCount = 10000;
+ static const unsigned unlimitedRequestCount = 10000;
- wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
+ unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
Boolean keyExistsAndHasValidFormat = false;
Boolean prefValue = CFPreferencesGetAppBooleanValue(CFSTR("WebKitEnableHTTPPipelining"), kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
if (keyExistsAndHasValidFormat)
ResourceRequest::setHTTPPipeliningEnabled(prefValue);
+ // Use WebCore scheduler when we can't use request priorities with CFNetwork.
+ if (!ResourceRequest::resourcePrioritiesEnabled())
+ return maximumHTTPConnectionCountPerHost;
+
wkSetHTTPRequestMaximumPriority(toPlatformRequestPriority(ResourceLoadPriorityHighest));
#if !PLATFORM(WIN)
// FIXME: <rdar://problem/9375609> Implement minimum fast lane priority setting on Windows
wkSetHTTPRequestMinimumFastLanePriority(toPlatformRequestPriority(ResourceLoadPriorityMedium));
#endif
- return unlimitedConnectionCount;
+ return unlimitedRequestCount;
}
-
+
#if PLATFORM(IOS)
void initializeHTTPConnectionSettingsOnStartup()
{
Modified: trunk/Source/WebCore/platform/network/mac/ResourceRequestMac.mm (170502 => 170503)
--- trunk/Source/WebCore/platform/network/mac/ResourceRequestMac.mm 2014-06-26 23:07:19 UTC (rev 170502)
+++ trunk/Source/WebCore/platform/network/mac/ResourceRequestMac.mm 2014-06-26 23:15:36 UTC (rev 170503)
@@ -109,7 +109,8 @@
m_httpMethod = method;
m_allowCookies = [m_nsRequest.get() HTTPShouldHandleCookies];
- m_priority = toResourceLoadPriority(wkGetHTTPRequestPriority([m_nsRequest.get() _CFURLRequest]));
+ if (ResourceRequest::resourcePrioritiesEnabled())
+ m_priority = toResourceLoadPriority(wkGetHTTPRequestPriority([m_nsRequest.get() _CFURLRequest]));
NSDictionary *headers = [m_nsRequest.get() allHTTPHeaderFields];
NSEnumerator *e = [headers keyEnumerator];
@@ -167,7 +168,8 @@
if (ResourceRequest::httpPipeliningEnabled())
wkHTTPRequestEnablePipelining([nsRequest _CFURLRequest]);
- wkSetHTTPRequestPriority([nsRequest _CFURLRequest], toPlatformRequestPriority(m_priority));
+ if (ResourceRequest::resourcePrioritiesEnabled())
+ wkSetHTTPRequestPriority([nsRequest _CFURLRequest], toPlatformRequestPriority(m_priority));
[nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()];
wkCFURLRequestAllowAllPostCaching([nsRequest _CFURLRequest]);
Modified: trunk/Source/WebKit2/ChangeLog (170502 => 170503)
--- trunk/Source/WebKit2/ChangeLog 2014-06-26 23:07:19 UTC (rev 170502)
+++ trunk/Source/WebKit2/ChangeLog 2014-06-26 23:15:36 UTC (rev 170503)
@@ -1,3 +1,15 @@
+2014-06-26 Alexey Proskuryakov <[email protected]>
+
+ REGRESSION: Mountain Lion: Gmail's "in new window" view of mail threads is very slow to load its content
+ https://bugs.webkit.org/show_bug.cgi?id=133882
+ <rdar://problem/17271965>
+
+ Reviewed by Brady Eidson.
+
+ * NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm:
+ (WebKit::NetworkResourceLoadScheduler::platformInitializeMaximumHTTPConnectionCountPerHost):
+ Same fix as in WebCore.
+
2014-06-26 Brady Eidson <[email protected]>
Remove use of PlatformStrategies for Gamepad API.
Modified: trunk/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm (170502 => 170503)
--- trunk/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm 2014-06-26 23:07:19 UTC (rev 170502)
+++ trunk/Source/WebKit2/NetworkProcess/mac/NetworkResourceLoadSchedulerMac.mm 2014-06-26 23:15:36 UTC (rev 170503)
@@ -40,19 +40,23 @@
void NetworkResourceLoadScheduler::platformInitializeMaximumHTTPConnectionCountPerHost()
{
static const unsigned preferredConnectionCount = 6;
- static const unsigned unlimitedConnectionCount = 10000;
+ static const unsigned unlimitedRequestCount = 10000;
- WKInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
+ unsigned maximumHTTPConnectionCountPerHost = WKInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
Boolean keyExistsAndHasValidFormat = false;
Boolean prefValue = CFPreferencesGetAppBooleanValue(CFSTR("WebKitEnableHTTPPipelining"), kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
if (keyExistsAndHasValidFormat)
ResourceRequest::setHTTPPipeliningEnabled(prefValue);
- WKSetHTTPRequestMaximumPriority(toPlatformRequestPriority(ResourceLoadPriorityHighest));
- WKSetHTTPRequestMinimumFastLanePriority(toPlatformRequestPriority(ResourceLoadPriorityMedium));
-
- m_maxRequestsInFlightPerHost = unlimitedConnectionCount;
+ 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;
+ }
}
} // namespace WebKit