Changeset 229427 in webkit


Ignore:
Timestamp:
Mar 8, 2018, 1:11:50 PM (7 years ago)
Author:
wilander@apple.com
Message:

Resource Load Statistics: Make debug mode always partition prevalent resources
https://bugs.webkit.org/show_bug.cgi?id=183468
<rdar://problem/38269437>

Reviewed by Brent Fulgham.

After some testing we decided that a 30 second timeout in ITP debug mode just makes
it confusing. We should instead always partition prevalent resources in debug mode
to make it easy to understand. The partitioned state is what developers want to test
anyway.

  • UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:

(WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):

Minor change to include 0 as valid setting.

  • UIProcess/WebResourceLoadStatisticsStore.cpp:

(WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):

Now just stores the setting of debug mode instead of changing the timeout.

(WebKit::WebResourceLoadStatisticsStore::logUserInteraction):

Now does not disable partitioning under debug mode.

(WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):

Now returns true for prevalent resources with user interaction under debug mode.

(WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):

Removed duplicate debug logging statement.

  • UIProcess/WebResourceLoadStatisticsStore.h:

Added member m_debugModeEnabled.

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r229426 r229427  
     12018-03-08  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Make debug mode always partition prevalent resources
     4        https://bugs.webkit.org/show_bug.cgi?id=183468
     5        <rdar://problem/38269437>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        After some testing we decided that a 30 second timeout in ITP debug mode just makes
     10        it confusing. We should instead always partition prevalent resources in debug mode
     11        to make it easy to understand. The partitioned state is what developers want to test
     12        anyway.
     13
     14        * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
     15        (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
     16            Minor change to include 0 as valid setting.
     17        * UIProcess/WebResourceLoadStatisticsStore.cpp:
     18        (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
     19            Now just stores the setting of debug mode instead of changing the timeout.
     20        (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
     21            Now does not disable partitioning under debug mode.
     22        (WebKit::WebResourceLoadStatisticsStore::shouldPartitionCookies const):
     23            Now returns true for prevalent resources with user interaction under debug mode.           
     24        (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
     25            Removed duplicate debug logging statement.
     26        * UIProcess/WebResourceLoadStatisticsStore.h:
     27            Added member m_debugModeEnabled.
     28
    1292018-03-08  Brent Fulgham  <bfulgham@apple.com>
    230
  • trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm

    r228967 r229427  
    3939
    4040        Seconds timeToLiveCookiePartitionFree([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsTimeToLiveCookiePartitionFree"]);
    41         if (timeToLiveCookiePartitionFree > 0_s && timeToLiveCookiePartitionFree <= 24_h)
     41        if (timeToLiveCookiePartitionFree >= 0_s && timeToLiveCookiePartitionFree <= 24_h)
    4242            setTimeToLiveCookiePartitionFree(timeToLiveCookiePartitionFree);
    4343
    4444        Seconds minimumTimeBetweenDataRecordsRemoval([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsMinimumTimeBetweenDataRecordsRemoval"]);
    45         if (minimumTimeBetweenDataRecordsRemoval > 0_s && minimumTimeBetweenDataRecordsRemoval < 1_h)
     45        if (minimumTimeBetweenDataRecordsRemoval >= 0_s && minimumTimeBetweenDataRecordsRemoval < 1_h)
    4646            setMinimumTimeBetweenDataRecordsRemoval(minimumTimeBetweenDataRecordsRemoval);
    4747
    4848        Seconds grandfatheringTime([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsGrandfatheringTime"]);
    49         if (grandfatheringTime > 0_s && grandfatheringTime <= 24_h * 7)
     49        if (grandfatheringTime >= 0_s && grandfatheringTime <= 24_h * 7)
    5050            setGrandfatheringTime(grandfatheringTime);
    5151
  • trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp

    r229106 r229427  
    444444void WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode(bool enable)
    445445{
    446     if (enable)
    447         setTimeToLiveCookiePartitionFree(30_s);
    448     else
    449         resetParametersToDefaultValues();
     446    m_debugModeEnabled = enable;
     447#if !RELEASE_LOG_DISABLED
     448    RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "ITP Debug Mode %{public}s.", (m_debugModeEnabled ? "enabled" : "disabled"));
     449#endif
    450450}
    451451
     
    460460        statistics.mostRecentUserInteractionTime = WallTime::now();
    461461
    462         if (statistics.isMarkedForCookiePartitioning || statistics.isMarkedForCookieBlocking)
    463             updateCookiePartitioningForDomains({ }, { }, { primaryDomain }, ShouldClearFirst::No, []() { });
     462        if (m_debugModeEnabled) {
     463            if (statistics.isMarkedForCookieBlocking)
     464                updateCookiePartitioningForDomains({ primaryDomain }, { }, { }, ShouldClearFirst::No, []() { });
     465        } else
     466            if (statistics.isMarkedForCookiePartitioning || statistics.isMarkedForCookieBlocking)
     467                updateCookiePartitioningForDomains({ }, { }, { primaryDomain }, ShouldClearFirst::No, []() { });
    464468    });
    465469}
     
    956960bool WebResourceLoadStatisticsStore::shouldPartitionCookies(const ResourceLoadStatistics& statistic) const
    957961{
     962    if (m_debugModeEnabled)
     963        return statistic.isPrevalentResource && statistic.hadUserInteraction;
     964
    958965    return statistic.isPrevalentResource && statistic.hadUserInteraction && WallTime::now() > statistic.mostRecentUserInteractionTime + m_parameters.timeToLiveCookiePartitionFree;
    959966}
     
    10041011            }
    10051012            RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to partition cookies in third-party contexts for %{public}s.", domainsToPartitionBuilder.toString().utf8().data());
    1006             RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to partition cookies in third-party contexts for %s.", domainsToPartitionBuilder.toString().utf8().data());
    10071013        }
    10081014
  • trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h

    r229106 r229427  
    225225    bool m_dataRecordsBeingRemoved { false };
    226226
     227    bool m_debugModeEnabled { false };
    227228    bool m_debugLoggingEnabled { false };
    228229
Note: See TracChangeset for help on using the changeset viewer.