[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

ddkilzer at apple.com ddkilzer at apple.com
Sun Feb 20 23:57:25 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit e2501bd4b97d678539c85d0257c4ada0f0c5ef89
Author: ddkilzer at apple.com <ddkilzer at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 27 04:57:01 2011 +0000

    <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork
    <rdar://problem/8821760>
    
    Reviewed by Antti Koivisto.
    
    Source/WebCore:
    
    This adds support for HTTP pipelining in CFNetwork, but does not
    enable it.  To enable it post-SnowLeopard, use this command:
    
        defaults write BUNDLE.ID WebKitEnableHTTPPipelining -bool YES
    
    Once enabled, it is possible to force the same load priority
    (high) to be sent to CFNetwork to allow WebCore to handle the
    scheduling:
    
        defaults write BUNDLE.ID WebKitForceHTTPPipeliningPriorityHigh -bool YES
    
    * WebCore.exp.in: Export _wkGetHTTPPipeliningPriority and
    _wkSetHTTPPipeliningPriority.
    
    * loader/DocumentThreadableLoader.cpp:
    (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight):
    Copy the priority to preflightRequest.
    
    * loader/ResourceLoadScheduler.cpp:
    (WebCore::ResourceLoadScheduler::scheduleLoad): Refactored code
    at the end of the method to use an early return.
    
    * loader/cache/CachedResourceRequest.cpp:
    (WebCore::CachedResourceRequest::load): Set the priority on the
    ResourceRequest object based on the priority of the
    CachedResourceRequest before calling
    ResourceLoadScheduler::scheduleSubresourceLoad().
    
    * loader/icon/IconLoader.cpp:
    (WebCore::IconLoader::startLoading): Create a ResourceRequest
    object and set its priority to ResourceLoadPriorityLow before
    passing it to ResourceLoadScheduler::scheduleSubresourceLoad().
    
    * platform/mac/WebCoreSystemInterface.h:
    (wkGetHTTPPipeliningPriority): Added.
    (wkSetHTTPPipeliningPriority): Added.
    * platform/mac/WebCoreSystemInterface.mm:
    (wkGetHTTPPipeliningPriority): Added.
    (wkSetHTTPPipeliningPriority): Added.
    
    * platform/network/ResourceRequestBase.cpp:
    (WebCore::ResourceRequestBase::adopt): Set m_priority when
    adopting a CrossThreadResourceRequestData.
    (WebCore::ResourceRequestBase::copyData): Set m_priority when
    creating a CrossThreadResourceRequestData.
    (WebCore::ResourceRequestBase::priority): Added.
    (WebCore::ResourceRequestBase::setPriority): Added.
    (WebCore::equalIgnoringHeaderFields): Priorities must match when
    comparing two ResourceRequest objects.
    
    * platform/network/ResourceRequestBase.h:
    (WebCore::ResourceRequestBase::ResourceRequestBase): Set default
    priority of new objects to ResourceLoadPriorityLow.
    (WebCore::ResourceRequestBase::priority): Added declaration.
    (WebCore::ResourceRequestBase::setPriority): Added declaration.
    (WebCore::isHTTPPipeliningEnabled): Added.
    (WebCore::shouldUseHTTPPipeliningPriority): Added.
    
    * platform/network/cf/ResourceRequestCFNet.cpp: Updated so that
    Mac OS X and Windows share code.
    (WebCore::initializeMaximumHTTPConnectionCountPerHost): Always
    set the HTTP connection count per host, but return an
    'unlimited' value when using HTTP pipelining.  This method used
    to be defined in ResourceRequestMac.mm for Mac OS X.
    (WebCore::readBooleanPreference): Added.  Helper method for
    reading boolean user defaults.
    (WebCore::isHTTPPipeliningEnabled): Returns value of user
    default key WebKitEnableHTTPPipelining, or false if not set.
    (WebCore::shouldUseHTTPPipeliningPriority): Returns value of
    user default key WebKitForceHTTPPipeliningPriorityHigh, or false
    if not set.
    * platform/network/cf/ResourceRequestCFNet.h: Updated so that
    Mac OS X and Windows share code.  Fixed indentation.
    (WebCore::mapHTTPPipeliningPriorityToResourceLoadPriority): Added.
    (WebCore::mapResourceLoadPriorityToHTTPPipeliningPriority): Added.
    
    * platform/network/mac/ResourceRequestMac.mm:
    (WebCore::ResourceRequest::doUpdatePlatformRequest): Update
    HTTP pipelining priority on NSMutableFURLRequest object.
    (WebCore::ResourceRequest::doUpdateResourceRequest): Update
    m_priority from the NSURLRequest object.
    (WebCore::initializeMaximumHTTPConnectionCountPerHost): Removed.
    Code is now shared with Windows in ResourceRequestCFNet.cpp.
    
    Source/WebKit/mac:
    
    * WebCoreSupport/WebSystemInterface.mm:
    (InitWebCoreSystemInterface): Added initialization for
    GetHTTPPipeliningPriority and SetHTTPPipeliningPriority.
    
    Source/WebKit2:
    
    * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
    (InitWebCoreSystemInterface): Added initialization for
    GetHTTPPipeliningPriority and SetHTTPPipeliningPriority.
    
    WebKitLibraries:
    
    * WebKitSystemInterface.h:
        New methods added for HTTP pipelining support.
    (WKGetHTTPPipeliningPriority): Added.
    (WKSetHTTPPipeliningPriority): Added.
        Unrelated methods added after updating the header.
    (WKMakeScrollbarPainter): Added.
    (WKScrollbarPainterPaint): Added.
    * libWebKitSystemInterfaceLeopard.a: Updated.
    * libWebKitSystemInterfaceSnowLeopard.a: Updated.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76756 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 94b2d34..3af0be6 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,94 @@
+2011-01-26  David Kilzer  <ddkilzer at apple.com>
+
+        <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork
+        <rdar://problem/8821760>
+
+        Reviewed by Antti Koivisto.
+
+        This adds support for HTTP pipelining in CFNetwork, but does not
+        enable it.  To enable it post-SnowLeopard, use this command:
+
+            defaults write BUNDLE.ID WebKitEnableHTTPPipelining -bool YES
+
+        Once enabled, it is possible to force the same load priority
+        (high) to be sent to CFNetwork to allow WebCore to handle the
+        scheduling:
+
+            defaults write BUNDLE.ID WebKitForceHTTPPipeliningPriorityHigh -bool YES
+
+        * WebCore.exp.in: Export _wkGetHTTPPipeliningPriority and
+        _wkSetHTTPPipeliningPriority.
+
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight):
+        Copy the priority to preflightRequest.
+
+        * loader/ResourceLoadScheduler.cpp:
+        (WebCore::ResourceLoadScheduler::scheduleLoad): Refactored code
+        at the end of the method to use an early return.
+
+        * loader/cache/CachedResourceRequest.cpp:
+        (WebCore::CachedResourceRequest::load): Set the priority on the
+        ResourceRequest object based on the priority of the
+        CachedResourceRequest before calling
+        ResourceLoadScheduler::scheduleSubresourceLoad().
+
+        * loader/icon/IconLoader.cpp:
+        (WebCore::IconLoader::startLoading): Create a ResourceRequest
+        object and set its priority to ResourceLoadPriorityLow before
+        passing it to ResourceLoadScheduler::scheduleSubresourceLoad().
+
+        * platform/mac/WebCoreSystemInterface.h:
+        (wkGetHTTPPipeliningPriority): Added.
+        (wkSetHTTPPipeliningPriority): Added.
+        * platform/mac/WebCoreSystemInterface.mm:
+        (wkGetHTTPPipeliningPriority): Added.
+        (wkSetHTTPPipeliningPriority): Added.
+
+        * platform/network/ResourceRequestBase.cpp:
+        (WebCore::ResourceRequestBase::adopt): Set m_priority when
+        adopting a CrossThreadResourceRequestData.
+        (WebCore::ResourceRequestBase::copyData): Set m_priority when
+        creating a CrossThreadResourceRequestData.
+        (WebCore::ResourceRequestBase::priority): Added.
+        (WebCore::ResourceRequestBase::setPriority): Added.
+        (WebCore::equalIgnoringHeaderFields): Priorities must match when
+        comparing two ResourceRequest objects.
+
+        * platform/network/ResourceRequestBase.h:
+        (WebCore::ResourceRequestBase::ResourceRequestBase): Set default
+        priority of new objects to ResourceLoadPriorityLow.
+        (WebCore::ResourceRequestBase::priority): Added declaration.
+        (WebCore::ResourceRequestBase::setPriority): Added declaration.
+        (WebCore::isHTTPPipeliningEnabled): Added.
+        (WebCore::shouldUseHTTPPipeliningPriority): Added.
+
+        * platform/network/cf/ResourceRequestCFNet.cpp: Updated so that
+        Mac OS X and Windows share code.
+        (WebCore::initializeMaximumHTTPConnectionCountPerHost): Always
+        set the HTTP connection count per host, but return an
+        'unlimited' value when using HTTP pipelining.  This method used
+        to be defined in ResourceRequestMac.mm for Mac OS X.
+        (WebCore::readBooleanPreference): Added.  Helper method for
+        reading boolean user defaults.
+        (WebCore::isHTTPPipeliningEnabled): Returns value of user
+        default key WebKitEnableHTTPPipelining, or false if not set.
+        (WebCore::shouldUseHTTPPipeliningPriority): Returns value of
+        user default key WebKitForceHTTPPipeliningPriorityHigh, or false
+        if not set.
+        * platform/network/cf/ResourceRequestCFNet.h: Updated so that
+        Mac OS X and Windows share code.  Fixed indentation.
+        (WebCore::mapHTTPPipeliningPriorityToResourceLoadPriority): Added.
+        (WebCore::mapResourceLoadPriorityToHTTPPipeliningPriority): Added.
+
+        * platform/network/mac/ResourceRequestMac.mm:
+        (WebCore::ResourceRequest::doUpdatePlatformRequest): Update
+        HTTP pipelining priority on NSMutableFURLRequest object.
+        (WebCore::ResourceRequest::doUpdateResourceRequest): Update
+        m_priority from the NSURLRequest object.
+        (WebCore::initializeMaximumHTTPConnectionCountPerHost): Removed.
+        Code is now shared with Windows in ResourceRequestCFNet.cpp.
+
 2011-01-26  Beth Dakin  <bdakin at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index a4a2628..a4bdaa8 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -1248,6 +1248,7 @@ _wkGetFontInLanguageForCharacter
 _wkGetFontInLanguageForRange
 _wkGetGlyphTransformedAdvances
 _wkGetGlyphsForCharacters
+_wkGetHTTPPipeliningPriority
 _wkGetHyphenationLocationBeforeIndex
 _wkGetMIMETypeForExtension
 _wkGetNSURLResponseCalculatedExpiration
@@ -1278,6 +1279,7 @@ _wkSetCONNECTProxyAuthorizationForStream
 _wkSetCONNECTProxyForStream
 _wkSetCookieStoragePrivateBrowsingEnabled
 _wkSetDragImage
+_wkSetHTTPPipeliningPriority
 _wkSetNSURLConnectionDefersCallbacks
 _wkSetNSURLRequestShouldContentSniff
 _wkSetPatternBaseCTM
diff --git a/Source/WebCore/loader/DocumentThreadableLoader.cpp b/Source/WebCore/loader/DocumentThreadableLoader.cpp
index dee5001..d0f7f48 100644
--- a/Source/WebCore/loader/DocumentThreadableLoader.cpp
+++ b/Source/WebCore/loader/DocumentThreadableLoader.cpp
@@ -144,6 +144,8 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight(const R
         preflightRequest.setHTTPHeaderField("Access-Control-Request-Headers", String::adopt(headerBuffer));
     }
 
+    preflightRequest.setPriority(request.priority());
+
     loadRequest(preflightRequest, DoSecurityCheck);
 }
 
diff --git a/Source/WebCore/loader/ResourceLoadScheduler.cpp b/Source/WebCore/loader/ResourceLoadScheduler.cpp
index 8cf2c18..dbb6914 100644
--- a/Source/WebCore/loader/ResourceLoadScheduler.cpp
+++ b/Source/WebCore/loader/ResourceLoadScheduler.cpp
@@ -90,7 +90,7 @@ PassRefPtr<SubresourceLoader> ResourceLoadScheduler::scheduleSubresourceLoad(Fra
         scheduleLoad(loader.get(), priority);
     return loader;
 }
-    
+
 PassRefPtr<NetscapePlugInStreamLoader> ResourceLoadScheduler::schedulePluginStreamLoad(Frame* frame, NetscapePlugInStreamLoaderClient* client, const ResourceRequest& request)
 {
     PassRefPtr<NetscapePlugInStreamLoader> loader = NetscapePlugInStreamLoader::create(frame, client, request);
@@ -120,11 +120,12 @@ void ResourceLoadScheduler::scheduleLoad(ResourceLoader* resourceLoader, Resourc
     if (priority > ResourceLoadPriorityLow || !resourceLoader->url().protocolInHTTPFamily() || (priority == ResourceLoadPriorityLow && !hadRequests)) {
         // Try to request important resources immediately.
         servePendingRequests(host, priority);
-    } else {
-        // Handle asynchronously so early low priority requests don't get scheduled before later high priority ones.
-        InspectorInstrumentation::didScheduleResourceRequest(resourceLoader->frameLoader() ? resourceLoader->frameLoader()->frame()->document() : 0, resourceLoader->url());
-        scheduleServePendingRequests();
+        return;
     }
+
+    // Handle asynchronously so early low priority requests don't get scheduled before later high priority ones.
+    InspectorInstrumentation::didScheduleResourceRequest(resourceLoader->frameLoader() ? resourceLoader->frameLoader()->frame()->document() : 0, resourceLoader->url());
+    scheduleServePendingRequests();
 }
 
 void ResourceLoadScheduler::remove(ResourceLoader* resourceLoader)
diff --git a/Source/WebCore/loader/cache/CachedResourceRequest.cpp b/Source/WebCore/loader/cache/CachedResourceRequest.cpp
index d5e1adf..1d2f706 100644
--- a/Source/WebCore/loader/cache/CachedResourceRequest.cpp
+++ b/Source/WebCore/loader/cache/CachedResourceRequest.cpp
@@ -113,6 +113,7 @@ PassRefPtr<CachedResourceRequest> CachedResourceRequest::load(CachedResourceLoad
 #endif
 
     ResourceLoadPriority priority = resource->loadPriority();
+    resourceRequest.setPriority(priority);
 
     RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->document()->frame(),
         request.get(), resourceRequest, priority, securityCheck, sendResourceLoadCallbacks);
diff --git a/Source/WebCore/loader/icon/IconLoader.cpp b/Source/WebCore/loader/icon/IconLoader.cpp
index 24562d0..bb738e8 100644
--- a/Source/WebCore/loader/icon/IconLoader.cpp
+++ b/Source/WebCore/loader/icon/IconLoader.cpp
@@ -69,7 +69,10 @@ void IconLoader::startLoading()
     // SubresourceLoader::create returns.
     m_loadIsInProgress = true;
 
-    RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_frame, this, m_frame->loader()->iconURL());
+    ResourceRequest resourceRequest(m_frame->loader()->iconURL());
+    resourceRequest.setPriority(ResourceLoadPriorityLow);
+
+    RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_frame, this, resourceRequest);
     if (!loader)
         LOG_ERROR("Failed to start load for icon at url %s", m_frame->loader()->iconURL().string().ascii().data());
 
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
index 4e5f9ce..fdd38dc 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -147,6 +147,8 @@ extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
 extern void (*wkSignalCFReadStreamError)(CFReadStreamRef stream, CFStreamError *error);
 extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
 extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
+extern int (*wkGetHTTPPipeliningPriority)(NSURLRequest *);
+extern void (*wkSetHTTPPipeliningPriority)(NSMutableURLRequest *, int priority);
 extern void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
 extern void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
 extern CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL);
diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
index 08a5023..e281767 100644
--- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -89,6 +89,8 @@ void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
 void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
 id (*wkCreateNSURLConnectionDelegateProxy)(void);
 unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
+int (*wkGetHTTPPipeliningPriority)(NSURLRequest *);
+void (*wkSetHTTPPipeliningPriority)(NSMutableURLRequest *, int priority);
 void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
 void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString);
 CFHTTPMessageRef (*wkCopyCONNECTProxyResponse)(CFReadStreamRef, CFURLRef responseURL);
diff --git a/Source/WebCore/platform/network/ResourceRequestBase.cpp b/Source/WebCore/platform/network/ResourceRequestBase.cpp
index ae8316a..ba58461 100644
--- a/Source/WebCore/platform/network/ResourceRequestBase.cpp
+++ b/Source/WebCore/platform/network/ResourceRequestBase.cpp
@@ -45,6 +45,7 @@ PassOwnPtr<ResourceRequest> ResourceRequestBase::adopt(PassOwnPtr<CrossThreadRes
     request->setTimeoutInterval(data->m_timeoutInterval);
     request->setFirstPartyForCookies(data->m_firstPartyForCookies);
     request->setHTTPMethod(data->m_httpMethod);
+    request->setPriority(data->m_priority);
     request->setTargetType(data->m_targetType);
 
     request->updateResourceRequest();
@@ -78,6 +79,7 @@ PassOwnPtr<CrossThreadResourceRequestData> ResourceRequestBase::copyData() const
     data->m_firstPartyForCookies = firstPartyForCookies().copy();
     data->m_httpMethod = httpMethod().crossThreadString();
     data->m_httpHeaders = httpHeaderFields().copyData();
+    data->m_priority = priority();
     data->m_targetType = m_targetType;
 
     data->m_responseContentDispositionEncodingFallbackArray.reserveInitialCapacity(m_responseContentDispositionEncodingFallbackArray.size());
@@ -314,6 +316,23 @@ void ResourceRequestBase::setAllowCookies(bool allowCookies)
         m_platformRequestUpdated = false;
 }
 
+ResourceLoadPriority ResourceRequestBase::priority() const
+{
+    updateResourceRequest();
+
+    return m_priority;
+}
+
+void ResourceRequestBase::setPriority(ResourceLoadPriority priority)
+{
+    updateResourceRequest();
+
+    m_priority = priority;
+
+    if (url().protocolInHTTPFamily())
+        m_platformRequestUpdated = false;
+}
+
 void ResourceRequestBase::addHTTPHeaderField(const AtomicString& name, const String& value) 
 {
     updateResourceRequest();
@@ -352,6 +371,9 @@ bool equalIgnoringHeaderFields(const ResourceRequestBase& a, const ResourceReque
     if (a.allowCookies() != b.allowCookies())
         return false;
     
+    if (a.priority() != b.priority())
+        return false;
+
     FormData* formDataA = a.httpBody();
     FormData* formDataB = b.httpBody();
     
diff --git a/Source/WebCore/platform/network/ResourceRequestBase.h b/Source/WebCore/platform/network/ResourceRequestBase.h
index dce33db..9cc9148 100644
--- a/Source/WebCore/platform/network/ResourceRequestBase.h
+++ b/Source/WebCore/platform/network/ResourceRequestBase.h
@@ -29,8 +29,9 @@
 #define ResourceRequestBase_h
 
 #include "FormData.h"
-#include "KURL.h"
 #include "HTTPHeaderMap.h"
+#include "KURL.h"
+#include "ResourceLoadPriority.h"
 
 #include <wtf/OwnPtr.h>
 
@@ -128,6 +129,9 @@ namespace WebCore {
         bool allowCookies() const;
         void setAllowCookies(bool allowCookies);
 
+        ResourceLoadPriority priority() const;
+        void setPriority(ResourceLoadPriority);
+
         bool isConditional() const;
 
         // Whether the associated ResourceHandleClient needs to be notified of
@@ -157,6 +161,7 @@ namespace WebCore {
             , m_reportUploadProgress(false)
             , m_reportLoadTiming(false)
             , m_reportRawHeaders(false)
+            , m_priority(ResourceLoadPriorityLow)
             , m_targetType(TargetIsSubresource)
         {
         }
@@ -172,6 +177,7 @@ namespace WebCore {
             , m_reportUploadProgress(false)
             , m_reportLoadTiming(false)
             , m_reportRawHeaders(false)
+            , m_priority(ResourceLoadPriorityLow)
             , m_targetType(TargetIsSubresource)
         {
         }
@@ -197,6 +203,7 @@ namespace WebCore {
         bool m_reportUploadProgress;
         bool m_reportLoadTiming;
         bool m_reportRawHeaders;
+        ResourceLoadPriority m_priority;
         TargetType m_targetType;
 
     private:
@@ -223,11 +230,20 @@ namespace WebCore {
         Vector<String> m_responseContentDispositionEncodingFallbackArray;
         RefPtr<FormData> m_httpBody;
         bool m_allowCookies;
+        ResourceLoadPriority m_priority;
         ResourceRequestBase::TargetType m_targetType;
     };
     
     unsigned initializeMaximumHTTPConnectionCountPerHost();
 
+#if PLATFORM(CF)
+    bool isHTTPPipeliningEnabled();
+    bool shouldForceHTTPPipeliningPriorityHigh();
+#else
+    inline bool isHTTPPipeliningEnabled() { return false; }
+    inline bool shouldForceHTTPPipeliningPriorityHigh() { return false; }
+#endif
+
 } // namespace WebCore
 
 #endif // ResourceRequestBase_h
diff --git a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
index 410a649..7a1dfd5 100644
--- a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
+++ b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
@@ -26,16 +26,22 @@
 #include "config.h"
 #include "ResourceRequestCFNet.h"
 
-#if USE(CFNETWORK)
-
-#include "FormDataStreamCFNet.h"
 #include "ResourceRequest.h"
 
+#if PLATFORM(MAC)
+#include "WebCoreSystemInterface.h"
+#endif
+
+#if USE(CFNETWORK)
+#include "FormDataStreamCFNet.h"
 #include <CFNetwork/CFURLRequestPriv.h>
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
 
 namespace WebCore {
 
+#if USE(CFNETWORK)
+
 typedef void (*CFURLRequestSetContentDispositionEncodingFallbackArrayFunction)(CFMutableURLRequestRef, CFArrayRef);
 typedef CFArrayRef (*CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction)(CFURLRequestRef);
 
@@ -189,12 +195,43 @@ void ResourceRequest::doUpdateResourceRequest()
     m_httpBody = httpBodyFromRequest(m_cfRequest.get());
 }
 
+#endif // USE(CFNETWORK)
+
 unsigned initializeMaximumHTTPConnectionCountPerHost()
 {
     static const unsigned preferredConnectionCount = 6;
-    return wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
+    static const unsigned unlimitedConnectionCount = 10000;
+
+    // Always set the connection count per host, even when pipelining.
+    unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
+
+#if PLATFORM(MAC)
+    if (isHTTPPipeliningEnabled()) {
+        // When pipelining do not rate-limit requests sent from WebCore since CFNetwork handles that.
+        return unlimitedConnectionCount;
+    }
+#endif
+
+    return maximumHTTPConnectionCountPerHost;
 }
 
-} // namespace WebCore
+static inline bool readBooleanPreference(CFStringRef key)
+{
+    Boolean keyExistsAndHasValidFormat;
+    Boolean result = CFPreferencesGetAppBooleanValue(key, kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
+    return keyExistsAndHasValidFormat ? result : false;
+}
 
-#endif // USE(CFNETWORK)
+bool isHTTPPipeliningEnabled()
+{
+    static bool isEnabled = readBooleanPreference(CFSTR("WebKitEnableHTTPPipelining"));
+    return isEnabled;
+}
+
+bool shouldForceHTTPPipeliningPriorityHigh()
+{
+    static bool shouldForcePriorityHigh = readBooleanPreference(CFSTR("WebKitForceHTTPPipeliningPriorityHigh"));
+    return shouldForcePriorityHigh;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h
index 39587a4..09f4cea 100644
--- a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h
+++ b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h
@@ -26,18 +26,55 @@
 #ifndef ResourceRequestCFNet_h
 #define ResourceRequestCFNet_h
 
-#if USE(CFNETWORK)
+#include "ResourceLoadPriority.h"
 
+#if USE(CFNETWORK)
 typedef const struct _CFURLRequest* CFURLRequestRef;
+#endif
 
 namespace WebCore {
 
-    class ResourceRequest;
+class ResourceRequest;
+
+#if USE(CFNETWORK)
+void getResourceRequest(ResourceRequest&, CFURLRequestRef);
+CFURLRequestRef cfURLRequest(const ResourceRequest&);
+#endif
+
+inline ResourceLoadPriority mapHTTPPipeliningPriorityToResourceLoadPriority(int priority)
+{
+    switch (priority) {
+    case 0:
+        return ResourceLoadPriorityLow;
+    case 1:
+        return ResourceLoadPriorityMedium;
+    case 2:
+        return ResourceLoadPriorityHigh;
+    default:
+        ASSERT_NOT_REACHED();
+        return ResourceLoadPriorityLowest;
+    }
+}
+
+inline int mapResourceLoadPriorityToHTTPPipeliningPriority(ResourceLoadPriority priority)
+{
+    switch (priority) {
+    case ResourceLoadPriorityVeryLow:
+    case ResourceLoadPriorityLow:
+        return 0;
+    case ResourceLoadPriorityMedium:
+        return 1;
+    case ResourceLoadPriorityHigh:
+        return 2;
+    case ResourceLoadPriorityUnresolved:
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
 
-    void getResourceRequest(ResourceRequest&, CFURLRequestRef);
-    CFURLRequestRef cfURLRequest(const ResourceRequest&);
+    ASSERT_NOT_REACHED();
+    return 0;
 }
 
-#endif // USE(CFNETWORK)
+} // namespace WebCore
 
 #endif // ResourceRequestCFNet_h
diff --git a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm b/Source/WebCore/platform/network/mac/ResourceRequestMac.mm
index f0357e5..640d237 100644
--- a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm
+++ b/Source/WebCore/platform/network/mac/ResourceRequestMac.mm
@@ -31,6 +31,8 @@
 #import "WebCoreSystemInterface.h"
 
 #import "FormDataStreamMac.h"
+#import "ResourceRequestCFNet.h"
+#import "WebCoreSystemInterface.h"
 
 #import <Foundation/Foundation.h>
 
@@ -65,7 +67,12 @@ void ResourceRequest::doUpdateResourceRequest()
     if (NSString* method = [m_nsRequest.get() HTTPMethod])
         m_httpMethod = method;
     m_allowCookies = [m_nsRequest.get() HTTPShouldHandleCookies];
-    
+
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+    if (isHTTPPipeliningEnabled() && !shouldForceHTTPPipeliningPriorityHigh())
+        m_priority = mapHTTPPipeliningPriorityToResourceLoadPriority(wkGetHTTPPipeliningPriority(m_nsRequest.get()));
+#endif
+
     NSDictionary *headers = [m_nsRequest.get() allHTTPHeaderFields];
     NSEnumerator *e = [headers keyEnumerator];
     NSString *name;
@@ -111,6 +118,13 @@ void ResourceRequest::doUpdatePlatformRequest()
     wkSupportsMultipartXMixedReplace(nsRequest);
 #endif
 
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+    if (isHTTPPipeliningEnabled()) {
+        int priority = mapResourceLoadPriorityToHTTPPipeliningPriority(m_priority);
+        wkSetHTTPPipeliningPriority(nsRequest, shouldForceHTTPPipeliningPriorityHigh() ? 2 : priority);
+    }
+#endif
+
     [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()];
     if (timeoutInterval() != unspecifiedTimeoutInterval)
         [nsRequest setTimeoutInterval:timeoutInterval()];
@@ -154,12 +168,6 @@ void ResourceRequest::applyWebArchiveHackForMail()
     // Hack because Mail checks for this property to detect data / archive loads
     [NSURLProtocol setProperty:@"" forKey:@"WebDataRequest" inRequest:(NSMutableURLRequest *)nsURLRequest()];
 }
-    
-unsigned initializeMaximumHTTPConnectionCountPerHost()
-{
-    static const unsigned preferredConnectionCount = 6;
-    return wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
-}
 
 } // namespace WebCore
 
diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index 2831e56..cabe536 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-26  David Kilzer  <ddkilzer at apple.com>
+
+        <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork
+        <rdar://problem/8821760>
+
+        Reviewed by Antti Koivisto.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Added initialization for
+        GetHTTPPipeliningPriority and SetHTTPPipeliningPriority.
+
 2011-01-26  Beth Dakin  <bdakin at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
index 483d6d6..e9bf1a9 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
@@ -60,6 +60,7 @@ void InitWebCoreSystemInterface(void)
     INIT(GetFontInLanguageForCharacter);
     INIT(GetFontInLanguageForRange);
     INIT(GetGlyphTransformedAdvances);
+    INIT(GetHTTPPipeliningPriority);
     INIT(GetMIMETypeForExtension);
     INIT(GetNSURLResponseLastModifiedDate);
     INIT(GetPreferredExtensionForMIMEType);
@@ -75,6 +76,7 @@ void InitWebCoreSystemInterface(void)
     INIT(SetCONNECTProxyForStream);
     INIT(SetCookieStoragePrivateBrowsingEnabled);
     INIT(SetDragImage);
+    INIT(SetHTTPPipeliningPriority);
     INIT(SetNSURLConnectionDefersCallbacks);
     INIT(SetNSURLRequestShouldContentSniff);
     INIT(SetPatternBaseCTM);
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 5f61189..588476c 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-26  David Kilzer  <ddkilzer at apple.com>
+
+        <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork
+        <rdar://problem/8821760>
+
+        Reviewed by Antti Koivisto.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Added initialization for
+        GetHTTPPipeliningPriority and SetHTTPPipeliningPriority.
+
 2011-01-26  Beth Dakin  <bdakin at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
index 3d8bae7..22980ce 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
@@ -55,6 +55,7 @@ void InitWebCoreSystemInterface(void)
         INIT(GetFontInLanguageForRange);
         INIT(GetGlyphTransformedAdvances);
         INIT(GetGlyphsForCharacters);
+        INIT(GetHTTPPipeliningPriority);
         INIT(GetMIMETypeForExtension);
         INIT(GetNSURLResponseLastModifiedDate);
         INIT(GetPreferredExtensionForMIMEType);
@@ -82,6 +83,7 @@ void InitWebCoreSystemInterface(void)
         INIT(SetCONNECTProxyForStream);
         INIT(SetCookieStoragePrivateBrowsingEnabled);
         INIT(SetDragImage);
+        INIT(SetHTTPPipeliningPriority);
         INIT(SetNSURLConnectionDefersCallbacks);
         INIT(SetNSURLRequestShouldContentSniff);
         INIT(SetPatternBaseCTM);
diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog
index 6c72be4..757f0bb 100644
--- a/WebKitLibraries/ChangeLog
+++ b/WebKitLibraries/ChangeLog
@@ -1,3 +1,20 @@
+2011-01-26  David Kilzer  <ddkilzer at apple.com>
+
+        <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork
+        <rdar://problem/8821760>
+
+        Reviewed by Antti Koivisto.
+
+        * WebKitSystemInterface.h:
+            New methods added for HTTP pipelining support.
+        (WKGetHTTPPipeliningPriority): Added.
+        (WKSetHTTPPipeliningPriority): Added.
+            Unrelated methods added after updating the header.
+        (WKMakeScrollbarPainter): Added.
+        (WKScrollbarPainterPaint): Added.
+        * libWebKitSystemInterfaceLeopard.a: Updated.
+        * libWebKitSystemInterfaceSnowLeopard.a: Updated.
+
 2011-01-24  Jer Noble  <jer.noble at apple.com>
 
         Reviewed by Eric Carlson.
diff --git a/WebKitLibraries/WebKitSystemInterface.h b/WebKitLibraries/WebKitSystemInterface.h
index d232229..db39c91 100644
--- a/WebKitLibraries/WebKitSystemInterface.h
+++ b/WebKitLibraries/WebKitSystemInterface.h
@@ -327,6 +327,8 @@ UInt8 WKGetNSEventKeyChar(NSEvent *);
 void WKSetCAAnimationValueFunction(CAPropertyAnimation*, NSString* function);
 
 unsigned WKInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount);
+int WKGetHTTPPipeliningPriority(NSURLRequest *);
+void WKSetHTTPPipeliningPriority(NSMutableURLRequest *, int priority);
 
 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort);
 void WKSetCONNECTProxyAuthorizationForStream(CFReadStreamRef, CFStringRef proxyAuthorizationString);
@@ -377,6 +379,10 @@ bool WKSandboxExtensionInvalidate(WKSandboxExtensionRef sandboxExtension);
 const char* WKSandboxExtensionGetSerializedFormat(WKSandboxExtensionRef sandboxExtension, size_t* length);
 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length);
 
+typedef struct __WKScrollbarPainter *WKScrollbarPainterRef;
+WKScrollbarPainterRef WKMakeScrollbarPainter(int controlSize, bool isHorizontal);
+void WKScrollbarPainterPaint(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect);
+
 #endif
 
 #ifdef __cplusplus
diff --git a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a
index dd0d652..74837e3 100644
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ
diff --git a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a
index d2e5a5f..0fb7206 100644
Binary files a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a differ

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list