<http://webkit.org/b/59838> Implement HTTP pipelining for CoreFoundation-based networking
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2011 23:25:15 +0000 (23:25 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2011 23:25:15 +0000 (23:25 +0000)
Reviewed by Antti Koivisto.

Source/WebCore:

* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::ResourceRequest::doUpdatePlatformRequest): Set the
priority on the request if HTTP pipelining is enabled.
(WebCore::ResourceRequest::doUpdateResourceRequest): Read the
priority from the request if HTTP pipelining is enabled.
(readBooleanPreference): Enable code when compiling with
USE(CFNETWORK).
(WebCore::initializeMaximumHTTPConnectionCountPerHost): Ditto.
Comment out setting the minimum fast lane priority on Windows
since it's not currently available.

Source/WebKit/win:

* Interfaces/IWebViewPrivate.idl:
(IWebViewPrivate::httpPipeliningEnabled): Added declaration.
(IWebViewPrivate::setHTTPPipeliningEnabled): Added declaration.
* WebView.cpp:
(WebView::httpPipeliningEnabled): Added.
(WebView::setHTTPPipeliningEnabled): Added.
* WebView.h:
(WebView::httpPipeliningEnabled): Added declaration.
(WebView::setHTTPPipeliningEnabled): Added declaration.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85684 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/Interfaces/IWebViewPrivate.idl
Source/WebKit/win/WebView.cpp
Source/WebKit/win/WebView.h

index edfb462df34593153f0ff0a9a5dac437706d698a..1ad1934a13830be095fad0c1fd12e657c49a220d 100644 (file)
@@ -1,3 +1,20 @@
+2011-05-03  David Kilzer  <ddkilzer@apple.com>
+
+        <http://webkit.org/b/59838> Implement HTTP pipelining for CoreFoundation-based networking
+
+        Reviewed by Antti Koivisto.
+
+        * platform/network/cf/ResourceRequestCFNet.cpp:
+        (WebCore::ResourceRequest::doUpdatePlatformRequest): Set the
+        priority on the request if HTTP pipelining is enabled.
+        (WebCore::ResourceRequest::doUpdateResourceRequest): Read the
+        priority from the request if HTTP pipelining is enabled.
+        (readBooleanPreference): Enable code when compiling with
+        USE(CFNETWORK).
+        (WebCore::initializeMaximumHTTPConnectionCountPerHost): Ditto.
+        Comment out setting the minimum fast lane priority on Windows
+        since it's not currently available.
+
 2011-05-03  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Dan Bernstein.
index 6a390140d13a3bb8a866f0f3ec8d8d21830eb3f4..e90ab4fe0c95f3da3aec59c320e4af64d7ada4f7 100644 (file)
@@ -130,6 +130,9 @@ void ResourceRequest::doUpdatePlatformRequest()
     RetainPtr<CFStringRef> requestMethod(AdoptCF, httpMethod().createCFString());
     CFURLRequestSetHTTPRequestMethod(cfRequest, requestMethod.get());
 
+    if (httpPipeliningEnabled())
+        wkSetHTTPPipeliningPriority(cfRequest, toHTTPPipeliningPriority(m_priority));
+
     setHeaderFields(cfRequest, httpHeaderFields());
     WebCore::setHTTPBody(cfRequest, httpBody());
     CFURLRequestSetShouldHandleHTTPCookies(cfRequest, allowCookies());
@@ -173,6 +176,9 @@ void ResourceRequest::doUpdateResourceRequest()
     }
     m_allowCookies = CFURLRequestShouldHandleHTTPCookies(m_cfRequest.get());
 
+    if (httpPipeliningEnabled())
+        m_priority = toResourceLoadPriority(wkGetHTTPPipeliningPriority(m_cfRequest.get()));
+
     m_httpHeaderFields.clear();
     if (CFDictionaryRef headers = CFURLRequestCopyAllHTTPHeaderFields(m_cfRequest.get())) {
         CFIndex headerCount = CFDictionaryGetCount(headers);
@@ -221,7 +227,7 @@ void ResourceRequest::setHTTPPipeliningEnabled(bool flag)
     s_httpPipeliningEnabled = flag;
 }
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if USE(CFNETWORK) || PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
 static inline bool readBooleanPreference(CFStringRef key)
 {
     Boolean keyExistsAndHasValidFormat;
@@ -237,7 +243,7 @@ unsigned initializeMaximumHTTPConnectionCountPerHost()
     // Always set the connection count per host, even when pipelining.
     unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
 
-#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+#if USE(CFNETWORK) || PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     static const unsigned unlimitedConnectionCount = 10000;
 
     if (!ResourceRequest::httpPipeliningEnabled() && readBooleanPreference(CFSTR("WebKitEnableHTTPPipelining")))
@@ -245,7 +251,10 @@ unsigned initializeMaximumHTTPConnectionCountPerHost()
 
     if (ResourceRequest::httpPipeliningEnabled()) {
         wkSetHTTPPipeliningMaximumPriority(ResourceLoadPriorityHighest);
+#if !PLATFORM(WIN)
+        // FIXME: <rdar://problem/9375609> Implement minimum fast lane priority setting on Windows
         wkSetHTTPPipeliningMinimumFastLanePriority(ResourceLoadPriorityMedium);
+#endif
         // When pipelining do not rate-limit requests sent from WebCore since CFNetwork handles that.
         return unlimitedConnectionCount;
     }
index 4694dda2a28a2ecb1b472b955efd6bc3399a407b..c9a4f50be6626f058492222d09541954e5c8766c 100644 (file)
@@ -1,3 +1,19 @@
+2011-05-03  David Kilzer  <ddkilzer@apple.com>
+
+        <http://webkit.org/b/59838> Implement HTTP pipelining for CoreFoundation-based networking
+
+        Reviewed by Antti Koivisto.
+
+        * Interfaces/IWebViewPrivate.idl:
+        (IWebViewPrivate::httpPipeliningEnabled): Added declaration.
+        (IWebViewPrivate::setHTTPPipeliningEnabled): Added declaration.
+        * WebView.cpp:
+        (WebView::httpPipeliningEnabled): Added.
+        (WebView::setHTTPPipeliningEnabled): Added.
+        * WebView.h:
+        (WebView::httpPipeliningEnabled): Added declaration.
+        (WebView::setHTTPPipeliningEnabled): Added declaration.
+
 2011-05-03  Adam Roben  <aroben@apple.com>
 
         Add some missing virtual keywords on derived-class destructors
index 6c6abfd1a54c3a8a1661e131aadd3346db8c1b8b..13f942f6f4a84861b441a93a80069284a2b5ba82 100644 (file)
@@ -259,4 +259,20 @@ interface IWebViewPrivate : IUnknown
         - (double)interval;
     */
     HRESULT setMinimumTimerInterval([in] double interval);
+
+    /*!
+        @method _HTTPPipeliningEnabled
+        @abstract Checks the HTTP pipelining status.
+        @discussion Defaults to NO.
+        @result YES if HTTP pipelining is enabled, NO if not enabled.
+     */
+    HRESULT httpPipeliningEnabled([out, retval] BOOL* enabled);
+
+    /*!
+        @method _setHTTPPipeliningEnabled:
+        @abstract Set the HTTP pipelining status.
+        @discussion Defaults to NO.
+        @param enabled The new HTTP pipelining status.
+     */
+    HRESULT setHTTPPipeliningEnabled([in] BOOL enabled);
 }
index 3c0a7966bc2069d454ccd020adfdc2db08125be4..924505255590d7e166c27eec482df3b4cb032dcf 100644 (file)
 #include <WebCore/RenderWidget.h>
 #include <WebCore/ResourceHandle.h>
 #include <WebCore/ResourceHandleClient.h>
+#include <WebCore/ResourceRequest.h>
 #include <WebCore/SchemeRegistry.h>
 #include <WebCore/ScriptValue.h>
 #include <WebCore/Scrollbar.h>
@@ -6737,6 +6738,20 @@ HRESULT WebView::setMinimumTimerInterval(double interval)
     return S_OK;
 }
 
+HRESULT WebView::httpPipeliningEnabled(BOOL* enabled)
+{
+    if (!enabled)
+        return E_POINTER;
+    *enabled = ResourceRequest::httpPipeliningEnabled();
+    return S_OK;
+}
+
+HRESULT WebView::setHTTPPipeliningEnabled(BOOL enabled)
+{
+    ResourceRequest::setHTTPPipeliningEnabled(enabled);
+    return S_OK;
+}
+
 void WebView::setGlobalHistoryItem(HistoryItem* historyItem)
 {
     m_globalHistoryItem = historyItem;
index bc364605b978db34e814662683ed4f719b90204d..71cef897cd8524bdf82f3a05201d79dbb855337c 100644 (file)
@@ -830,6 +830,12 @@ public:
     virtual HRESULT STDMETHODCALLTYPE setMinimumTimerInterval(
         /* [in] */ double);
 
+    virtual HRESULT STDMETHODCALLTYPE httpPipeliningEnabled(
+        /* [out, retval] */ BOOL* enabled);
+
+    virtual HRESULT STDMETHODCALLTYPE setHTTPPipeliningEnabled(
+        /* [in] */ BOOL);
+
     virtual HRESULT STDMETHODCALLTYPE setUsesLayeredWindow(BOOL);
     virtual HRESULT STDMETHODCALLTYPE usesLayeredWindow(BOOL*);