Changeset 76756 in webkit
- Timestamp:
- Jan 26, 2011 8:57:01 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76754 r76756 1 2011-01-26 David Kilzer <ddkilzer@apple.com> 2 3 <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork 4 <rdar://problem/8821760> 5 6 Reviewed by Antti Koivisto. 7 8 This adds support for HTTP pipelining in CFNetwork, but does not 9 enable it. To enable it post-SnowLeopard, use this command: 10 11 defaults write BUNDLE.ID WebKitEnableHTTPPipelining -bool YES 12 13 Once enabled, it is possible to force the same load priority 14 (high) to be sent to CFNetwork to allow WebCore to handle the 15 scheduling: 16 17 defaults write BUNDLE.ID WebKitForceHTTPPipeliningPriorityHigh -bool YES 18 19 * WebCore.exp.in: Export _wkGetHTTPPipeliningPriority and 20 _wkSetHTTPPipeliningPriority. 21 22 * loader/DocumentThreadableLoader.cpp: 23 (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight): 24 Copy the priority to preflightRequest. 25 26 * loader/ResourceLoadScheduler.cpp: 27 (WebCore::ResourceLoadScheduler::scheduleLoad): Refactored code 28 at the end of the method to use an early return. 29 30 * loader/cache/CachedResourceRequest.cpp: 31 (WebCore::CachedResourceRequest::load): Set the priority on the 32 ResourceRequest object based on the priority of the 33 CachedResourceRequest before calling 34 ResourceLoadScheduler::scheduleSubresourceLoad(). 35 36 * loader/icon/IconLoader.cpp: 37 (WebCore::IconLoader::startLoading): Create a ResourceRequest 38 object and set its priority to ResourceLoadPriorityLow before 39 passing it to ResourceLoadScheduler::scheduleSubresourceLoad(). 40 41 * platform/mac/WebCoreSystemInterface.h: 42 (wkGetHTTPPipeliningPriority): Added. 43 (wkSetHTTPPipeliningPriority): Added. 44 * platform/mac/WebCoreSystemInterface.mm: 45 (wkGetHTTPPipeliningPriority): Added. 46 (wkSetHTTPPipeliningPriority): Added. 47 48 * platform/network/ResourceRequestBase.cpp: 49 (WebCore::ResourceRequestBase::adopt): Set m_priority when 50 adopting a CrossThreadResourceRequestData. 51 (WebCore::ResourceRequestBase::copyData): Set m_priority when 52 creating a CrossThreadResourceRequestData. 53 (WebCore::ResourceRequestBase::priority): Added. 54 (WebCore::ResourceRequestBase::setPriority): Added. 55 (WebCore::equalIgnoringHeaderFields): Priorities must match when 56 comparing two ResourceRequest objects. 57 58 * platform/network/ResourceRequestBase.h: 59 (WebCore::ResourceRequestBase::ResourceRequestBase): Set default 60 priority of new objects to ResourceLoadPriorityLow. 61 (WebCore::ResourceRequestBase::priority): Added declaration. 62 (WebCore::ResourceRequestBase::setPriority): Added declaration. 63 (WebCore::isHTTPPipeliningEnabled): Added. 64 (WebCore::shouldUseHTTPPipeliningPriority): Added. 65 66 * platform/network/cf/ResourceRequestCFNet.cpp: Updated so that 67 Mac OS X and Windows share code. 68 (WebCore::initializeMaximumHTTPConnectionCountPerHost): Always 69 set the HTTP connection count per host, but return an 70 'unlimited' value when using HTTP pipelining. This method used 71 to be defined in ResourceRequestMac.mm for Mac OS X. 72 (WebCore::readBooleanPreference): Added. Helper method for 73 reading boolean user defaults. 74 (WebCore::isHTTPPipeliningEnabled): Returns value of user 75 default key WebKitEnableHTTPPipelining, or false if not set. 76 (WebCore::shouldUseHTTPPipeliningPriority): Returns value of 77 user default key WebKitForceHTTPPipeliningPriorityHigh, or false 78 if not set. 79 * platform/network/cf/ResourceRequestCFNet.h: Updated so that 80 Mac OS X and Windows share code. Fixed indentation. 81 (WebCore::mapHTTPPipeliningPriorityToResourceLoadPriority): Added. 82 (WebCore::mapResourceLoadPriorityToHTTPPipeliningPriority): Added. 83 84 * platform/network/mac/ResourceRequestMac.mm: 85 (WebCore::ResourceRequest::doUpdatePlatformRequest): Update 86 HTTP pipelining priority on NSMutableFURLRequest object. 87 (WebCore::ResourceRequest::doUpdateResourceRequest): Update 88 m_priority from the NSURLRequest object. 89 (WebCore::initializeMaximumHTTPConnectionCountPerHost): Removed. 90 Code is now shared with Windows in ResourceRequestCFNet.cpp. 91 1 92 2011-01-26 Beth Dakin <bdakin@apple.com> 2 93 -
trunk/Source/WebCore/WebCore.exp.in
r76754 r76756 1249 1249 _wkGetGlyphTransformedAdvances 1250 1250 _wkGetGlyphsForCharacters 1251 _wkGetHTTPPipeliningPriority 1251 1252 _wkGetHyphenationLocationBeforeIndex 1252 1253 _wkGetMIMETypeForExtension … … 1279 1280 _wkSetCookieStoragePrivateBrowsingEnabled 1280 1281 _wkSetDragImage 1282 _wkSetHTTPPipeliningPriority 1281 1283 _wkSetNSURLConnectionDefersCallbacks 1282 1284 _wkSetNSURLRequestShouldContentSniff -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r73938 r76756 145 145 } 146 146 147 preflightRequest.setPriority(request.priority()); 148 147 149 loadRequest(preflightRequest, DoSecurityCheck); 148 150 } -
trunk/Source/WebCore/loader/ResourceLoadScheduler.cpp
r73938 r76756 91 91 return loader; 92 92 } 93 93 94 94 PassRefPtr<NetscapePlugInStreamLoader> ResourceLoadScheduler::schedulePluginStreamLoad(Frame* frame, NetscapePlugInStreamLoaderClient* client, const ResourceRequest& request) 95 95 { … … 121 121 // Try to request important resources immediately. 122 122 servePendingRequests(host, priority); 123 } else { 124 // Handle asynchronously so early low priority requests don't get scheduled before later high priority ones. 125 InspectorInstrumentation::didScheduleResourceRequest(resourceLoader->frameLoader() ? resourceLoader->frameLoader()->frame()->document() : 0, resourceLoader->url()); 126 scheduleServePendingRequests(); 127 } 123 return; 124 } 125 126 // Handle asynchronously so early low priority requests don't get scheduled before later high priority ones. 127 InspectorInstrumentation::didScheduleResourceRequest(resourceLoader->frameLoader() ? resourceLoader->frameLoader()->frame()->document() : 0, resourceLoader->url()); 128 scheduleServePendingRequests(); 128 129 } 129 130 -
trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp
r75857 r76756 114 114 115 115 ResourceLoadPriority priority = resource->loadPriority(); 116 resourceRequest.setPriority(priority); 116 117 117 118 RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(cachedResourceLoader->document()->frame(), -
trunk/Source/WebCore/loader/icon/IconLoader.cpp
r71562 r76756 70 70 m_loadIsInProgress = true; 71 71 72 RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_frame, this, m_frame->loader()->iconURL()); 72 ResourceRequest resourceRequest(m_frame->loader()->iconURL()); 73 resourceRequest.setPriority(ResourceLoadPriorityLow); 74 75 RefPtr<SubresourceLoader> loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_frame, this, resourceRequest); 73 76 if (!loader) 74 77 LOG_ERROR("Failed to start load for icon at url %s", m_frame->loader()->iconURL().string().ascii().data()); -
trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h
r76754 r76756 148 148 extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream); 149 149 extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount); 150 extern int (*wkGetHTTPPipeliningPriority)(NSURLRequest *); 151 extern void (*wkSetHTTPPipeliningPriority)(NSMutableURLRequest *, int priority); 150 152 extern void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort); 151 153 extern void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString); -
trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
r76754 r76756 90 90 id (*wkCreateNSURLConnectionDelegateProxy)(void); 91 91 unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount); 92 int (*wkGetHTTPPipeliningPriority)(NSURLRequest *); 93 void (*wkSetHTTPPipeliningPriority)(NSMutableURLRequest *, int priority); 92 94 void (*wkSetCONNECTProxyForStream)(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort); 93 95 void (*wkSetCONNECTProxyAuthorizationForStream)(CFReadStreamRef, CFStringRef proxyAuthorizationString); -
trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp
r74084 r76756 46 46 request->setFirstPartyForCookies(data->m_firstPartyForCookies); 47 47 request->setHTTPMethod(data->m_httpMethod); 48 request->setPriority(data->m_priority); 48 49 request->setTargetType(data->m_targetType); 49 50 … … 79 80 data->m_httpMethod = httpMethod().crossThreadString(); 80 81 data->m_httpHeaders = httpHeaderFields().copyData(); 82 data->m_priority = priority(); 81 83 data->m_targetType = m_targetType; 82 84 … … 315 317 } 316 318 319 ResourceLoadPriority ResourceRequestBase::priority() const 320 { 321 updateResourceRequest(); 322 323 return m_priority; 324 } 325 326 void ResourceRequestBase::setPriority(ResourceLoadPriority priority) 327 { 328 updateResourceRequest(); 329 330 m_priority = priority; 331 332 if (url().protocolInHTTPFamily()) 333 m_platformRequestUpdated = false; 334 } 335 317 336 void ResourceRequestBase::addHTTPHeaderField(const AtomicString& name, const String& value) 318 337 { … … 353 372 return false; 354 373 374 if (a.priority() != b.priority()) 375 return false; 376 355 377 FormData* formDataA = a.httpBody(); 356 378 FormData* formDataB = b.httpBody(); -
trunk/Source/WebCore/platform/network/ResourceRequestBase.h
r76248 r76756 30 30 31 31 #include "FormData.h" 32 #include "HTTPHeaderMap.h" 32 33 #include "KURL.h" 33 #include " HTTPHeaderMap.h"34 #include "ResourceLoadPriority.h" 34 35 35 36 #include <wtf/OwnPtr.h> … … 129 130 void setAllowCookies(bool allowCookies); 130 131 132 ResourceLoadPriority priority() const; 133 void setPriority(ResourceLoadPriority); 134 131 135 bool isConditional() const; 132 136 … … 158 162 , m_reportLoadTiming(false) 159 163 , m_reportRawHeaders(false) 164 , m_priority(ResourceLoadPriorityLow) 160 165 , m_targetType(TargetIsSubresource) 161 166 { … … 173 178 , m_reportLoadTiming(false) 174 179 , m_reportRawHeaders(false) 180 , m_priority(ResourceLoadPriorityLow) 175 181 , m_targetType(TargetIsSubresource) 176 182 { … … 198 204 bool m_reportLoadTiming; 199 205 bool m_reportRawHeaders; 206 ResourceLoadPriority m_priority; 200 207 TargetType m_targetType; 201 208 … … 224 231 RefPtr<FormData> m_httpBody; 225 232 bool m_allowCookies; 233 ResourceLoadPriority m_priority; 226 234 ResourceRequestBase::TargetType m_targetType; 227 235 }; … … 229 237 unsigned initializeMaximumHTTPConnectionCountPerHost(); 230 238 239 #if PLATFORM(CF) 240 bool isHTTPPipeliningEnabled(); 241 bool shouldForceHTTPPipeliningPriorityHigh(); 242 #else 243 inline bool isHTTPPipeliningEnabled() { return false; } 244 inline bool shouldForceHTTPPipeliningPriorityHigh() { return false; } 245 #endif 246 231 247 } // namespace WebCore 232 248 -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
r74943 r76756 27 27 #include "ResourceRequestCFNet.h" 28 28 29 #include "ResourceRequest.h" 30 31 #if PLATFORM(MAC) 32 #include "WebCoreSystemInterface.h" 33 #endif 34 29 35 #if USE(CFNETWORK) 30 31 36 #include "FormDataStreamCFNet.h" 32 #include "ResourceRequest.h"33 34 37 #include <CFNetwork/CFURLRequestPriv.h> 35 38 #include <WebKitSystemInterface/WebKitSystemInterface.h> 39 #endif 36 40 37 41 namespace WebCore { 42 43 #if USE(CFNETWORK) 38 44 39 45 typedef void (*CFURLRequestSetContentDispositionEncodingFallbackArrayFunction)(CFMutableURLRequestRef, CFArrayRef); … … 190 196 } 191 197 198 #endif // USE(CFNETWORK) 199 192 200 unsigned initializeMaximumHTTPConnectionCountPerHost() 193 201 { 194 202 static const unsigned preferredConnectionCount = 6; 195 return wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount); 203 static const unsigned unlimitedConnectionCount = 10000; 204 205 // Always set the connection count per host, even when pipelining. 206 unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount); 207 208 #if PLATFORM(MAC) 209 if (isHTTPPipeliningEnabled()) { 210 // When pipelining do not rate-limit requests sent from WebCore since CFNetwork handles that. 211 return unlimitedConnectionCount; 212 } 213 #endif 214 215 return maximumHTTPConnectionCountPerHost; 216 } 217 218 static inline bool readBooleanPreference(CFStringRef key) 219 { 220 Boolean keyExistsAndHasValidFormat; 221 Boolean result = CFPreferencesGetAppBooleanValue(key, kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat); 222 return keyExistsAndHasValidFormat ? result : false; 223 } 224 225 bool isHTTPPipeliningEnabled() 226 { 227 static bool isEnabled = readBooleanPreference(CFSTR("WebKitEnableHTTPPipelining")); 228 return isEnabled; 229 } 230 231 bool shouldForceHTTPPipeliningPriorityHigh() 232 { 233 static bool shouldForcePriorityHigh = readBooleanPreference(CFSTR("WebKitForceHTTPPipeliningPriorityHigh")); 234 return shouldForcePriorityHigh; 196 235 } 197 236 198 237 } // namespace WebCore 199 200 #endif // USE(CFNETWORK) -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h
r74943 r76756 27 27 #define ResourceRequestCFNet_h 28 28 29 #include "ResourceLoadPriority.h" 30 29 31 #if USE(CFNETWORK) 30 31 32 typedef const struct _CFURLRequest* CFURLRequestRef; 33 #endif 32 34 33 35 namespace WebCore { 34 36 35 37 class ResourceRequest; 36 38 37 void getResourceRequest(ResourceRequest&, CFURLRequestRef); 38 CFURLRequestRef cfURLRequest(const ResourceRequest&); 39 #if USE(CFNETWORK) 40 void getResourceRequest(ResourceRequest&, CFURLRequestRef); 41 CFURLRequestRef cfURLRequest(const ResourceRequest&); 42 #endif 43 44 inline ResourceLoadPriority mapHTTPPipeliningPriorityToResourceLoadPriority(int priority) 45 { 46 switch (priority) { 47 case 0: 48 return ResourceLoadPriorityLow; 49 case 1: 50 return ResourceLoadPriorityMedium; 51 case 2: 52 return ResourceLoadPriorityHigh; 53 default: 54 ASSERT_NOT_REACHED(); 55 return ResourceLoadPriorityLowest; 56 } 39 57 } 40 58 41 #endif // USE(CFNETWORK) 59 inline int mapResourceLoadPriorityToHTTPPipeliningPriority(ResourceLoadPriority priority) 60 { 61 switch (priority) { 62 case ResourceLoadPriorityVeryLow: 63 case ResourceLoadPriorityLow: 64 return 0; 65 case ResourceLoadPriorityMedium: 66 return 1; 67 case ResourceLoadPriorityHigh: 68 return 2; 69 case ResourceLoadPriorityUnresolved: 70 ASSERT_NOT_REACHED(); 71 return 0; 72 } 73 74 ASSERT_NOT_REACHED(); 75 return 0; 76 } 77 78 } // namespace WebCore 42 79 43 80 #endif // ResourceRequestCFNet_h -
trunk/Source/WebCore/platform/network/mac/ResourceRequestMac.mm
r74943 r76756 32 32 33 33 #import "FormDataStreamMac.h" 34 #import "ResourceRequestCFNet.h" 35 #import "WebCoreSystemInterface.h" 34 36 35 37 #import <Foundation/Foundation.h> … … 66 68 m_httpMethod = method; 67 69 m_allowCookies = [m_nsRequest.get() HTTPShouldHandleCookies]; 68 70 71 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 72 if (isHTTPPipeliningEnabled() && !shouldForceHTTPPipeliningPriorityHigh()) 73 m_priority = mapHTTPPipeliningPriorityToResourceLoadPriority(wkGetHTTPPipeliningPriority(m_nsRequest.get())); 74 #endif 75 69 76 NSDictionary *headers = [m_nsRequest.get() allHTTPHeaderFields]; 70 77 NSEnumerator *e = [headers keyEnumerator]; … … 112 119 #endif 113 120 121 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 122 if (isHTTPPipeliningEnabled()) { 123 int priority = mapResourceLoadPriorityToHTTPPipeliningPriority(m_priority); 124 wkSetHTTPPipeliningPriority(nsRequest, shouldForceHTTPPipeliningPriorityHigh() ? 2 : priority); 125 } 126 #endif 127 114 128 [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()]; 115 129 if (timeoutInterval() != unspecifiedTimeoutInterval) … … 155 169 [NSURLProtocol setProperty:@"" forKey:@"WebDataRequest" inRequest:(NSMutableURLRequest *)nsURLRequest()]; 156 170 } 157 158 unsigned initializeMaximumHTTPConnectionCountPerHost()159 {160 static const unsigned preferredConnectionCount = 6;161 return wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount);162 }163 171 164 172 } // namespace WebCore -
trunk/Source/WebKit/mac/ChangeLog
r76754 r76756 1 2011-01-26 David Kilzer <ddkilzer@apple.com> 2 3 <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork 4 <rdar://problem/8821760> 5 6 Reviewed by Antti Koivisto. 7 8 * WebCoreSupport/WebSystemInterface.mm: 9 (InitWebCoreSystemInterface): Added initialization for 10 GetHTTPPipeliningPriority and SetHTTPPipeliningPriority. 11 1 12 2011-01-26 Beth Dakin <bdakin@apple.com> 2 13 -
trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
r76754 r76756 61 61 INIT(GetFontInLanguageForRange); 62 62 INIT(GetGlyphTransformedAdvances); 63 INIT(GetHTTPPipeliningPriority); 63 64 INIT(GetMIMETypeForExtension); 64 65 INIT(GetNSURLResponseLastModifiedDate); … … 76 77 INIT(SetCookieStoragePrivateBrowsingEnabled); 77 78 INIT(SetDragImage); 79 INIT(SetHTTPPipeliningPriority); 78 80 INIT(SetNSURLConnectionDefersCallbacks); 79 81 INIT(SetNSURLRequestShouldContentSniff); -
trunk/Source/WebKit2/ChangeLog
r76754 r76756 1 2011-01-26 David Kilzer <ddkilzer@apple.com> 2 3 <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork 4 <rdar://problem/8821760> 5 6 Reviewed by Antti Koivisto. 7 8 * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: 9 (InitWebCoreSystemInterface): Added initialization for 10 GetHTTPPipeliningPriority and SetHTTPPipeliningPriority. 11 1 12 2011-01-26 Beth Dakin <bdakin@apple.com> 2 13 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
r76754 r76756 56 56 INIT(GetGlyphTransformedAdvances); 57 57 INIT(GetGlyphsForCharacters); 58 INIT(GetHTTPPipeliningPriority); 58 59 INIT(GetMIMETypeForExtension); 59 60 INIT(GetNSURLResponseLastModifiedDate); … … 83 84 INIT(SetCookieStoragePrivateBrowsingEnabled); 84 85 INIT(SetDragImage); 86 INIT(SetHTTPPipeliningPriority); 85 87 INIT(SetNSURLConnectionDefersCallbacks); 86 88 INIT(SetNSURLRequestShouldContentSniff); -
trunk/WebKitLibraries/ChangeLog
r76621 r76756 1 2011-01-26 David Kilzer <ddkilzer@apple.com> 2 3 <http://webkit.org/b/53192> Add experimental support for HTTP pipelining in CFNetwork 4 <rdar://problem/8821760> 5 6 Reviewed by Antti Koivisto. 7 8 * WebKitSystemInterface.h: 9 New methods added for HTTP pipelining support. 10 (WKGetHTTPPipeliningPriority): Added. 11 (WKSetHTTPPipeliningPriority): Added. 12 Unrelated methods added after updating the header. 13 (WKMakeScrollbarPainter): Added. 14 (WKScrollbarPainterPaint): Added. 15 * libWebKitSystemInterfaceLeopard.a: Updated. 16 * libWebKitSystemInterfaceSnowLeopard.a: Updated. 17 1 18 2011-01-24 Jer Noble <jer.noble@apple.com> 2 19 -
trunk/WebKitLibraries/WebKitSystemInterface.h
r76042 r76756 328 328 329 329 unsigned WKInitializeMaximumHTTPConnectionCountPerHost(unsigned preferredConnectionCount); 330 int WKGetHTTPPipeliningPriority(NSURLRequest *); 331 void WKSetHTTPPipeliningPriority(NSMutableURLRequest *, int priority); 330 332 331 333 void WKSetCONNECTProxyForStream(CFReadStreamRef, CFStringRef proxyHost, CFNumberRef proxyPort); … … 378 380 WKSandboxExtensionRef WKSandboxExtensionCreateFromSerializedFormat(const char* serializationFormat, size_t length); 379 381 382 typedef struct __WKScrollbarPainter *WKScrollbarPainterRef; 383 WKScrollbarPainterRef WKMakeScrollbarPainter(int controlSize, bool isHorizontal); 384 void WKScrollbarPainterPaint(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect); 385 380 386 #endif 381 387
Note: See TracChangeset
for help on using the changeset viewer.