<http://webkit.org/b/58463> Switch HTTP pipelining from user default to private setting
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Apr 2011 04:06:25 +0000 (04:06 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Apr 2011 04:06:25 +0000 (04:06 +0000)
<rdar://problem/9268729>

Reviewed by Dan Bernstein.

This replaces support for the WebKitEnableHTTPPipelining user
default with methods on the WebCore::ResourceRequest class in
WebCore, the WebView class in WebKit1, and the WebContext class
in WebKit2.  It also removes support for the
WebKitForceHTTPPipeliningPriorityHigh user default which was not
needed.

Source/WebCore:

Run these commands if you set the user defaults previously,
replacing "BUNDLE.ID" with your application's bundle ID:

    defaults delete BUNDLE.ID WebKitEnableHTTPPipelining
    defaults delete BUNDLE.ID WebKitForceHTTPPipeliningPriorityHigh

* WebCore.exp.in: Export ResourceRequest::httpPipeliningEnabled()
and ResourceRequest::setHTTPPipeliningEnabled().

* platform/network/ResourceRequestBase.h:
(WebCore::isHTTPPipeliningEnabled): Removed declaration.
(WebCore::shouldForceHTTPPipeliningPriorityHigh): Removed declaration.

* platform/network/cf/ResourceRequest.h:
(WebCore::ResourceRequest::httpPipeliningEnabled): Added declaration.
(WebCore::ResourceRequest::setHTTPPipeliningEnabled): Added declaration.
(WebCore::ResourceRequest::s_httpPipeliningEnabled): Added declaration.

* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::ResourceRequest::s_httpPipeliningEnabled): Added.
(WebCore::ResourceRequest::httpPipeliningEnabled): Added.
(WebCore::ResourceRequest::setHTTPPipeliningEnabled): Added.
(WebCore::initializeMaximumHTTPConnectionCountPerHost): Switched
to use ResourceRequest::httpPipeliningEnabled().
(WebCore::readBooleanPreference): Removed.
(WebCore::isHTTPPipeliningEnabled): Removed.
(WebCore::shouldForceHTTPPipeliningPriorityHigh): Removed.

* platform/network/mac/ResourceRequestMac.mm:
(WebCore::ResourceRequest::doUpdateResourceRequest): Switched to
use ResourceRequest::httpPipeliningEnabled().  Removed check for
shouldForceHTTPPipeliningPriorityHigh().
(WebCore::ResourceRequest::doUpdatePlatformRequest): Ditto.

Source/WebKit/mac:

* WebView/WebView.mm:
(+[WebView(WebPrivate) _HTTPPipeliningEnabled]): Added.
(+[WebView(WebPrivate) _setHTTPPipeliningEnabled:]): Added.
* WebView/WebViewPrivate.h:
(+[WebView(WebPrivate) _HTTPPipeliningEnabled]): Added declaration.
(+[WebView(WebPrivate) _setHTTPPipeliningEnabled:]): Added declaration.

Source/WebKit2:

* UIProcess/API/C/WKContext.cpp:
(_WKContextSetHTTPPipeliningEnabled): Added.
* UIProcess/API/C/WKContextPrivate.h:
(_WKContextSetHTTPPipeliningEnabled): Added declaration.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::setHTTPPipeliningEnabled): Added.
(WebKit::WebContext::httpPipeliningEnabled): Added.
* UIProcess/WebContext.h:
(WebKit::WebContext::setHTTPPipeliningEnabled): Added declaration.
(WebKit::WebContext::httpPipeliningEnabled): Added declaration.

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

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/network/ResourceRequestBase.h
Source/WebCore/platform/network/cf/ResourceRequest.h
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
Source/WebCore/platform/network/mac/ResourceRequestMac.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/mac/WebView/WebViewPrivate.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKContext.cpp
Source/WebKit2/UIProcess/API/C/WKContextPrivate.h
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContext.h

index c9236c7..a5b52cd 100644 (file)
@@ -1,3 +1,51 @@
+2011-04-17  David Kilzer  <ddkilzer@apple.com>
+
+        <http://webkit.org/b/58463> Switch HTTP pipelining from user default to private setting
+        <rdar://problem/9268729>
+
+        Reviewed by Dan Bernstein.
+
+        This replaces support for the WebKitEnableHTTPPipelining user
+        default with methods on the WebCore::ResourceRequest class in
+        WebCore, the WebView class in WebKit1, and the WebContext class
+        in WebKit2.  It also removes support for the
+        WebKitForceHTTPPipeliningPriorityHigh user default which was not
+        needed.
+
+        Run these commands if you set the user defaults previously,
+        replacing "BUNDLE.ID" with your application's bundle ID:
+
+            defaults delete BUNDLE.ID WebKitEnableHTTPPipelining
+            defaults delete BUNDLE.ID WebKitForceHTTPPipeliningPriorityHigh
+
+        * WebCore.exp.in: Export ResourceRequest::httpPipeliningEnabled()
+        and ResourceRequest::setHTTPPipeliningEnabled().
+
+        * platform/network/ResourceRequestBase.h:
+        (WebCore::isHTTPPipeliningEnabled): Removed declaration.
+        (WebCore::shouldForceHTTPPipeliningPriorityHigh): Removed declaration.
+
+        * platform/network/cf/ResourceRequest.h:
+        (WebCore::ResourceRequest::httpPipeliningEnabled): Added declaration.
+        (WebCore::ResourceRequest::setHTTPPipeliningEnabled): Added declaration.
+        (WebCore::ResourceRequest::s_httpPipeliningEnabled): Added declaration.
+
+        * platform/network/cf/ResourceRequestCFNet.cpp:
+        (WebCore::ResourceRequest::s_httpPipeliningEnabled): Added.
+        (WebCore::ResourceRequest::httpPipeliningEnabled): Added.
+        (WebCore::ResourceRequest::setHTTPPipeliningEnabled): Added.
+        (WebCore::initializeMaximumHTTPConnectionCountPerHost): Switched
+        to use ResourceRequest::httpPipeliningEnabled().
+        (WebCore::readBooleanPreference): Removed.
+        (WebCore::isHTTPPipeliningEnabled): Removed.
+        (WebCore::shouldForceHTTPPipeliningPriorityHigh): Removed.
+
+        * platform/network/mac/ResourceRequestMac.mm:
+        (WebCore::ResourceRequest::doUpdateResourceRequest): Switched to
+        use ResourceRequest::httpPipeliningEnabled().  Removed check for
+        shouldForceHTTPPipeliningPriorityHigh().
+        (WebCore::ResourceRequest::doUpdatePlatformRequest): Ditto.
+
 2011-04-17  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Maciej Stachowiak.
index 6f35870..99d2038 100644 (file)
@@ -416,6 +416,8 @@ __ZN7WebCore15JSDOMWindowBase18commonJSGlobalDataEv
 __ZN7WebCore15PlatformCALayer18setGeometryFlippedEb
 __ZN7WebCore15ProtectionSpaceC1ERKN3WTF6StringEiNS_25ProtectionSpaceServerTypeES4_NS_35ProtectionSpaceAuthenticationSchemeE
 __ZN7WebCore15ProtectionSpaceC1Ev
+__ZN7WebCore15ResourceRequest21httpPipeliningEnabledEv
+__ZN7WebCore15ResourceRequest24setHTTPPipeliningEnabledEb
 __ZN7WebCore15ScrollAlignment17alignCenterAlwaysE
 __ZN7WebCore15ScrollAlignment19alignToEdgeIfNeededE
 __ZN7WebCore15StringTruncator13rightTruncateERKN3WTF6StringEfRKNS_4FontE
index d5c3968..53e1160 100644 (file)
@@ -241,14 +241,6 @@ namespace WebCore {
     
     unsigned initializeMaximumHTTPConnectionCountPerHost();
 
-#if USE(CF)
-    bool isHTTPPipeliningEnabled();
-    bool shouldForceHTTPPipeliningPriorityHigh();
-#else
-    inline bool isHTTPPipeliningEnabled() { return false; }
-    inline bool shouldForceHTTPPipeliningPriorityHigh() { return false; }
-#endif
-
 } // namespace WebCore
 
 #endif // ResourceRequestBase_h
index 2da5026..5a14342 100644 (file)
@@ -88,6 +88,9 @@ namespace WebCore {
         void setStorageSession(CFURLStorageSessionRef);
 #endif
 
+        static bool httpPipeliningEnabled();
+        static void setHTTPPipeliningEnabled(bool);
+
     private:
         friend class ResourceRequestBase;
 
@@ -102,6 +105,8 @@ namespace WebCore {
 #else
         RetainPtr<NSURLRequest> m_nsRequest;
 #endif
+
+        static bool s_httpPipeliningEnabled;
     };
 
     struct CrossThreadResourceRequestData : public CrossThreadResourceRequestDataBase {
index 0a0bc7c..d0ef1f9 100644 (file)
@@ -41,6 +41,8 @@
 
 namespace WebCore {
 
+bool ResourceRequest::s_httpPipeliningEnabled = false;
+
 #if USE(CFNETWORK)
 
 typedef void (*CFURLRequestSetContentDispositionEncodingFallbackArrayFunction)(CFMutableURLRequestRef, CFArrayRef);
@@ -209,6 +211,16 @@ void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
 
 #endif // USE(CFNETWORK)
 
+bool ResourceRequest::httpPipeliningEnabled()
+{
+    return s_httpPipeliningEnabled;
+}
+
+void ResourceRequest::setHTTPPipeliningEnabled(bool flag)
+{
+    s_httpPipeliningEnabled = flag;
+}
+
 unsigned initializeMaximumHTTPConnectionCountPerHost()
 {
     static const unsigned preferredConnectionCount = 6;
@@ -218,7 +230,7 @@ unsigned initializeMaximumHTTPConnectionCountPerHost()
     unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);
 
 #if PLATFORM(MAC)
-    if (isHTTPPipeliningEnabled()) {
+    if (ResourceRequest::httpPipeliningEnabled()) {
         wkSetHTTPPipeliningMaximumPriority(ResourceLoadPriorityHighest);
         wkSetHTTPPipeliningMinimumFastLanePriority(ResourceLoadPriorityMedium);
         // When pipelining do not rate-limit requests sent from WebCore since CFNetwork handles that.
@@ -229,23 +241,4 @@ unsigned initializeMaximumHTTPConnectionCountPerHost()
     return maximumHTTPConnectionCountPerHost;
 }
 
-static inline bool readBooleanPreference(CFStringRef key)
-{
-    Boolean keyExistsAndHasValidFormat;
-    Boolean result = CFPreferencesGetAppBooleanValue(key, kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat);
-    return keyExistsAndHasValidFormat ? result : false;
-}
-
-bool isHTTPPipeliningEnabled()
-{
-    static bool isEnabled = readBooleanPreference(CFSTR("WebKitEnableHTTPPipelining"));
-    return isEnabled;
-}
-
-bool shouldForceHTTPPipeliningPriorityHigh()
-{
-    static bool shouldForcePriorityHigh = readBooleanPreference(CFSTR("WebKitForceHTTPPipeliningPriorityHigh"));
-    return shouldForcePriorityHigh;
-}
-
 } // namespace WebCore
index 33ff490..d99e1b7 100644 (file)
@@ -70,7 +70,7 @@ void ResourceRequest::doUpdateResourceRequest()
     m_allowCookies = [m_nsRequest.get() HTTPShouldHandleCookies];
 
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    if (isHTTPPipeliningEnabled() && !shouldForceHTTPPipeliningPriorityHigh())
+    if (ResourceRequest::httpPipeliningEnabled())
         m_priority = toResourceLoadPriority(wkGetHTTPPipeliningPriority(m_nsRequest.get()));
 #endif
 
@@ -120,10 +120,8 @@ void ResourceRequest::doUpdatePlatformRequest()
 #endif
 
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    if (isHTTPPipeliningEnabled()) {
-        int priority = toHTTPPipeliningPriority(shouldForceHTTPPipeliningPriorityHigh() ? ResourceLoadPriorityHigh : m_priority);
-        wkSetHTTPPipeliningPriority(nsRequest, priority);
-    }
+    if (ResourceRequest::httpPipeliningEnabled())
+        wkSetHTTPPipeliningPriority(nsRequest, toHTTPPipeliningPriority(m_priority));
 #endif
 
     [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()];
index 032f85f..1bea093 100644 (file)
@@ -1,3 +1,24 @@
+2011-04-17  David Kilzer  <ddkilzer@apple.com>
+
+        <http://webkit.org/b/58463> Switch HTTP pipelining from user default to private setting
+        <rdar://problem/9268729>
+
+        Reviewed by Dan Bernstein.
+
+        This replaces support for the WebKitEnableHTTPPipelining user
+        default with methods on the WebCore::ResourceRequest class in
+        WebCore, the WebView class in WebKit1, and the WebContext class
+        in WebKit2.  It also removes support for the
+        WebKitForceHTTPPipeliningPriorityHigh user default which was not
+        needed.
+
+        * WebView/WebView.mm:
+        (+[WebView(WebPrivate) _HTTPPipeliningEnabled]): Added.
+        (+[WebView(WebPrivate) _setHTTPPipeliningEnabled:]): Added.
+        * WebView/WebViewPrivate.h:
+        (+[WebView(WebPrivate) _HTTPPipeliningEnabled]): Added declaration.
+        (+[WebView(WebPrivate) _setHTTPPipeliningEnabled:]): Added declaration.
+
 2011-04-17  Joseph Pecoraro  <joepeck@webkit.org>
 
         Reviewed by Dan Bernstein.
index d7fd5af..ca1911c 100644 (file)
 #import <WebCore/RenderWidget.h>
 #import <WebCore/ResourceHandle.h>
 #import <WebCore/ResourceLoadScheduler.h>
+#import <WebCore/ResourceRequest.h>
 #import <WebCore/RuntimeApplicationChecks.h>
 #import <WebCore/SchemeRegistry.h>
 #import <WebCore/ScriptController.h>
@@ -2827,6 +2828,16 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
         _private->page->settings()->setMinDOMTimerInterval(intervalInSeconds);
 }
 
++ (BOOL)_HTTPPipeliningEnabled
+{
+    return ResourceRequest::httpPipeliningEnabled();
+}
+
++ (void)_setHTTPPipeliningEnabled:(BOOL)enabled
+{
+    ResourceRequest::setHTTPPipeliningEnabled(enabled);
+}
+
 @end
 
 @implementation _WebSafeForwarder
index 7d7537e..fa4844f 100644 (file)
@@ -594,6 +594,22 @@ Could be worth adding to the API.
 */
 - (void)_setMinimumTimerInterval:(double)intervalInSeconds;
 
+/*!
+    @method _HTTPPipeliningEnabled
+    @abstract Checks the HTTP pipelining status.
+    @discussion Defaults to NO.
+    @result YES if HTTP pipelining is enabled, NO if not enabled.
+ */
++ (BOOL)_HTTPPipeliningEnabled;
+
+/*!
+    @method _setHTTPPipeliningEnabled:
+    @abstract Set the HTTP pipelining status.
+    @discussion Defaults to NO.
+    @param enabled The new HTTP pipelining status.
+ */
++ (void)_setHTTPPipeliningEnabled:(BOOL)enabled;
+
 @end
 
 @interface WebView (WebViewPrintingPrivate)
index 4acc183..37ca1a4 100644 (file)
@@ -1,3 +1,28 @@
+2011-04-17  David Kilzer  <ddkilzer@apple.com>
+
+        <http://webkit.org/b/58463> Switch HTTP pipelining from user default to private setting
+        <rdar://problem/9268729>
+
+        Reviewed by Dan Bernstein.
+
+        This replaces support for the WebKitEnableHTTPPipelining user
+        default with methods on the WebCore::ResourceRequest class in
+        WebCore, the WebView class in WebKit1, and the WebContext class
+        in WebKit2.  It also removes support for the
+        WebKitForceHTTPPipeliningPriorityHigh user default which was not
+        needed.
+
+        * UIProcess/API/C/WKContext.cpp:
+        (_WKContextSetHTTPPipeliningEnabled): Added.
+        * UIProcess/API/C/WKContextPrivate.h:
+        (_WKContextSetHTTPPipeliningEnabled): Added declaration.
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::setHTTPPipeliningEnabled): Added.
+        (WebKit::WebContext::httpPipeliningEnabled): Added.
+        * UIProcess/WebContext.h:
+        (WebKit::WebContext::setHTTPPipeliningEnabled): Added declaration.
+        (WebKit::WebContext::httpPipeliningEnabled): Added declaration.
+
 2011-04-17  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Geoffrey Garen.
index db138f3..4f25895 100644 (file)
@@ -227,3 +227,8 @@ void WKContextEnableProcessTermination(WKContextRef contextRef)
 {
     toImpl(contextRef)->enableProcessTermination();
 }
+
+void _WKContextSetHTTPPipeliningEnabled(WKContextRef contextRef, bool enabled)
+{
+    toImpl(contextRef)->setHTTPPipeliningEnabled(enabled);
+}
index dc91a0f..153ef3e 100644 (file)
@@ -66,6 +66,8 @@ WK_EXPORT void WKContextSetLocalStorageDirectory(WKContextRef context, WKStringR
 WK_EXPORT void WKContextDisableProcessTermination(WKContextRef context);
 WK_EXPORT void WKContextEnableProcessTermination(WKContextRef context);
 
+WK_EXPORT void _WKContextSetHTTPPipeliningEnabled(WKContextRef context, bool enabled);
+
 #ifdef __cplusplus
 }
 #endif
index eecc240..1f1c47b 100644 (file)
@@ -54,6 +54,7 @@
 #include <WebCore/Language.h>
 #include <WebCore/LinkHash.h>
 #include <WebCore/Logging.h>
+#include <WebCore/ResourceRequest.h>
 #include <wtf/CurrentTime.h>
 
 #ifndef NDEBUG
@@ -748,4 +749,20 @@ String WebContext::localStorageDirectory() const
     return platformDefaultLocalStorageDirectory();
 }
 
+void WebContext::setHTTPPipeliningEnabled(bool enabled)
+{
+#if PLATFORM(MAC)
+    ResourceRequest::setHTTPPipeliningEnabled(enabled);
+#endif
+}
+
+bool WebContext::httpPipeliningEnabled()
+{
+#if PLATFORM(MAC)
+    return ResourceRequest::httpPipeliningEnabled();
+#else
+    return false;
+#endif
+}
+
 } // namespace WebKit
index 303e97d..56e1719 100644 (file)
@@ -171,6 +171,10 @@ public:
     void disableProcessTermination() { m_processTerminationEnabled = false; }
     void enableProcessTermination();
 
+    // Defaults to false.
+    void setHTTPPipeliningEnabled(bool);
+    bool httpPipeliningEnabled();
+
 private:
     WebContext(ProcessModel, const String& injectedBundlePath);