Changeset 252431 in webkit


Ignore:
Timestamp:
Nov 13, 2019 2:41:08 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

VeryHigh priority loads are actually loading at VeryLow priority
https://bugs.webkit.org/show_bug.cgi?id=203423
<rdar://problem/56621789>

Patch by Benjamin Nham <Ben Nham> on 2019-11-13
Reviewed by Antti Koivisto.

There are two issues with the way we translate ResourceLoadPriority to
CFURLRequestPriority:

  1. We call _CFNetworkHTTPConnectionCacheSetLimit and set 1 too few

priority levels. This means VeryHigh priority loads are actually out
of bounds, which causes CFNetwork to set the priority level back to 0
in HTTPConnectionCacheEntry::_prepareNewRequest. After this patch we'll
call _CFNetworkHTTPConnectionCacheSetLimit with the correct number of
levels.

  1. _CFNetworkHTTPConnectionCacheSetLimit doesn't work for NSURLSession

right now (<rdar://problem/56621205>), so we have to map to the default
number of CFURLRequestPriority levels, which is 4. Right now we have 5
ResourceLoadPriority levels, so there will be some aliasing involved.
After this patch VeryLow gets a priority of -1 and Low gets a priority
of 0, but due to the aforementioned clamping behavior both VeryLow and
Low will effectively both have a CFURLRequestPriority of 0.

Source/WebCore:

  • platform/network/cf/ResourceRequestCFNet.cpp:

(WebCore::initializeMaximumHTTPConnectionCountPerHost):
(WebCore::initializeHTTPConnectionSettingsOnStartup):

  • platform/network/cf/ResourceRequestCFNet.h:

(WebCore::toResourceLoadPriority):
(WebCore::toPlatformRequestPriority):

Source/WebKit:

  • NetworkProcess/cocoa/NetworkProcessCocoa.mm:

(WebKit::initializeNetworkSettings):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252423 r252431  
     12019-11-13  Benjamin Nham  <nham@apple.com>
     2
     3        VeryHigh priority loads are actually loading at VeryLow priority
     4        https://bugs.webkit.org/show_bug.cgi?id=203423
     5        <rdar://problem/56621789>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        There are two issues with the way we translate ResourceLoadPriority to
     10        CFURLRequestPriority:
     11
     12        1. We call _CFNetworkHTTPConnectionCacheSetLimit and set 1 too few
     13        priority levels. This means VeryHigh priority loads are actually out
     14        of bounds, which causes CFNetwork to set the priority level back to 0
     15        in HTTPConnectionCacheEntry::_prepareNewRequest. After this patch we'll
     16        call _CFNetworkHTTPConnectionCacheSetLimit with the correct number of
     17        levels.
     18
     19        2. _CFNetworkHTTPConnectionCacheSetLimit doesn't work for NSURLSession
     20        right now (<rdar://problem/56621205>), so we have to map to the default
     21        number of CFURLRequestPriority levels, which is 4. Right now we have 5
     22        ResourceLoadPriority levels, so there will be some aliasing involved.
     23        After this patch VeryLow gets a priority of -1 and Low gets a priority
     24        of 0, but due to the aforementioned clamping behavior both VeryLow and
     25        Low will effectively both have a CFURLRequestPriority of 0.
     26
     27        * platform/network/cf/ResourceRequestCFNet.cpp:
     28        (WebCore::initializeMaximumHTTPConnectionCountPerHost):
     29        (WebCore::initializeHTTPConnectionSettingsOnStartup):
     30        * platform/network/cf/ResourceRequestCFNet.h:
     31        (WebCore::toResourceLoadPriority):
     32        (WebCore::toPlatformRequestPriority):
     33
    1342019-11-13  Dean Jackson  <dino@apple.com>
    235
  • trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp

    r251954 r252431  
    415415        return maximumHTTPConnectionCountPerHost;
    416416
    417     _CFNetworkHTTPConnectionCacheSetLimit(kHTTPPriorityNumLevels, toPlatformRequestPriority(ResourceLoadPriority::Highest));
     417    _CFNetworkHTTPConnectionCacheSetLimit(kHTTPPriorityNumLevels, resourceLoadPriorityCount);
    418418#if !PLATFORM(WIN)
    419419    // FIXME: <rdar://problem/9375609> Implement minimum fast lane priority setting on Windows
     
    434434    static const unsigned fastLaneConnectionCount = 1;
    435435    _CFNetworkHTTPConnectionCacheSetLimit(kHTTPLoadWidth, preferredConnectionCount);
    436     _CFNetworkHTTPConnectionCacheSetLimit(kHTTPPriorityNumLevels, toPlatformRequestPriority(ResourceLoadPriority::Highest));
     436    _CFNetworkHTTPConnectionCacheSetLimit(kHTTPPriorityNumLevels, resourceLoadPriorityCount);
    437437    _CFNetworkHTTPConnectionCacheSetLimit(kHTTPMinimumFastLanePriority, toPlatformRequestPriority(ResourceLoadPriority::Medium));
    438438    _CFNetworkHTTPConnectionCacheSetLimit(kHTTPNumFastLanes, fastLaneConnectionCount);
  • trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.h

    r220243 r252431  
    4141inline ResourceLoadPriority toResourceLoadPriority(CFURLRequestPriority priority)
    4242{
     43    // FIXME: switch VeryLow back to 0 priority when CFNetwork fixes <rdar://problem/56621205>
    4344    switch (priority) {
    4445    case -1:
     46        return ResourceLoadPriority::VeryLow;
    4547    case 0:
    46         return ResourceLoadPriority::VeryLow;
     48        return ResourceLoadPriority::Low;
    4749    case 1:
    48         return ResourceLoadPriority::Low;
     50        return ResourceLoadPriority::Medium;
    4951    case 2:
    50         return ResourceLoadPriority::Medium;
     52        return ResourceLoadPriority::High;
    5153    case 3:
    52         return ResourceLoadPriority::High;
    53     case 4:
    5454        return ResourceLoadPriority::VeryHigh;
    5555    default:
     
    6161inline CFURLRequestPriority toPlatformRequestPriority(ResourceLoadPriority priority)
    6262{
     63    // FIXME: switch VeryLow back to 0 priority when CFNetwork fixes <rdar://problem/56621205>
    6364    switch (priority) {
    6465    case ResourceLoadPriority::VeryLow:
     66        return -1;
     67    case ResourceLoadPriority::Low:
    6568        return 0;
    66     case ResourceLoadPriority::Low:
     69    case ResourceLoadPriority::Medium:
    6770        return 1;
    68     case ResourceLoadPriority::Medium:
     71    case ResourceLoadPriority::High:
    6972        return 2;
    70     case ResourceLoadPriority::High:
     73    case ResourceLoadPriority::VeryHigh:
    7174        return 3;
    72     case ResourceLoadPriority::VeryHigh:
    73         return 4;
    7475    }
    7576
  • trunk/Source/WebKit/ChangeLog

    r252428 r252431  
     12019-11-13  Benjamin Nham  <nham@apple.com>
     2
     3        VeryHigh priority loads are actually loading at VeryLow priority
     4        https://bugs.webkit.org/show_bug.cgi?id=203423
     5        <rdar://problem/56621789>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        There are two issues with the way we translate ResourceLoadPriority to
     10        CFURLRequestPriority:
     11
     12        1. We call _CFNetworkHTTPConnectionCacheSetLimit and set 1 too few
     13        priority levels. This means VeryHigh priority loads are actually out
     14        of bounds, which causes CFNetwork to set the priority level back to 0
     15        in HTTPConnectionCacheEntry::_prepareNewRequest. After this patch we'll
     16        call _CFNetworkHTTPConnectionCacheSetLimit with the correct number of
     17        levels.
     18
     19        2. _CFNetworkHTTPConnectionCacheSetLimit doesn't work for NSURLSession
     20        right now (<rdar://problem/56621205>), so we have to map to the default
     21        number of CFURLRequestPriority levels, which is 4. Right now we have 5
     22        ResourceLoadPriority levels, so there will be some aliasing involved.
     23        After this patch VeryLow gets a priority of -1 and Low gets a priority
     24        of 0, but due to the aforementioned clamping behavior both VeryLow and
     25        Low will effectively both have a CFURLRequestPriority of 0.
     26
     27        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
     28        (WebKit::initializeNetworkSettings):
     29
    1302019-11-13  Youenn Fablet  <youenn@apple.com>
    231
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm

    r252368 r252431  
    6363        const unsigned fastLaneConnectionCount = 1;
    6464
    65         _CFNetworkHTTPConnectionCacheSetLimit(kHTTPPriorityNumLevels, toPlatformRequestPriority(WebCore::ResourceLoadPriority::Highest));
     65        _CFNetworkHTTPConnectionCacheSetLimit(kHTTPPriorityNumLevels, WebCore::resourceLoadPriorityCount);
    6666        _CFNetworkHTTPConnectionCacheSetLimit(kHTTPMinimumFastLanePriority, toPlatformRequestPriority(WebCore::ResourceLoadPriority::Medium));
    6767        _CFNetworkHTTPConnectionCacheSetLimit(kHTTPNumFastLanes, fastLaneConnectionCount);
Note: See TracChangeset for help on using the changeset viewer.