Changeset 263474 in webkit


Ignore:
Timestamp:
Jun 24, 2020 2:18:10 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

We should resurrect the older patch that collects some statistics of web API calls
https://bugs.webkit.org/show_bug.cgi?id=213319

Patch by Umar Iqbal <uiqbal@apple.com> on 2020-06-24
Reviewed by Brent Fulgham.
Source/JavaScriptCore:

+ Enabled ENABLE_WEB_API_STATISTICS flag

  • Configurations/FeatureDefines.xcconfig:

Source/WebCore:

No new tests. Enabled existing tests.
Enabled http/tests/webAPIStatistics that test the functionality behind WEB_API_STATISTICS flag.

+ Brought back WebCore::encodeHashSet(KeyedEncoder& encoder, const String& label,
const String& key, const HashSet<String>& hashSet) because it was needed by

WebCore::encodeFontHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet)

+ Changed the type of HashCountedSet to HashSet because of earlier patch

(https://bugs.webkit.org/attachment.cgi?id=363033) updated other HashCountedSet to HashSet,
stating that the counted statistics were never used (see change log in the mentioned patch).

+ Also changed the type of topFrameRegistrableDomainsWhichAccessedWebAPIs HashSet
from String to RegistrableDomain. See the earlier bug (https://bugs.webkit.org/show_bug.cgi?id=194791)
that explains the switch from String to RegistrableDomain for eTLD+1's
+ Enabled WEB_API_STATISTICS flag in FeatureDefines.xcconfig and PlatformEnableCocoa.h
+ Added WTF::EnumTraits<> for OptionSet<> enum in ResourceLoadStatistics.h due to an earlier change.

  • loader/ResourceLoadStatistics.h:
  • Configurations/FeatureDefines.xcconfig:
  • loader/CanvasActivityRecord.h:
  • loader/ResourceLoadStatistics.cpp:

(WebCore::encodeHashSet):
(WebCore::ResourceLoadStatistics::encode const):
(WebCore::decodeHashSet):
(WebCore::decodeCanvasActivityRecord):
(WebCore::ResourceLoadStatistics::decode):
(WebCore::appendHashSet):
(WebCore::ResourceLoadStatistics::toString const):

Source/WebCore/PAL:

+ Enabled ENABLE_WEB_API_STATISTICS flag

  • Configurations/FeatureDefines.xcconfig:

Source/WebKit:

+ Enabled ENABLE_WEB_API_STATISTICS flag
+ Removed .string() from mainFrameRegistrableDomain to append it to topFrameRegistrableDomainsWhichAccessedWebAPIs

because topFrameRegistrableDomainsWhichAccessedWebAPIs is a HashSet of WebCore::RegistrableDomain

  • Configurations/FeatureDefines.xcconfig:
  • WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:

(WebKit::WebResourceLoadObserver::logFontLoad):
(WebKit::WebResourceLoadObserver::logCanvasRead):
(WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure):
(WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed):
(WebKit::WebResourceLoadObserver::logScreenAPIAccessed):

Source/WebKitLegacy/mac:

+ Enabled ENABLE_WEB_API_STATISTICS flag

  • Configurations/FeatureDefines.xcconfig:

Source/WTF:

+ Enabled ENABLE_WEB_API_STATISTICS flag

  • wtf/PlatformEnableCocoa.h:

Tools:

+ Enabled ENABLE_WEB_API_STATISTICS flag.

  • TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

LayoutTests:

We should resurrect the older patch that collects some statistics of web API calls

+ Enabled web API statistics tests in ios-wk2 and mac-wk2
+ Updated expectations for web API statistics and resrource load statistics tests.

  • http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt:
  • http/tests/webAPIStatistics/font-load-data-collection-expected.txt:
  • http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt:
  • http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt:
  • platform/ios-wk2/TestExpectations:
  • platform/mac-wk2/TestExpectations:
  • http/tests/resourceLoadStatistics/aggregate-sorted-data-no-storage-access-expected.txt:
  • http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-expected.txt:
  • http/tests/resourceLoadStatistics/count-third-party-script-loads-expected.txt:
  • http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-expected.txt:
  • http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt:
  • http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt:
  • http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration-expected.txt:
  • http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-expected.txt:
  • http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt:
  • http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt:
Location:
trunk
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r263473 r263474  
     12020-06-24  Umar Iqbal  <uiqbal@apple.com>
     2
     3        We should resurrect the older patch that collects some statistics of web API calls
     4        https://bugs.webkit.org/show_bug.cgi?id=213319
     5
     6        Reviewed by Brent Fulgham.
     7
     8        We should resurrect the older patch that collects some statistics of web API calls
     9       
     10        + Enabled web API statistics tests in ios-wk2 and mac-wk2
     11        + Updated expectations for web API statistics and resrource load statistics tests.
     12
     13        * http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt:
     14        * http/tests/webAPIStatistics/font-load-data-collection-expected.txt:
     15        * http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt:
     16        * http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt:
     17        * platform/ios-wk2/TestExpectations:
     18        * platform/mac-wk2/TestExpectations:
     19       
     20        * http/tests/resourceLoadStatistics/aggregate-sorted-data-no-storage-access-expected.txt:
     21        * http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-expected.txt:
     22        * http/tests/resourceLoadStatistics/count-third-party-script-loads-expected.txt:
     23        * http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-expected.txt:
     24        * http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt:
     25        * http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt:
     26        * http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration-expected.txt:
     27        * http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-expected.txt:
     28        * http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt:
     29        * http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt:
     30
    1312020-06-24  Pinki Gyanchandani  <pgyanchandani@apple.com>
    232
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/aggregate-sorted-data-no-storage-access-expected.txt

    r256055 r263474  
    1717    isVeryPrevalentResource: No
    1818    dataRecordsRemoved: 0
     19    canvasReadData: No
     20
    1921Registrable domain: subframe2
    2022    hadUserInteraction: No
     
    2729    isVeryPrevalentResource: No
    2830    dataRecordsRemoved: 0
     31    canvasReadData: No
     32
    2933Registrable domain: subframe3
    3034    hadUserInteraction: No
     
    4246    isVeryPrevalentResource: No
    4347    dataRecordsRemoved: 0
     48    canvasReadData: No
     49
    4450Registrable domain: topframe1
    4551    hadUserInteraction: No
     
    5056    isVeryPrevalentResource: No
    5157    dataRecordsRemoved: 0
     58    canvasReadData: No
     59
    5260Registrable domain: topframe2
    5361    hadUserInteraction: No
     
    5866    isVeryPrevalentResource: No
    5967    dataRecordsRemoved: 0
     68    canvasReadData: No
     69
    6070Registrable domain: topframe3
    6171    hadUserInteraction: No
     
    6676    isVeryPrevalentResource: No
    6777    dataRecordsRemoved: 0
     78    canvasReadData: No
     79
    6880Registrable domain: topframe4
    6981    hadUserInteraction: No
     
    7486    isVeryPrevalentResource: No
    7587    dataRecordsRemoved: 0
     88    canvasReadData: No
     89
    7690
    7791ITP Data:
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-import-in-worker-expected.txt

    r256055 r263474  
    1515    isVeryPrevalentResource: No
    1616    dataRecordsRemoved: 0
     17    canvasReadData: No
     18
    1719Registrable domain: localhost
    1820    hadUserInteraction: No
     
    2527    isVeryPrevalentResource: No
    2628    dataRecordsRemoved: 0
     29    canvasReadData: No
     30
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/count-third-party-script-loads-expected.txt

    r256055 r263474  
    1515    isVeryPrevalentResource: No
    1616    dataRecordsRemoved: 0
     17    canvasReadData: No
     18
    1719Registrable domain: localhost
    1820    hadUserInteraction: No
     
    2527    isVeryPrevalentResource: No
    2628    dataRecordsRemoved: 0
     29    canvasReadData: No
     30
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/dont-count-third-party-image-as-third-party-script-expected.txt

    r253697 r263474  
    1515    isVeryPrevalentResource: No
    1616    dataRecordsRemoved: 0
     17    canvasReadData: No
     18
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration-expected.txt

    r256197 r263474  
    1313    isVeryPrevalentResource: No
    1414    dataRecordsRemoved: 0
     15    canvasReadData: No
     16
    1517Registrable domain: localhost
    1618    hadUserInteraction: No
     
    2527    isVeryPrevalentResource: No
    2628    dataRecordsRemoved: 0
     29    canvasReadData: No
     30
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/log-delayed-client-side-redirects-expected.txt

    r256055 r263474  
    1313    isVeryPrevalentResource: No
    1414    dataRecordsRemoved: 0
     15    canvasReadData: No
     16
    1517Registrable domain: localhost
    1618    hadUserInteraction: No
     
    2325    isVeryPrevalentResource: No
    2426    dataRecordsRemoved: 0
     27    canvasReadData: No
     28
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-link-decoration-expected.txt

    r260668 r263474  
    1010    isVeryPrevalentResource: No
    1111    dataRecordsRemoved: 0
     12    canvasReadData: No
     13
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/remove-website-data-for-origin-deletes-third-party-script-loads-expected.txt

    r260668 r263474  
    1313    isVeryPrevalentResource: No
    1414    dataRecordsRemoved: 0
     15    canvasReadData: No
     16
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration-expected.txt

    r256055 r263474  
    2626    isVeryPrevalentResource: No
    2727    dataRecordsRemoved: 1
     28    canvasReadData: No
     29
    2830Registrable domain: localhost
    2931    hadUserInteraction: No
     
    3436    isVeryPrevalentResource: No
    3537    dataRecordsRemoved: 0
     38    canvasReadData: No
     39
  • trunk/LayoutTests/http/tests/storageAccess/aggregate-sorted-data-with-storage-access-expected.txt

    r256055 r263474  
    2323    isVeryPrevalentResource: No
    2424    dataRecordsRemoved: 0
     25    canvasReadData: No
     26
    2527Registrable domain: localhost
    2628    hadUserInteraction: Yes
     
    3941    isVeryPrevalentResource: No
    4042    dataRecordsRemoved: 0
     43    canvasReadData: No
     44
    4145
    4246ITP Data:
  • trunk/LayoutTests/http/tests/webAPIStatistics/canvas-read-and-write-data-collection-expected.txt

    r237304 r263474  
    22Resource load statistics:
    33
    4 High level domain: 127.0.0.1
    5     lastSeen: 0
     4Registrable domain: 127.0.0.1
    65    hadUserInteraction: No
    76    mostRecentUserInteraction: -1
    87    grandfathered: No
     8    gotLinkDecorationFromPrevalentResource: No
    99    isPrevalentResource: No
    1010    isVeryPrevalentResource: No
     
    1414        Times
    1515    topFrameRegistrableDomainsWhichAccessedWebAPIs:
    16         127.0.0.1: 4
     16        127.0.0.1
    1717    canvasTextWritten:
    1818        suspicious invisible text
  • trunk/LayoutTests/http/tests/webAPIStatistics/font-load-data-collection-expected.txt

    r237304 r263474  
    44Resource load statistics:
    55
    6 High level domain: 127.0.0.1
    7     lastSeen: 0
     6Registrable domain: 127.0.0.1
    87    hadUserInteraction: No
    98    mostRecentUserInteraction: -1
    109    grandfathered: No
     10    gotLinkDecorationFromPrevalentResource: No
    1111    isPrevalentResource: No
    1212    isVeryPrevalentResource: No
     
    1919        Times
    2020    topFrameRegistrableDomainsWhichAccessedWebAPIs:
    21         127.0.0.1: 5
     21        127.0.0.1
    2222    canvasReadData: No
    2323
  • trunk/LayoutTests/http/tests/webAPIStatistics/navigator-functions-accessed-data-collection-expected.txt

    r237304 r263474  
    22Resource load statistics:
    33
    4 High level domain: 127.0.0.1
    5     lastSeen: 0
     4Registrable domain: 127.0.0.1
    65    hadUserInteraction: No
    76    mostRecentUserInteraction: -1
    87    grandfathered: No
     8    gotLinkDecorationFromPrevalentResource: No
    99    isPrevalentResource: No
    1010    isVeryPrevalentResource: No
     
    1313        Times
    1414    topFrameRegistrableDomainsWhichAccessedWebAPIs:
    15         127.0.0.1: 8
     15        127.0.0.1
    1616    navigatorFunctionsAccessed:
    1717        appVersion
  • trunk/LayoutTests/http/tests/webAPIStatistics/screen-functions-accessed-data-collection-expected.txt

    r237304 r263474  
    22Resource load statistics:
    33
    4 High level domain: 127.0.0.1
    5     lastSeen: 0
     4Registrable domain: 127.0.0.1
    65    hadUserInteraction: No
    76    mostRecentUserInteraction: -1
    87    grandfathered: No
     8    gotLinkDecorationFromPrevalentResource: No
    99    isPrevalentResource: No
    1010    isVeryPrevalentResource: No
     
    1313        Times
    1414    topFrameRegistrableDomainsWhichAccessedWebAPIs:
    15         127.0.0.1: 9
     15        127.0.0.1
    1616    screenFunctionsAccessed:
    1717        height
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r263452 r263474  
    7070
    7171# Skipped because of <rdar://problem/45388584>.
    72 http/tests/webAPIStatistics [ Skip ]
     72http/tests/webAPIStatistics [ Pass ]
    7373
    7474# Non-fast scrollable region doesn't apply to iOS.
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r263463 r263474  
    7171
    7272# Skipped because of <rdar://problem/45388584>.
    73 http/tests/webAPIStatistics [ Skip ]
     73http/tests/webAPIStatistics [ Pass ]
    7474
    7575webkit.org/b/184569 storage/indexeddb/modern/transactions-stop-on-navigation.html [ Pass Failure ]
  • trunk/Source/JavaScriptCore/ChangeLog

    r263470 r263474  
     12020-06-24  Umar Iqbal  <uiqbal@apple.com>
     2
     3        We should resurrect the older patch that collects some statistics of web API calls
     4        https://bugs.webkit.org/show_bug.cgi?id=213319
     5
     6        Reviewed by Brent Fulgham.
     7
     8        + Enabled ENABLE_WEB_API_STATISTICS flag
     9
     10        * Configurations/FeatureDefines.xcconfig:
     11
    1122020-06-24  Alexey Shvayka  <shvaikalesh@gmail.com>
    213
  • trunk/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig

    r262695 r263474  
    386386ENABLE_WEBXR = ;
    387387
    388 ENABLE_WEB_API_STATISTICS = ;
     388ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
    389389
    390390ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
  • trunk/Source/WTF/ChangeLog

    r263461 r263474  
     12020-06-24  Umar Iqbal  <uiqbal@apple.com>
     2
     3        We should resurrect the older patch that collects some statistics of web API calls
     4        https://bugs.webkit.org/show_bug.cgi?id=213319
     5
     6        Reviewed by Brent Fulgham.
     7
     8        + Enabled ENABLE_WEB_API_STATISTICS flag
     9       
     10        * wtf/PlatformEnableCocoa.h:
     11
    1122020-06-24  Geoffrey Garen  <ggaren@apple.com>
    213
  • trunk/Source/WTF/wtf/PlatformEnableCocoa.h

    r263380 r263474  
    332332#endif
    333333
     334#if !defined(ENABLE_WEB_API_STATISTICS)
     335#define ENABLE_WEB_API_STATISTICS 1
     336#endif
     337
    334338#if !defined(ENABLE_RESOURCE_USAGE)
    335339#define ENABLE_RESOURCE_USAGE 1
  • trunk/Source/WebCore/ChangeLog

    r263473 r263474  
     12020-06-24  Umar Iqbal  <uiqbal@apple.com>
     2
     3        We should resurrect the older patch that collects some statistics of web API calls
     4        https://bugs.webkit.org/show_bug.cgi?id=213319
     5
     6        Reviewed by Brent Fulgham.
     7
     8        No new tests. Enabled existing tests.
     9        Enabled http/tests/webAPIStatistics that test the functionality behind WEB_API_STATISTICS flag.
     10       
     11        + Brought back WebCore::encodeHashSet(KeyedEncoder& encoder, const String& label,
     12        const String& key, const HashSet<String>& hashSet) because it was needed by
     13         WebCore::encodeFontHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet)
     14        + Changed the type of HashCountedSet to HashSet because of earlier patch
     15         (https://bugs.webkit.org/attachment.cgi?id=363033) updated other HashCountedSet to HashSet,
     16         stating that the counted statistics were never used (see change log in the mentioned patch).
     17        + Also changed the type of topFrameRegistrableDomainsWhichAccessedWebAPIs HashSet
     18        from String to RegistrableDomain. See the earlier bug (https://bugs.webkit.org/show_bug.cgi?id=194791)
     19        that explains the switch from String to RegistrableDomain for eTLD+1's
     20        + Enabled WEB_API_STATISTICS flag in FeatureDefines.xcconfig and PlatformEnableCocoa.h
     21        + Added WTF::EnumTraits<> for OptionSet<> enum in ResourceLoadStatistics.h due to an earlier change.
     22       
     23        * loader/ResourceLoadStatistics.h:
     24        * Configurations/FeatureDefines.xcconfig:
     25        * loader/CanvasActivityRecord.h:
     26        * loader/ResourceLoadStatistics.cpp:
     27        (WebCore::encodeHashSet):
     28        (WebCore::ResourceLoadStatistics::encode const):
     29        (WebCore::decodeHashSet):
     30        (WebCore::decodeCanvasActivityRecord):
     31        (WebCore::ResourceLoadStatistics::decode):
     32        (WebCore::appendHashSet):
     33        (WebCore::ResourceLoadStatistics::toString const):
     34
    1352020-06-24  Pinki Gyanchandani  <pgyanchandani@apple.com>
    236
  • trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig

    r262695 r263474  
    386386ENABLE_WEBXR = ;
    387387
    388 ENABLE_WEB_API_STATISTICS = ;
     388ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
    389389
    390390ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
  • trunk/Source/WebCore/PAL/ChangeLog

    r263364 r263474  
     12020-06-24  Umar Iqbal  <uiqbal@apple.com>
     2
     3        We should resurrect the older patch that collects some statistics of web API calls
     4        https://bugs.webkit.org/show_bug.cgi?id=213319
     5
     6        Reviewed by Brent Fulgham.
     7
     8        + Enabled ENABLE_WEB_API_STATISTICS flag
     9
     10        * Configurations/FeatureDefines.xcconfig:
     11
    1122020-06-22  Tim Horton  <timothy_horton@apple.com>
    213
  • trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig

    r262695 r263474  
    386386ENABLE_WEBXR = ;
    387387
    388 ENABLE_WEB_API_STATISTICS = ;
     388ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
    389389
    390390ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
  • trunk/Source/WebCore/loader/CanvasActivityRecord.h

    r260078 r263474  
    3434    bool wasDataRead { false };
    3535   
    36     bool recordWrittenOrMeasuredText(const String&);
     36    WEBCORE_EXPORT bool recordWrittenOrMeasuredText(const String&);
    3737    void mergeWith(const CanvasActivityRecord&);
    3838   
  • trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp

    r262228 r263474  
    6161
    6262#if ENABLE(WEB_API_STATISTICS)
     63static void encodeHashSet(KeyedEncoder& encoder, const String& label,  const String& key, const HashSet<String>& hashSet)
     64{
     65    if (hashSet.isEmpty())
     66        return;
     67   
     68    encoder.encodeObjects(label, hashSet.begin(), hashSet.end(), [&key](KeyedEncoder& encoderInner, const String& origin) {
     69        encoderInner.encodeString(key, origin);
     70    });
     71}
     72
    6373static void encodeFontHashSet(KeyedEncoder& encoder, const String& label, const HashSet<String>& hashSet)
    6474{
     
    117127    encodeFontHashSet(encoder, "fontsFailedToLoad", fontsFailedToLoad);
    118128    encodeFontHashSet(encoder, "fontsSuccessfullyLoaded", fontsSuccessfullyLoaded);
    119     encodeHashCountedSet(encoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs);
     129    encodeHashSet(encoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", "domain", topFrameRegistrableDomainsWhichAccessedWebAPIs);
    120130    encodeCanvasActivityRecord(encoder, "canvasActivityRecord", canvasActivityRecord);
    121131    encodeOptionSet(encoder, "navigatorFunctionsAccessedBitMask", navigatorFunctionsAccessed);
     
    165175
    166176#if ENABLE(WEB_API_STATISTICS)
     177static void decodeHashSet(KeyedDecoder& decoder, const String& label, const String& key, HashSet<String>& hashSet)
     178{
     179    Vector<String> ignore;
     180IGNORE_WARNINGS_BEGIN("unused-result")
     181    decoder.decodeObjects(label, ignore, [&hashSet, &key](KeyedDecoder& decoderInner, String& origin) {
     182        if (!decoderInner.decodeString(key, origin))
     183            return false;
     184       
     185        hashSet.add(origin);
     186        return true;
     187    });
     188IGNORE_WARNINGS_END
     189}
     190
    167191static void decodeFontHashSet(KeyedDecoder& decoder, const String& label, HashSet<String>& hashSet)
    168192{
     
    172196static void decodeCanvasActivityRecord(KeyedDecoder& decoder, const String& label, CanvasActivityRecord& canvasActivityRecord)
    173197{
     198IGNORE_WARNINGS_BEGIN("unused-result")
    174199    decoder.decodeObject(label, canvasActivityRecord, [] (KeyedDecoder& decoderInner, CanvasActivityRecord& canvasActivityRecord) {
    175200        if (!decoderInner.decodeBool("wasDataRead", canvasActivityRecord.wasDataRead))
     
    184209        return true;
    185210    });
     211IGNORE_WARNINGS_END
    186212}
    187213#endif
     
    314340        decodeFontHashSet(decoder, "fontsFailedToLoad", fontsFailedToLoad);
    315341        decodeFontHashSet(decoder, "fontsSuccessfullyLoaded", fontsSuccessfullyLoaded);
    316         decodeHashCountedSet(decoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs);
     342        decodeHashSet(decoder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", "domain", topFrameRegistrableDomainsWhichAccessedWebAPIs);
    317343        decodeCanvasActivityRecord(decoder, "canvasActivityRecord", canvasActivityRecord);
    318344        decodeOptionSet(decoder, "navigatorFunctionsAccessedBitMask", navigatorFunctionsAccessed);
     
    349375
    350376#if ENABLE(WEB_API_STATISTICS)
     377static void appendHashSet(StringBuilder& builder, const String& label, const HashSet<String>& hashSet)
     378{
     379    if (hashSet.isEmpty())
     380        return;
     381   
     382    builder.appendLiteral("    ");
     383    builder.append(label);
     384    builder.appendLiteral(":\n");
     385   
     386    for (auto& entry : hashSet) {
     387        builder.appendLiteral("        ");
     388        builder.append(entry);
     389        builder.append('\n');
     390    }
     391}
     392
    351393static ASCIILiteral navigatorAPIEnumToString(ResourceLoadStatistics::NavigatorAPI navigatorEnum)
    352394{
     
    473515    appendHashSet(builder, "fontsFailedToLoad", fontsFailedToLoad);
    474516    appendHashSet(builder, "fontsSuccessfullyLoaded", fontsSuccessfullyLoaded);
    475     appendHashCountedSet(builder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs);
     517    appendHashSet(builder, "topFrameRegistrableDomainsWhichAccessedWebAPIs", topFrameRegistrableDomainsWhichAccessedWebAPIs);
    476518    appendNavigatorAPIOptionSet(builder, navigatorFunctionsAccessed);
    477519    appendScreenAPIOptionSet(builder, screenFunctionsAccessed);
  • trunk/Source/WebCore/loader/ResourceLoadStatistics.h

    r262228 r263474  
    124124    // This set represents the registrable domain of the top frame where web API
    125125    // were used in the top frame or one of its subframes.
    126     HashCountedSet<String> topFrameRegistrableDomainsWhichAccessedWebAPIs;
     126    HashSet<RegistrableDomain> topFrameRegistrableDomainsWhichAccessedWebAPIs;
    127127    HashSet<String> fontsFailedToLoad;
    128128    HashSet<String> fontsSuccessfullyLoaded;
     
    134134
    135135} // namespace WebCore
     136
     137namespace WTF {
     138
     139template<> struct EnumTraits<WebCore::ResourceLoadStatistics::NavigatorAPI> {
     140    using values = EnumValues<
     141        WebCore::ResourceLoadStatistics::NavigatorAPI,
     142        WebCore::ResourceLoadStatistics::NavigatorAPI::AppVersion,
     143        WebCore::ResourceLoadStatistics::NavigatorAPI::UserAgent,
     144        WebCore::ResourceLoadStatistics::NavigatorAPI::Plugins,
     145        WebCore::ResourceLoadStatistics::NavigatorAPI::MimeTypes,
     146        WebCore::ResourceLoadStatistics::NavigatorAPI::CookieEnabled,
     147        WebCore::ResourceLoadStatistics::NavigatorAPI::JavaEnabled
     148    >;
     149};
     150
     151template<> struct EnumTraits<WebCore::ResourceLoadStatistics::ScreenAPI> {
     152    using values = EnumValues<
     153        WebCore::ResourceLoadStatistics::ScreenAPI,
     154        WebCore::ResourceLoadStatistics::ScreenAPI::Height,
     155        WebCore::ResourceLoadStatistics::ScreenAPI::Width,
     156        WebCore::ResourceLoadStatistics::ScreenAPI::ColorDepth,
     157        WebCore::ResourceLoadStatistics::ScreenAPI::PixelDepth,
     158        WebCore::ResourceLoadStatistics::ScreenAPI::AvailLeft,
     159        WebCore::ResourceLoadStatistics::ScreenAPI::AvailTop,
     160        WebCore::ResourceLoadStatistics::ScreenAPI::AvailHeight,
     161        WebCore::ResourceLoadStatistics::ScreenAPI::AvailWidth
     162    >;
     163};
     164
     165} // namespace WTF
  • trunk/Source/WebKit/ChangeLog

    r263472 r263474  
     12020-06-24  Umar Iqbal  <uiqbal@apple.com>
     2
     3        We should resurrect the older patch that collects some statistics of web API calls
     4        https://bugs.webkit.org/show_bug.cgi?id=213319
     5
     6        Reviewed by Brent Fulgham.
     7
     8        + Enabled ENABLE_WEB_API_STATISTICS flag
     9        + Removed .string() from mainFrameRegistrableDomain to append it to topFrameRegistrableDomainsWhichAccessedWebAPIs
     10         because topFrameRegistrableDomainsWhichAccessedWebAPIs is a HashSet of WebCore::RegistrableDomain
     11
     12        * Configurations/FeatureDefines.xcconfig:
     13        * WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
     14        (WebKit::WebResourceLoadObserver::logFontLoad):
     15        (WebKit::WebResourceLoadObserver::logCanvasRead):
     16        (WebKit::WebResourceLoadObserver::logCanvasWriteOrMeasure):
     17        (WebKit::WebResourceLoadObserver::logNavigatorAPIAccessed):
     18        (WebKit::WebResourceLoadObserver::logScreenAPIAccessed):
     19
    1202020-06-24  Andy Estes  <aestes@apple.com>
    221
  • trunk/Source/WebKit/Configurations/FeatureDefines.xcconfig

    r262695 r263474  
    386386ENABLE_WEBXR = ;
    387387
    388 ENABLE_WEB_API_STATISTICS = ;
     388ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
    389389
    390390ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp

    r263383 r263474  
    164164    }
    165165    RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
    166     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
     166    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
    167167        shouldCallNotificationCallback = true;
    168168    if (shouldCallNotificationCallback)
     
    185185    RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
    186186    statistics.canvasActivityRecord.wasDataRead = true;
    187     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
     187    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
    188188        scheduleNotificationIfNeeded();
    189189#else
     
    204204    if (statistics.canvasActivityRecord.recordWrittenOrMeasuredText(textWritten))
    205205        shouldCallNotificationCallback = true;
    206     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
     206    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
    207207        shouldCallNotificationCallback = true;
    208208    if (shouldCallNotificationCallback)
     
    228228    }
    229229    RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
    230     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
     230    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
    231231        shouldCallNotificationCallback = true;
    232232    if (shouldCallNotificationCallback)
     
    252252    }
    253253    RegistrableDomain mainFrameRegistrableDomain { document.topDocument().url() };
    254     if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain.string()).isNewEntry)
     254    if (statistics.topFrameRegistrableDomainsWhichAccessedWebAPIs.add(mainFrameRegistrableDomain).isNewEntry)
    255255        shouldCallNotificationCallback = true;
    256256    if (shouldCallNotificationCallback)
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r263364 r263474  
     12020-06-24  Umar Iqbal  <uiqbal@apple.com>
     2
     3        We should resurrect the older patch that collects some statistics of web API calls
     4        https://bugs.webkit.org/show_bug.cgi?id=213319
     5
     6        Reviewed by Brent Fulgham.
     7
     8        + Enabled ENABLE_WEB_API_STATISTICS flag
     9       
     10        * Configurations/FeatureDefines.xcconfig:
     11
    1122020-06-22  Tim Horton  <timothy_horton@apple.com>
    213
  • trunk/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig

    r262695 r263474  
    386386ENABLE_WEBXR = ;
    387387
    388 ENABLE_WEB_API_STATISTICS = ;
     388ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
    389389
    390390ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
  • trunk/Tools/ChangeLog

    r263472 r263474  
     12020-06-24  Umar Iqbal  <uiqbal@apple.com>
     2
     3        We should resurrect the older patch that collects some statistics of web API calls
     4        https://bugs.webkit.org/show_bug.cgi?id=213319
     5
     6        Reviewed by Brent Fulgham.
     7       
     8        + Enabled ENABLE_WEB_API_STATISTICS flag.
     9       
     10        * TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
     11
    1122020-06-24  Andy Estes  <aestes@apple.com>
    213
  • trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig

    r262695 r263474  
    386386ENABLE_WEBXR = ;
    387387
    388 ENABLE_WEB_API_STATISTICS = ;
     388ENABLE_WEB_API_STATISTICS = ENABLE_WEB_API_STATISTICS;
    389389
    390390ENABLE_WEB_AUDIO = ENABLE_WEB_AUDIO;
Note: See TracChangeset for help on using the changeset viewer.