Changeset 240586 in webkit
- Timestamp:
- Jan 28, 2019 9:29:44 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r240579 r240586 1 2019-01-28 Brent Fulgham <bfulgham@apple.com> 2 3 Remove the UIProcess components of the ResourceLoadStatistics code 4 https://bugs.webkit.org/show_bug.cgi?id=193303 5 <rdar://problem/47160073> 6 7 Reviewed by Chris Dumez. 8 9 Now that the ResourceLoadStatistics code is running in the NetworkProcess, we can get rid 10 of the UIProcess copies of these routines. 11 12 Tested by existing ResourceLoadStatistics and StorageAccess tests. 13 14 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 15 (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap): 16 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 17 (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler): 18 (WebKit::WebResourceLoadStatisticsStore::callGrantStorageAccessHandler): 19 (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess): 20 (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap): 21 (WebKit::WebResourceLoadStatisticsStore::callUpdatePrevalentDomainsToBlockCookiesForHandler): 22 (WebKit::WebResourceLoadStatisticsStore::callRemoveDomainsHandler): 23 (WebKit::WebResourceLoadStatisticsStore::logTestingEvent): 24 (WebKit::WebResourceLoadStatisticsStore::notifyResourceLoadStatisticsProcessed): 25 (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): 26 (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData): 27 (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const): 28 (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const): 29 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h: 30 * UIProcess/WebProcessProxy.cpp: 31 (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): Deleted. 32 (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData): Deleted. 33 * UIProcess/WebProcessProxy.h: 34 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 35 (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains): 36 (WebKit::WebsiteDataStore::removeData): 37 (WebKit::WebsiteDataStore::setMaxStatisticsEntries): 38 (WebKit::WebsiteDataStore::setPruneEntriesDownTo): 39 (WebKit::WebsiteDataStore::setGrandfatheringTime): 40 (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval): 41 (WebKit::WebsiteDataStore::dumpResourceLoadStatistics): 42 (WebKit::WebsiteDataStore::isPrevalentResource): 43 (WebKit::WebsiteDataStore::setPrevalentResource): 44 (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode): 45 (WebKit::WebsiteDataStore::isVeryPrevalentResource): 46 (WebKit::WebsiteDataStore::setVeryPrevalentResource): 47 (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval): 48 (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin): 49 (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder): 50 (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin): 51 (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder): 52 (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo): 53 (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom): 54 (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo): 55 (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom): 56 (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo): 57 (WebKit::WebsiteDataStore::clearPrevalentResource): 58 (WebKit::WebsiteDataStore::resetParametersToDefaultValues): 59 (WebKit::WebsiteDataStore::submitTelemetry): 60 (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent): 61 (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate): 62 (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing): 63 (WebKit::WebsiteDataStore::setLastSeen): 64 (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned): 65 (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured): 66 (WebKit::WebsiteDataStore::hasStorageAccess): 67 (WebKit::WebsiteDataStore::requestStorageAccess): 68 (WebKit::WebsiteDataStore::grantStorageAccess): 69 (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction): 70 (WebKit::WebsiteDataStore::logUserInteraction): 71 (WebKit::WebsiteDataStore::hasHadUserInteraction): 72 (WebKit::WebsiteDataStore::clearUserInteraction): 73 (WebKit::WebsiteDataStore::setGrandfathered): 74 (WebKit::WebsiteDataStore::webProcessWillOpenConnection): 75 (WebKit::WebsiteDataStore::webProcessDidCloseConnection): 76 (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode): 77 (WebKit::WebsiteDataStore::didCreateNetworkProcess): 78 (WebKit::WebsiteDataStore::topPrivatelyControlledDomainsWithWebsiteData): Deleted. 79 (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains): Deleted. 80 (WebKit::WebsiteDataStore::setCacheMaxAgeCap): Deleted. 81 (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor): Deleted. 82 (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies): Deleted. 83 (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler): Deleted. 84 (WebKit::WebsiteDataStore::grantStorageAccessHandler): Deleted. 85 (WebKit::WebsiteDataStore::removeAllStorageAccessHandler): Deleted. 86 (WebKit::WebsiteDataStore::removePrevalentDomains): Deleted. 87 (WebKit::WebsiteDataStore::isGrandfathered): Deleted. 88 * UIProcess/WebsiteData/WebsiteDataStore.h: 89 1 90 2019-01-28 Antoine Quint <graouts@apple.com> 2 91 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r240498 r240586 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 898 898 #if ENABLE(RESOURCE_LOAD_STATISTICS) 899 899 RunLoop::main().dispatch([store = makeRef(m_store), seconds = m_parameters.clientSideCookiesAgeCapTime] () { 900 if (auto* websiteDataStore = store->websiteDataStore())901 websiteDataStore->setAgeCapForClientSideCookies(seconds, [] { });902 900 if (auto* networkSession = store->networkSession()) 903 901 networkSession->networkStorageSession().setAgeCapForClientSideCookies(seconds); -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r240498 r240586 44 44 #include "WebResourceLoadStatisticsTelemetry.h" 45 45 #include "WebsiteDataFetchOption.h" 46 #include "WebsiteDataStore.h"47 46 #include <WebCore/DiagnosticLoggingClient.h> 48 47 #include <WebCore/DiagnosticLoggingKeys.h> … … 139 138 } 140 139 141 WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(WebsiteDataStore& websiteDataStore)142 : m_websiteDataStore(makeWeakPtr(websiteDataStore))143 , m_statisticsQueue(WorkQueue::create("WebResourceLoadStatisticsStore Process Data Queue", WorkQueue::Type::Serial, WorkQueue::QOS::Utility))144 , m_dailyTasksTimer(RunLoop::main(), this, &WebResourceLoadStatisticsStore::performDailyTasks)145 {146 ASSERT(RunLoop::isMain());147 148 postTask([this, resourceLoadStatisticsDirectory = websiteDataStore.resolvedResourceLoadStatisticsDirectory().isolatedCopy()] {149 m_memoryStore = std::make_unique<ResourceLoadStatisticsMemoryStore>(*this, m_statisticsQueue);150 m_persistentStorage = std::make_unique<ResourceLoadStatisticsPersistentStorage>(*m_memoryStore, m_statisticsQueue, resourceLoadStatisticsDirectory);151 });152 153 m_dailyTasksTimer.startRepeating(24_h);154 }155 156 140 WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(NetworkSession& networkSession, const String& resourceLoadStatisticsDirectory) 157 141 : m_networkSession(makeWeakPtr(networkSession)) … … 222 206 postTaskReply(WTFMove(completionHandler)); 223 207 }); 224 }225 226 void WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode(const URL& url, CompletionHandler<void()>&& completionHandler)227 {228 ASSERT(RunLoop::isMain());229 230 setPrevalentResourceForDebugMode(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));231 208 } 232 209 … … 309 286 ASSERT(RunLoop::isMain()); 310 287 311 if (m_websiteDataStore) {312 m_websiteDataStore->hasStorageAccessForFrameHandler(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));313 return;314 }315 316 288 if (m_networkSession) { 317 289 callback(m_networkSession->networkStorageSession().hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID)); … … 404 376 ASSERT(RunLoop::isMain()); 405 377 406 if (m_websiteDataStore) {407 m_websiteDataStore->grantStorageAccessHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, WTFMove(callback));408 return;409 }410 411 378 callback(grantStorageAccess(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID)); 412 379 } … … 426 393 { 427 394 ASSERT(RunLoop::isMain()); 428 429 if (m_websiteDataStore) {430 m_websiteDataStore->removeAllStorageAccessHandler(WTFMove(completionHandler));431 return;432 }433 395 434 396 if (m_networkSession) … … 537 499 } 538 500 539 void WebResourceLoadStatisticsStore::logUserInteraction(const URL& url, CompletionHandler<void()>&& completionHandler)540 {541 ASSERT(RunLoop::isMain());542 543 if (url.protocolIsAbout() || url.isEmpty()) {544 completionHandler();545 return;546 }547 548 logUserInteraction(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));549 }550 551 501 void WebResourceLoadStatisticsStore::logUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&& completionHandler) 552 502 { … … 560 510 } 561 511 562 void WebResourceLoadStatisticsStore::clearUserInteraction(const URL& url, CompletionHandler<void()>&& completionHandler)563 {564 ASSERT(RunLoop::isMain());565 566 if (url.protocolIsAbout() || url.isEmpty()) {567 completionHandler();568 return;569 }570 571 clearUserInteraction(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));572 }573 574 512 void WebResourceLoadStatisticsStore::clearUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&& completionHandler) 575 513 { … … 581 519 postTaskReply(WTFMove(completionHandler)); 582 520 }); 583 }584 585 void WebResourceLoadStatisticsStore::hasHadUserInteraction(const URL& url, CompletionHandler<void (bool)>&& completionHandler)586 {587 ASSERT(RunLoop::isMain());588 589 if (url.protocolIsAbout() || url.isEmpty()) {590 completionHandler(false);591 return;592 }593 594 hasHadUserInteraction(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));595 521 } 596 522 … … 605 531 } 606 532 607 void WebResourceLoadStatisticsStore::setLastSeen(const URL& url, Seconds seconds, CompletionHandler<void()>&& completionHandler)608 {609 ASSERT(RunLoop::isMain());610 611 if (url.protocolIsAbout() || url.isEmpty()) {612 completionHandler();613 return;614 }615 616 setLastSeen(WebCore::ResourceLoadStatistics::primaryDomain(url), seconds, WTFMove(completionHandler));617 }618 619 533 void WebResourceLoadStatisticsStore::setLastSeen(const String& resourceDomain, Seconds seconds, CompletionHandler<void()>&& completionHandler) 620 534 { … … 628 542 } 629 543 630 void WebResourceLoadStatisticsStore::setPrevalentResource(const URL& url, CompletionHandler<void()>&& completionHandler)631 {632 ASSERT(RunLoop::isMain());633 634 if (url.protocolIsAbout() || url.isEmpty()) {635 completionHandler();636 return;637 }638 639 setPrevalentResource(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));640 }641 642 544 void WebResourceLoadStatisticsStore::setPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&& completionHandler) 643 545 { … … 649 551 postTaskReply(WTFMove(completionHandler)); 650 552 }); 651 }652 653 void WebResourceLoadStatisticsStore::setVeryPrevalentResource(const URL& url, CompletionHandler<void()>&& completionHandler)654 {655 ASSERT(RunLoop::isMain());656 657 if (url.protocolIsAbout() || url.isEmpty()) {658 completionHandler();659 return;660 }661 662 setVeryPrevalentResource(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));663 553 } 664 554 … … 686 576 } 687 577 688 void WebResourceLoadStatisticsStore::isPrevalentResource(const URL& url, CompletionHandler<void (bool)>&& completionHandler)689 {690 ASSERT(RunLoop::isMain());691 692 if (url.protocolIsAbout() || url.isEmpty()) {693 completionHandler(false);694 return;695 }696 697 isPrevalentResource(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));698 }699 700 578 void WebResourceLoadStatisticsStore::isPrevalentResource(const String& primaryDomain, CompletionHandler<void(bool)>&& completionHandler) 701 579 { … … 710 588 } 711 589 712 void WebResourceLoadStatisticsStore::isVeryPrevalentResource(const URL& url, CompletionHandler<void(bool)>&& completionHandler)713 {714 ASSERT(RunLoop::isMain());715 716 if (url.protocolIsAbout() || url.isEmpty()) {717 completionHandler(false);718 return;719 }720 721 isVeryPrevalentResource(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));722 }723 724 590 void WebResourceLoadStatisticsStore::isVeryPrevalentResource(const String& primaryDomain, CompletionHandler<void(bool)>&& completionHandler) 725 591 { … … 734 600 } 735 601 736 void WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder(const URL& subresource, const URL& topFrame, CompletionHandler<void(bool)>&& completionHandler)737 {738 ASSERT(RunLoop::isMain());739 740 isRegisteredAsSubresourceUnder(WebCore::ResourceLoadStatistics::primaryDomain(subresource), WebCore::ResourceLoadStatistics::primaryDomain(topFrame), WTFMove(completionHandler));741 }742 743 602 void WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder(const String& subresource, const String& topFrame, CompletionHandler<void(bool)>&& completionHandler) 744 603 { … … 753 612 } 754 613 755 void WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder(const URL& subFrame, const URL& topFrame, CompletionHandler<void (bool)>&& completionHandler)756 {757 ASSERT(RunLoop::isMain());758 759 isRegisteredAsSubFrameUnder(WebCore::ResourceLoadStatistics::primaryDomain(subFrame), WebCore::ResourceLoadStatistics::primaryDomain(topFrame), WTFMove(completionHandler));760 }761 762 614 void WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder(const String& subFrame, const String& topFrame, CompletionHandler<void(bool)>&& completionHandler) 763 615 { … … 772 624 } 773 625 774 void WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo(const URL& hostRedirectedFrom, const URL& hostRedirectedTo, CompletionHandler<void (bool)>&& completionHandler)775 {776 ASSERT(RunLoop::isMain());777 778 isRegisteredAsRedirectingTo(WebCore::ResourceLoadStatistics::primaryDomain(hostRedirectedFrom), WebCore::ResourceLoadStatistics::primaryDomain(hostRedirectedTo), WTFMove(completionHandler));779 }780 781 626 void WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo(const String& hostRedirectedFrom, const String& hostRedirectedTo, CompletionHandler<void(bool)>&& completionHandler) 782 627 { … … 791 636 } 792 637 793 void WebResourceLoadStatisticsStore::clearPrevalentResource(const URL& url, CompletionHandler<void()>&& completionHandler)794 {795 ASSERT(RunLoop::isMain());796 797 if (url.protocolIsAbout() || url.isEmpty()) {798 completionHandler();799 return;800 }801 802 clearPrevalentResource(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));803 }804 805 638 void WebResourceLoadStatisticsStore::clearPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&& completionHandler) 806 639 { … … 814 647 } 815 648 816 void WebResourceLoadStatisticsStore::setGrandfathered(const URL& url, bool value, CompletionHandler<void()>&& completionHandler)817 {818 ASSERT(RunLoop::isMain());819 820 if (url.protocolIsAbout() || url.isEmpty())821 return;822 823 setGrandfathered(WebCore::ResourceLoadStatistics::primaryDomain(url), value, WTFMove(completionHandler));824 }825 826 649 void WebResourceLoadStatisticsStore::setGrandfathered(const String& domain, bool value, CompletionHandler<void()>&& completionHandler) 827 650 { … … 835 658 } 836 659 837 void WebResourceLoadStatisticsStore::isGrandfathered(const URL& url, CompletionHandler<void (bool)>&& completionHandler)838 {839 ASSERT(RunLoop::isMain());840 841 if (url.protocolIsAbout() || url.isEmpty()) {842 completionHandler(false);843 return;844 }845 846 isGrandfathered(WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));847 }848 849 660 void WebResourceLoadStatisticsStore::isGrandfathered(const String& primaryDomain, CompletionHandler<void(bool)>&& completionHandler) 850 661 { … … 859 670 } 860 671 861 void WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame, CompletionHandler<void()>&& completionHandler)862 {863 ASSERT(RunLoop::isMain());864 865 if (subframe.protocolIsAbout() || subframe.isEmpty() || topFrame.protocolIsAbout() || topFrame.isEmpty()) {866 completionHandler();867 return;868 }869 870 setSubframeUnderTopFrameOrigin(WebCore::ResourceLoadStatistics::primaryDomain(subframe), WebCore::ResourceLoadStatistics::primaryDomain(topFrame), WTFMove(completionHandler));871 }872 873 672 void WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin(const String& subframe, const String& topFrame, CompletionHandler<void()>&& completionHandler) 874 673 { … … 882 681 } 883 682 884 void WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin(const URL& subresource, const URL& topFrame, CompletionHandler<void()>&& completionHandler)885 {886 ASSERT(RunLoop::isMain());887 888 if (subresource.protocolIsAbout() || subresource.isEmpty() || topFrame.protocolIsAbout() || topFrame.isEmpty()) {889 completionHandler();890 return;891 }892 893 setSubresourceUnderTopFrameOrigin(WebCore::ResourceLoadStatistics::primaryDomain(subresource), WebCore::ResourceLoadStatistics::primaryDomain(topFrame), WTFMove(completionHandler));894 }895 896 683 void WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin(const String& subresource, const String& topFrame, CompletionHandler<void()>&& completionHandler) 897 684 { … … 905 692 } 906 693 907 void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler)908 {909 ASSERT(RunLoop::isMain());910 911 if (subresource.protocolIsAbout() || subresource.isEmpty() || hostNameRedirectedTo.protocolIsAbout() || hostNameRedirectedTo.isEmpty()) {912 completionHandler();913 return;914 }915 916 setSubresourceUniqueRedirectTo(WebCore::ResourceLoadStatistics::primaryDomain(subresource), WebCore::ResourceLoadStatistics::primaryDomain(hostNameRedirectedTo), WTFMove(completionHandler));917 }918 919 694 void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo(const String& subresource, const String& hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler) 920 695 { … … 928 703 } 929 704 930 void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom(const URL& subresource, const URL& hostNameRedirectedFrom, CompletionHandler<void()>&& completionHandler)931 {932 ASSERT(RunLoop::isMain());933 934 if (subresource.protocolIsAbout() || subresource.isEmpty() || hostNameRedirectedFrom.protocolIsAbout() || hostNameRedirectedFrom.isEmpty()) {935 completionHandler();936 return;937 }938 939 setSubresourceUniqueRedirectFrom(WebCore::ResourceLoadStatistics::primaryDomain(subresource), WebCore::ResourceLoadStatistics::primaryDomain(hostNameRedirectedFrom), WTFMove(completionHandler));940 }941 942 705 void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom(const String& subresource, const String& hostNameRedirectedFrom, CompletionHandler<void()>&& completionHandler) 943 706 { … … 951 714 } 952 715 953 void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo(const URL& topFrameHostName, const URL& hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler)954 {955 ASSERT(RunLoop::isMain());956 957 if (topFrameHostName.protocolIsAbout() || topFrameHostName.isEmpty() || hostNameRedirectedTo.protocolIsAbout() || hostNameRedirectedTo.isEmpty()) {958 completionHandler();959 return;960 }961 962 setTopFrameUniqueRedirectTo(WebCore::ResourceLoadStatistics::primaryDomain(topFrameHostName), WebCore::ResourceLoadStatistics::primaryDomain(hostNameRedirectedTo), WTFMove(completionHandler));963 }964 965 716 void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo(const String& topFrameHostName, const String& hostNameRedirectedTo, CompletionHandler<void()>&& completionHandler) 966 717 { … … 972 723 postTaskReply(WTFMove(completionHandler)); 973 724 }); 974 }975 976 void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom(const URL& topFrameHostName, const URL& hostNameRedirectedFrom, CompletionHandler<void()>&& completionHandler)977 {978 ASSERT(RunLoop::isMain());979 980 if (topFrameHostName.protocolIsAbout() || topFrameHostName.isEmpty() || hostNameRedirectedFrom.protocolIsAbout() || hostNameRedirectedFrom.isEmpty()) {981 completionHandler();982 return;983 }984 985 setTopFrameUniqueRedirectFrom(WebCore::ResourceLoadStatistics::primaryDomain(topFrameHostName), WebCore::ResourceLoadStatistics::primaryDomain(hostNameRedirectedFrom), WTFMove(completionHandler));986 725 } 987 726 … … 1118 857 ASSERT(seconds >= 0_s); 1119 858 1120 if (m_websiteDataStore) {1121 m_websiteDataStore->setCacheMaxAgeCapForPrevalentResources(seconds, WTFMove(completionHandler));1122 return;1123 }1124 1125 859 if (m_networkSession) 1126 860 m_networkSession->networkStorageSession().setCacheMaxAgeCapForPrevalentResources(seconds); … … 1133 867 ASSERT(RunLoop::isMain()); 1134 868 1135 if (m_websiteDataStore) {1136 m_websiteDataStore->updatePrevalentDomainsToBlockCookiesFor(domainsToBlock, WTFMove(completionHandler));1137 return;1138 }1139 1140 869 if (m_networkSession) 1141 870 m_networkSession->networkStorageSession().setPrevalentDomainsToBlockCookiesFor(domainsToBlock); … … 1154 883 ASSERT(RunLoop::isMain()); 1155 884 1156 if (m_websiteDataStore)1157 m_websiteDataStore->removePrevalentDomains(domains);1158 885 removePrevalentDomains(domains); 1159 886 } … … 1197 924 { 1198 925 ASSERT(RunLoop::isMain()); 1199 1200 if (m_websiteDataStore) {1201 m_websiteDataStore->logTestingEvent(event);1202 return;1203 }1204 926 1205 927 if (m_networkSession) … … 1211 933 ASSERT(RunLoop::isMain()); 1212 934 1213 if (m_websiteDataStore)1214 WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed();1215 1216 935 if (m_networkSession) 1217 936 m_networkSession->notifyResourceLoadStatisticsProcessed(); … … 1222 941 ASSERT(RunLoop::isMain()); 1223 942 1224 if (m_websiteDataStore) {1225 WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(dataTypes, WTFMove(topPrivatelyControlledDomains), shouldNotifyPage, WTFMove(completionHandler));1226 return;1227 }1228 1229 943 if (m_networkSession) { 1230 944 m_networkSession->deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(dataTypes, WTFMove(topPrivatelyControlledDomains), shouldNotifyPage, WTFMove(completionHandler)); … … 1239 953 ASSERT(RunLoop::isMain()); 1240 954 1241 if (m_websiteDataStore) {1242 WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData(dataTypes, shouldNotifyPage, WTFMove(completionHandler));1243 return;1244 }1245 1246 955 if (m_networkSession) { 1247 956 m_networkSession->topPrivatelyControlledDomainsWithWebsiteData(dataTypes, shouldNotifyPage, WTFMove(completionHandler)); … … 1254 963 void WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue(const String& message, const String& description, unsigned value, unsigned sigDigits, WebCore::ShouldSample shouldSample) const 1255 964 { 1256 if (m_websiteDataStore) {1257 if (auto* webPageProxy = WebPageProxy::nonEphemeralWebPageProxy())1258 webPageProxy->logDiagnosticMessageWithValue(message, description, value, sigDigits, shouldSample);1259 }1260 1261 965 if (m_networkSession) 1262 966 const_cast<WebResourceLoadStatisticsStore*>(this)->networkSession()->logDiagnosticMessageWithValue(message, description, value, sigDigits, shouldSample); … … 1265 969 void WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins) const 1266 970 { 1267 if (m_websiteDataStore) {1268 API::Dictionary::MapType messageBody;1269 messageBody.set("TotalPrevalentResources"_s, API::UInt64::create(totalPrevalentResources));1270 messageBody.set("TotalPrevalentResourcesWithUserInteraction"_s, API::UInt64::create(totalPrevalentResourcesWithUserInteraction));1271 messageBody.set("Top3SubframeUnderTopFrameOrigins"_s, API::UInt64::create(top3SubframeUnderTopFrameOrigins));1272 WebProcessProxy::notifyPageStatisticsTelemetryFinished(API::Dictionary::create(messageBody).ptr());1273 }1274 1275 971 if (m_networkSession) 1276 972 const_cast<WebResourceLoadStatisticsStore*>(this)->networkSession()->notifyPageStatisticsTelemetryFinished(totalPrevalentResources, totalPrevalentResourcesWithUserInteraction, top3SubframeUnderTopFrameOrigins); -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h
r240498 r240586 56 56 class WebFrameProxy; 57 57 class WebProcessProxy; 58 class WebsiteDataStore;59 58 enum class ShouldGrandfatherStatistics : bool; 60 59 61 60 class WebResourceLoadStatisticsStore final : public ThreadSafeRefCounted<WebResourceLoadStatisticsStore, WTF::DestructionThread::Main>, public IPC::MessageReceiver { 62 61 public: 63 static Ref<WebResourceLoadStatisticsStore> create(WebsiteDataStore& websiteDataStore)64 {65 return adoptRef(*new WebResourceLoadStatisticsStore(websiteDataStore));66 }67 68 62 static Ref<WebResourceLoadStatisticsStore> create(NetworkSession& networkSession, const String& resourceLoadStatisticsDirectory) 69 63 { … … 90 84 void logFrameNavigation(const WebFrameProxy&, const URL& pageURL, const WebCore::ResourceRequest&, const URL& redirectURL); 91 85 void logFrameNavigation(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, const String& sourcePrimaryDomain, const String& targetHost, const String& mainFrameHost, bool isRedirect, bool isMainFrame); 92 void logUserInteraction(const URL&, CompletionHandler<void()>&&);93 86 void logUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&&); 94 87 void logWebSocketLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&&); 95 88 void logSubresourceLoading(const String& targetPrimaryDomain, const String& mainFramePrimaryDomain, WallTime lastSeen, CompletionHandler<void()>&&); 96 89 void logSubresourceRedirect(const String& sourcePrimaryDomain, const String& targetPrimaryDomain, CompletionHandler<void()>&&); 97 void clearUserInteraction(const URL&, CompletionHandler<void()>&&);98 90 void clearUserInteraction(const String& targetPrimaryDomain, CompletionHandler<void()>&&); 99 91 void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void(const HashSet<String>&)>&&); 100 92 void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&&); 101 93 bool grantStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID); 102 void hasHadUserInteraction(const URL&, CompletionHandler<void(bool)>&&);103 94 void hasHadUserInteraction(const String& resourceDomain, CompletionHandler<void(bool)>&&); 104 95 void hasStorageAccess(const String& subFrameHost, const String& topFrameHost, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback); … … 106 97 void requestStorageAccess(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&); 107 98 void requestUpdate(); 108 void setLastSeen(const URL&, Seconds, CompletionHandler<void()>&&);109 99 void setLastSeen(const String& resourceDomain, Seconds, CompletionHandler<void()>&&); 110 void setPrevalentResource(const URL&, CompletionHandler<void()>&&);111 100 void setPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&&); 112 void setVeryPrevalentResource(const URL&, CompletionHandler<void()>&&);113 101 void setVeryPrevalentResource(const String& resourceDomain, CompletionHandler<void()>&&); 114 102 void dumpResourceLoadStatistics(CompletionHandler<void(String)>&&); 115 void isPrevalentResource(const URL&, CompletionHandler<void(bool)>&&);116 103 void isPrevalentResource(const String&, CompletionHandler<void(bool)>&&); 117 void isVeryPrevalentResource(const URL&, CompletionHandler<void(bool)>&&);118 104 void isVeryPrevalentResource(const String&, CompletionHandler<void(bool)>&&); 119 void isRegisteredAsSubresourceUnder(const URL& subresource, const URL& topFrame, CompletionHandler<void(bool)>&&);120 105 void isRegisteredAsSubresourceUnder(const String& subresource, const String& topFrame, CompletionHandler<void(bool)>&&); 121 void isRegisteredAsSubFrameUnder(const URL& subFrame, const URL& topFrame, CompletionHandler<void(bool)>&&);122 106 void isRegisteredAsSubFrameUnder(const String& subFrame, const String& topFrame, CompletionHandler<void(bool)>&&); 123 void isRegisteredAsRedirectingTo(const URL& hostRedirectedFrom, const URL& hostRedirectedTo, CompletionHandler<void(bool)>&&);124 107 void isRegisteredAsRedirectingTo(const String& hostRedirectedFrom, const String& hostRedirectedTo, CompletionHandler<void(bool)>&&); 125 void clearPrevalentResource(const URL&, CompletionHandler<void()>&&);126 108 void clearPrevalentResource(const String&, CompletionHandler<void()>&&); 127 void setGrandfathered(const URL&, bool, CompletionHandler<void()>&&);128 109 void setGrandfathered(const String&, bool, CompletionHandler<void()>&&); 129 void isGrandfathered(const URL&, CompletionHandler<void(bool)>&&);130 110 void isGrandfathered(const String&, CompletionHandler<void(bool)>&&); 131 111 void removePrevalentDomains(const Vector<String>& domainsToBlock); 132 112 void setNotifyPagesWhenDataRecordsWereScanned(bool, CompletionHandler<void()>&&); 133 void setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame, CompletionHandler<void()>&&);134 113 void setSubframeUnderTopFrameOrigin(const String& subframe, const String& topFrame, CompletionHandler<void()>&&); 135 void setSubresourceUnderTopFrameOrigin(const URL& subresource, const URL& topFrame, CompletionHandler<void()>&&);136 114 void setSubresourceUnderTopFrameOrigin(const String& subresource, const String& topFrame, CompletionHandler<void()>&&); 137 void setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo, CompletionHandler<void()>&&);138 115 void setSubresourceUniqueRedirectTo(const String& subresource, const String& hostNameRedirectedTo, CompletionHandler<void()>&&); 139 void setSubresourceUniqueRedirectFrom(const URL& subresource, const URL& hostNameRedirectedFrom, CompletionHandler<void()>&&);140 116 void setSubresourceUniqueRedirectFrom(const String& subresource, const String& hostNameRedirectedFrom, CompletionHandler<void()>&&); 141 void setTopFrameUniqueRedirectTo(const URL& topFrameHostName, const URL& hostNameRedirectedTo, CompletionHandler<void()>&&);142 117 void setTopFrameUniqueRedirectTo(const String& topFrameHostName, const String& hostNameRedirectedTo, CompletionHandler<void()>&&); 143 void setTopFrameUniqueRedirectFrom(const URL& topFrameHostName, const URL& hostNameRedirectedFrom, CompletionHandler<void()>&&);144 118 void setTopFrameUniqueRedirectFrom(const String& topFrameHostName, const String& hostNameRedirectedFrom, CompletionHandler<void()>&&); 145 119 void scheduleCookieBlockingUpdate(CompletionHandler<void()>&&); … … 161 135 162 136 void setResourceLoadStatisticsDebugMode(bool, CompletionHandler<void()>&&); 163 void setPrevalentResourceForDebugMode(const URL&, CompletionHandler<void()>&&);164 137 void setPrevalentResourceForDebugMode(const String& resourceDomain, CompletionHandler<void()>&&); 165 138 … … 175 148 void notifyResourceLoadStatisticsProcessed(); 176 149 177 WebsiteDataStore* websiteDataStore() { return m_websiteDataStore.get(); }178 150 NetworkSession* networkSession() { return m_networkSession.get(); } 179 151 … … 182 154 183 155 private: 184 explicit WebResourceLoadStatisticsStore(WebsiteDataStore&);185 156 explicit WebResourceLoadStatisticsStore(NetworkSession&, const String&); 186 157 … … 201 172 void flushAndDestroyPersistentStore(); 202 173 203 WeakPtr<WebsiteDataStore> m_websiteDataStore;204 174 WeakPtr<NetworkSession> m_networkSession; 205 175 Ref<WorkQueue> m_statisticsQueue; -
trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp
r240243 r240586 286 286 287 287 #if ENABLE(RESOURCE_LOAD_STATISTICS) 288 void WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void (const HashSet<String>&)>&& completionHandler)289 {290 // We expect this to be called on the main thread so we get the default website data store.291 ASSERT(isMainThreadOrCheckDisabled());292 293 struct CallbackAggregator : ThreadSafeRefCounted<CallbackAggregator> {294 explicit CallbackAggregator(CompletionHandler<void(HashSet<String>)>&& completionHandler)295 : completionHandler(WTFMove(completionHandler))296 {297 }298 void addDomainsWithDeletedWebsiteData(const HashSet<String>& domains)299 {300 domainsWithDeletedWebsiteData.add(domains.begin(), domains.end());301 }302 303 void addPendingCallback()304 {305 ++pendingCallbacks;306 }307 308 void removePendingCallback()309 {310 ASSERT(pendingCallbacks);311 --pendingCallbacks;312 313 callIfNeeded();314 }315 316 void callIfNeeded()317 {318 if (!pendingCallbacks)319 completionHandler(domainsWithDeletedWebsiteData);320 }321 322 unsigned pendingCallbacks = 0;323 CompletionHandler<void(HashSet<String>)> completionHandler;324 HashSet<String> domainsWithDeletedWebsiteData;325 };326 327 RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(WTFMove(completionHandler)));328 OptionSet<WebsiteDataFetchOption> fetchOptions = WebsiteDataFetchOption::DoNotCreateProcesses;329 330 HashSet<PAL::SessionID> visitedSessionIDs;331 for (auto& page : globalPageMap()) {332 auto& dataStore = page.value->websiteDataStore();333 if (!dataStore.isPersistent() || visitedSessionIDs.contains(dataStore.sessionID()))334 continue;335 visitedSessionIDs.add(dataStore.sessionID());336 callbackAggregator->addPendingCallback();337 dataStore.removeDataForTopPrivatelyControlledDomains(dataTypes, fetchOptions, topPrivatelyControlledDomains, [callbackAggregator, shouldNotifyPage, page](HashSet<String>&& domainsWithDeletedWebsiteData) {338 // When completing the task, we should be getting called on the main thread.339 ASSERT(isMainThreadOrCheckDisabled());340 341 if (shouldNotifyPage)342 page.value->postMessageToInjectedBundle("WebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished", nullptr);343 344 callbackAggregator->addDomainsWithDeletedWebsiteData(WTFMove(domainsWithDeletedWebsiteData));345 callbackAggregator->removePendingCallback();346 });347 }348 }349 350 void WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&& completionHandler)351 {352 // We expect this to be called on the main thread so we get the default website data store.353 ASSERT(isMainThreadOrCheckDisabled());354 355 struct CallbackAggregator : ThreadSafeRefCounted<CallbackAggregator> {356 explicit CallbackAggregator(CompletionHandler<void(HashSet<String>&&)>&& completionHandler)357 : completionHandler(WTFMove(completionHandler))358 {359 }360 361 void addDomainsWithDeletedWebsiteData(HashSet<String>&& domains)362 {363 domainsWithDeletedWebsiteData.add(domains.begin(), domains.end());364 }365 366 void addPendingCallback()367 {368 ++pendingCallbacks;369 }370 371 void removePendingCallback()372 {373 ASSERT(pendingCallbacks);374 --pendingCallbacks;375 376 callIfNeeded();377 }378 379 void callIfNeeded()380 {381 if (!pendingCallbacks)382 completionHandler(WTFMove(domainsWithDeletedWebsiteData));383 }384 385 unsigned pendingCallbacks = 0;386 CompletionHandler<void(HashSet<String>&&)> completionHandler;387 HashSet<String> domainsWithDeletedWebsiteData;388 };389 390 RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(WTFMove(completionHandler)));391 392 HashSet<PAL::SessionID> visitedSessionIDs;393 for (auto& page : globalPageMap().values()) {394 auto& dataStore = page->websiteDataStore();395 if (!dataStore.isPersistent() || visitedSessionIDs.contains(dataStore.sessionID()))396 continue;397 visitedSessionIDs.add(dataStore.sessionID());398 callbackAggregator->addPendingCallback();399 dataStore.topPrivatelyControlledDomainsWithWebsiteData(dataTypes, { }, [callbackAggregator, shouldNotifyPage, page = makeRef(*page)](HashSet<String>&& domainsWithDataRecords) {400 // When completing the task, we should be getting called on the main thread.401 ASSERT(isMainThreadOrCheckDisabled());402 403 if (shouldNotifyPage)404 page->postMessageToInjectedBundle("WebsiteDataScanForTopPrivatelyControlledDomainsFinished", nullptr);405 406 callbackAggregator->addDomainsWithDeletedWebsiteData(WTFMove(domainsWithDataRecords));407 callbackAggregator->removePendingCallback();408 });409 }410 411 // FIXME: It's bizarre that this call is on WebProcessProxy and that it doesn't work if there are no visited pages.412 // This should actually be a function of WebsiteDataStore and it should work even if there are no WebViews instances.413 callbackAggregator->callIfNeeded();414 }415 416 288 void WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed() 417 289 { -
trunk/Source/WebKit/UIProcess/WebProcessProxy.h
r240243 r240586 174 174 175 175 #if ENABLE(RESOURCE_LOAD_STATISTICS) 176 static void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPages, CompletionHandler<void (const HashSet<String>&)>&&);177 static void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&&);178 179 176 static void notifyPageStatisticsAndDataRecordsProcessed(); 180 177 static void notifyPageStatisticsTelemetryFinished(API::Object* messageBody); -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r240555 r240586 143 143 platformDestroy(); 144 144 145 #if ENABLE(RESOURCE_LOAD_STATISTICS)146 unregisterWebResourceLoadStatisticsStoreAsMessageReceiver();147 #endif148 149 145 if (m_sessionID.isValid() && m_sessionID != PAL::SessionID::defaultSessionID()) { 150 146 ASSERT(nonDefaultDataStores().get(m_sessionID) == this); … … 650 646 }); 651 647 } 652 653 void WebsiteDataStore::topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void(HashSet<String>&&)>&& completionHandler)654 {655 fetchData(dataTypes, fetchOptions, [completionHandler = WTFMove(completionHandler), protectedThis = makeRef(*this)](auto&& existingDataRecords) {656 HashSet<String> domainsWithDataRecords;657 for (auto&& dataRecord : existingDataRecords) {658 String domain = dataRecord.topPrivatelyControlledDomain();659 if (domain.isEmpty())660 continue;661 domainsWithDataRecords.add(WTFMove(domain));662 }663 completionHandler(WTFMove(domainsWithDataRecords));664 });665 }666 648 #endif 667 649 … … 950 932 #if ENABLE(RESOURCE_LOAD_STATISTICS) 951 933 if (dataTypes.contains(WebsiteDataType::ResourceLoadStatistics)) { 952 auto deletedTypesRaw = dataTypes.toRaw(); 953 auto monitoredTypesRaw = WebResourceLoadStatisticsStore::monitoredDataTypes().toRaw(); 954 955 // If we are deleting all of the data types that the resource load statistics store monitors 956 // we do not need to re-grandfather old data. 957 auto shouldGrandfather = ((monitoredTypesRaw & deletedTypesRaw) == monitoredTypesRaw) ? ShouldGrandfatherStatistics::No : ShouldGrandfatherStatistics::Yes; 958 959 if (m_resourceLoadStatistics) { 960 callbackAggregator->addPendingCallback(); 961 m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, shouldGrandfather, [callbackAggregator] { 962 callbackAggregator->removePendingCallback(); 963 }); 964 } else if (!didNotifyNetworkProcessToDeleteWebsiteData) { 934 if (!didNotifyNetworkProcessToDeleteWebsiteData) { 965 935 for (auto& processPool : processPools()) { 966 936 if (auto* process = processPool->networkProcess()) { … … 1254 1224 #endif 1255 1225 1256 #if ENABLE(RESOURCE_LOAD_STATISTICS)1257 // FIXME <rdar://problem/33491222>; scheduleClearInMemoryAndPersistent does not have a completion handler,1258 // so the completion handler for this removeData() call can be called prematurely.1259 if (dataTypes.contains(WebsiteDataType::ResourceLoadStatistics) && m_resourceLoadStatistics) {1260 auto deletedTypesRaw = dataTypes.toRaw();1261 auto monitoredTypesRaw = WebResourceLoadStatisticsStore::monitoredDataTypes().toRaw();1262 1263 // If we are deleting all of the data types that the resource load statistics store monitors1264 // we do not need to re-grandfather old data.1265 auto shouldGrandfather = ((monitoredTypesRaw & deletedTypesRaw) == monitoredTypesRaw) ? ShouldGrandfatherStatistics::No : ShouldGrandfatherStatistics::Yes;1266 1267 callbackAggregator->addPendingCallback();1268 m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(shouldGrandfather, [callbackAggregator] {1269 callbackAggregator->removePendingCallback();1270 });1271 1272 callbackAggregator->addPendingCallback();1273 clearResourceLoadStatisticsInWebProcesses([callbackAggregator] {1274 callbackAggregator->removePendingCallback();1275 });1276 }1277 #endif1278 1279 1226 // There's a chance that we don't have any pending callbacks. If so, we want to dispatch the completion handler right away. 1280 1227 callbackAggregator->callIfNeeded(); … … 1282 1229 1283 1230 #if ENABLE(RESOURCE_LOAD_STATISTICS) 1284 void WebsiteDataStore::removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, const Vector<String>& topPrivatelyControlledDomains, Function<void(HashSet<String>&&)>&& completionHandler)1285 {1286 fetchDataForTopPrivatelyControlledDomains(dataTypes, fetchOptions, topPrivatelyControlledDomains, [dataTypes, completionHandler = WTFMove(completionHandler), this, protectedThis = makeRef(*this)](Vector<WebsiteDataRecord>&& websiteDataRecords, HashSet<String>&& domainsWithDataRecords) mutable {1287 this->removeData(dataTypes, websiteDataRecords, [domainsWithDataRecords = WTFMove(domainsWithDataRecords), completionHandler = WTFMove(completionHandler)]() mutable {1288 completionHandler(WTFMove(domainsWithDataRecords));1289 });1290 });1291 }1292 1293 1231 void WebsiteDataStore::setMaxStatisticsEntries(size_t maximumEntryCount, CompletionHandler<void()>&& completionHandler) 1294 1232 { 1295 1233 ASSERT(RunLoop::isMain()); 1296 1234 1297 if (m_resourceLoadStatistics) {1298 m_resourceLoadStatistics->setMaxStatisticsEntries(maximumEntryCount, WTFMove(completionHandler));1299 return;1300 }1301 1302 1235 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1303 1236 … … 1310 1243 ASSERT(RunLoop::isMain()); 1311 1244 1312 if (m_resourceLoadStatistics) {1313 m_resourceLoadStatistics->setPruneEntriesDownTo(pruneTargetCount, WTFMove(completionHandler));1314 return;1315 }1316 1317 1245 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1318 1246 … … 1326 1254 ASSERT(RunLoop::isMain()); 1327 1255 1328 if (m_resourceLoadStatistics) {1329 m_resourceLoadStatistics->setGrandfatheringTime(seconds, WTFMove(completionHandler));1330 return;1331 }1332 1333 1256 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1334 1257 … … 1337 1260 } 1338 1261 1339 void WebsiteDataStore::setCacheMaxAgeCap(Seconds seconds, CompletionHandler<void()>&& completionHandler)1340 {1341 ASSERT(RunLoop::isMain());1342 ASSERT(seconds >= 0_s);1343 1344 if (m_resourceLoadStatistics) {1345 setCacheMaxAgeCap(seconds, WTFMove(completionHandler));1346 return;1347 }1348 1349 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));1350 1351 for (auto& processPool : processPools())1352 processPool->ensureNetworkProcess().setCacheMaxAgeCap(m_sessionID, seconds, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });1353 }1354 1355 1262 void WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval(Seconds seconds, CompletionHandler<void()>&& completionHandler) 1356 1263 { 1357 1264 ASSERT(RunLoop::isMain()); 1358 1265 1359 if (m_resourceLoadStatistics) {1360 m_resourceLoadStatistics->setMinimumTimeBetweenDataRecordsRemoval(seconds, WTFMove(completionHandler));1361 return;1362 }1363 1364 1266 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1365 1267 … … 1372 1274 ASSERT(RunLoop::isMain()); 1373 1275 1374 if (m_resourceLoadStatistics) {1375 m_resourceLoadStatistics->dumpResourceLoadStatistics(WTFMove(completionHandler));1376 return;1377 }1378 1379 1276 for (auto& processPool : processPools()) { 1380 1277 if (auto* process = processPool->networkProcess()) { … … 1395 1292 } 1396 1293 1397 if (m_resourceLoadStatistics) {1398 m_resourceLoadStatistics->isPrevalentResource(url, WTFMove(completionHandler));1399 return;1400 }1401 1402 1294 for (auto& processPool : processPools()) { 1403 1295 if (auto* process = processPool->networkProcess()) { … … 1418 1310 } 1419 1311 1420 if (m_resourceLoadStatistics) {1421 m_resourceLoadStatistics->setPrevalentResource(url, WTFMove(completionHandler));1422 return;1423 }1424 1425 1312 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1426 1313 … … 1439 1326 } 1440 1327 1441 if (m_resourceLoadStatistics) {1442 m_resourceLoadStatistics->setPrevalentResourceForDebugMode(url, WTFMove(completionHandler));1443 return;1444 }1445 1446 1328 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1447 1329 … … 1458 1340 if (url.protocolIsAbout() || url.isEmpty()) { 1459 1341 completionHandler(false); 1460 return;1461 }1462 1463 if (m_resourceLoadStatistics) {1464 m_resourceLoadStatistics->isVeryPrevalentResource(url, WTFMove(completionHandler));1465 1342 return; 1466 1343 } … … 1484 1361 } 1485 1362 1486 if (m_resourceLoadStatistics) {1487 m_resourceLoadStatistics->setVeryPrevalentResource(url, WTFMove(completionHandler));1488 return;1489 }1490 1491 1363 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1492 1364 … … 1501 1373 ASSERT(RunLoop::isMain()); 1502 1374 1503 if (m_resourceLoadStatistics) {1504 m_resourceLoadStatistics->setShouldClassifyResourcesBeforeDataRecordsRemoval(value, WTFMove(completionHandler));1505 return;1506 }1507 1508 1375 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1509 1376 … … 1521 1388 } 1522 1389 1523 if (m_resourceLoadStatistics) {1524 m_resourceLoadStatistics->setSubframeUnderTopFrameOrigin(subframe, topFrame, WTFMove(completionHandler));1525 return;1526 }1527 1528 1390 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1529 1391 … … 1538 1400 ASSERT(RunLoop::isMain()); 1539 1401 1540 if (m_resourceLoadStatistics) {1541 m_resourceLoadStatistics->isRegisteredAsSubFrameUnder(subFrame, topFrame, WTFMove(completionHandler));1542 return;1543 }1544 1545 1402 for (auto& processPool : processPools()) { 1546 1403 if (auto* process = processPool->networkProcess()) { … … 1561 1418 } 1562 1419 1563 if (m_resourceLoadStatistics) {1564 m_resourceLoadStatistics->setSubresourceUnderTopFrameOrigin(subresource, topFrame, WTFMove(completionHandler));1565 return;1566 }1567 1568 1420 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1569 1421 … … 1578 1430 ASSERT(RunLoop::isMain()); 1579 1431 1580 if (m_resourceLoadStatistics) {1581 m_resourceLoadStatistics->isRegisteredAsSubresourceUnder(subresource, topFrame, WTFMove(completionHandler));1582 return;1583 }1584 1585 1432 for (auto& processPool : processPools()) { 1586 1433 if (auto* process = processPool->networkProcess()) { … … 1601 1448 } 1602 1449 1603 if (m_resourceLoadStatistics) {1604 m_resourceLoadStatistics->setSubresourceUniqueRedirectTo(subresource, hostNameRedirectedTo, WTFMove(completionHandler));1605 return;1606 }1607 1608 1450 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1609 1451 … … 1623 1465 } 1624 1466 1625 if (m_resourceLoadStatistics) {1626 m_resourceLoadStatistics->setSubresourceUniqueRedirectFrom(subresource, hostNameRedirectedFrom, WTFMove(completionHandler));1627 return;1628 }1629 1630 1467 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1631 1468 … … 1645 1482 } 1646 1483 1647 if (m_resourceLoadStatistics) {1648 m_resourceLoadStatistics->setTopFrameUniqueRedirectTo(topFrameHostName, hostNameRedirectedTo, WTFMove(completionHandler));1649 return;1650 }1651 1652 1484 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1653 1485 … … 1667 1499 } 1668 1500 1669 if (m_resourceLoadStatistics) {1670 m_resourceLoadStatistics->setTopFrameUniqueRedirectFrom(topFrameHostName, hostNameRedirectedFrom, WTFMove(completionHandler));1671 return;1672 }1673 1674 1501 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1675 1502 … … 1684 1511 ASSERT(RunLoop::isMain()); 1685 1512 1686 if (m_resourceLoadStatistics) {1687 m_resourceLoadStatistics->isRegisteredAsRedirectingTo(hostRedirectedFrom, hostRedirectedTo, WTFMove(completionHandler));1688 return;1689 }1690 1691 1513 for (auto& processPool : processPools()) { 1692 1514 if (auto* process = processPool->networkProcess()) { … … 1707 1529 } 1708 1530 1709 if (m_resourceLoadStatistics) {1710 m_resourceLoadStatistics->clearPrevalentResource(url, WTFMove(completionHandler));1711 return;1712 }1713 1714 1531 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1715 1532 … … 1725 1542 ASSERT(RunLoop::isMain()); 1726 1543 1727 if (m_resourceLoadStatistics) {1728 m_resourceLoadStatistics->resetParametersToDefaultValues(WTFMove(completionHandler));1729 return;1730 }1731 1732 1544 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1733 1545 … … 1742 1554 ASSERT(RunLoop::isMain()); 1743 1555 1744 if (m_resourceLoadStatistics) {1745 m_resourceLoadStatistics->submitTelemetry([] { });1746 return;1747 }1748 1749 1556 for (auto& processPool : processPools()) { 1750 1557 if (auto* process = processPool->networkProcess()) … … 1757 1564 ASSERT(RunLoop::isMain()); 1758 1565 1759 if (m_resourceLoadStatistics) {1760 m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(modifiedSince, shouldGrandfather, WTFMove(completionHandler));1761 return;1762 }1763 1764 1566 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1765 1567 … … 1774 1576 ASSERT(RunLoop::isMain()); 1775 1577 1776 if (m_resourceLoadStatistics) {1777 m_resourceLoadStatistics->scheduleClearInMemoryAndPersistent(shouldGrandfather, WTFMove(completionHandler));1778 return;1779 }1780 1781 1578 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1782 1579 … … 1789 1586 void WebsiteDataStore::scheduleCookieBlockingUpdate(CompletionHandler<void()>&& completionHandler) 1790 1587 { 1791 if (m_resourceLoadStatistics) {1792 m_resourceLoadStatistics->scheduleCookieBlockingUpdate(WTFMove(completionHandler));1793 return;1794 }1795 1796 1588 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1797 1589 … … 1806 1598 ASSERT(RunLoop::isMain()); 1807 1599 1808 if (m_resourceLoadStatistics) {1809 m_resourceLoadStatistics->scheduleStatisticsAndDataRecordsProcessing(WTFMove(completionHandler));1810 return;1811 }1812 1813 1600 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1814 1601 … … 1819 1606 } 1820 1607 1821 #if ENABLE(RESOURCE_LOAD_STATISTICS)1822 void WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor(const Vector<String>& domainsToBlock, CompletionHandler<void()>&& completionHandler)1823 {1824 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));1825 1826 for (auto& processPool : processPools()) {1827 if (auto* process = processPool->networkProcess())1828 process->updatePrevalentDomainsToBlockCookiesFor(m_sessionID, domainsToBlock, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });1829 }1830 }1831 #endif1832 1833 void WebsiteDataStore::setAgeCapForClientSideCookies(Optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler)1834 {1835 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));1836 1837 for (auto& processPool : processPools())1838 processPool->ensureNetworkProcess().setAgeCapForClientSideCookies(m_sessionID, seconds, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });1839 }1840 1841 1608 void WebsiteDataStore::setLastSeen(const URL& url, Seconds seconds, CompletionHandler<void()>&& completionHandler) 1842 1609 { … … 1846 1613 } 1847 1614 1848 if (m_resourceLoadStatistics) {1849 m_resourceLoadStatistics->setLastSeen(url, seconds, WTFMove(completionHandler));1850 return;1851 }1852 1853 1615 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1854 1616 … … 1862 1624 void WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned(bool value, CompletionHandler<void()>&& completionHandler) 1863 1625 { 1864 if (m_resourceLoadStatistics) {1865 m_resourceLoadStatistics->setNotifyPagesWhenDataRecordsWereScanned(value, WTFMove(completionHandler));1866 return;1867 }1868 1869 1626 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1870 1627 … … 1875 1632 void WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured(bool value, CompletionHandler<void()>&& completionHandler) 1876 1633 { 1877 if (m_resourceLoadStatistics) {1878 m_resourceLoadStatistics->setNotifyPagesWhenTelemetryWasCaptured(value, WTFMove(completionHandler));1879 return;1880 }1881 1882 1634 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 1883 1635 … … 1886 1638 } 1887 1639 1888 void WebsiteDataStore::hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool hasAccess)>&& completionHandler) 1889 { 1640 void WebsiteDataStore::getAllStorageAccessEntries(uint64_t pageID, CompletionHandler<void(Vector<String>&& domains)>&& completionHandler) 1641 { 1642 auto* webPage = WebProcessProxy::webPage(pageID); 1643 if (!webPage) { 1644 completionHandler({ }); 1645 return; 1646 } 1647 1648 auto& networkProcess = webPage->process().processPool().ensureNetworkProcess(); 1649 networkProcess.getAllStorageAccessEntries(m_sessionID, WTFMove(completionHandler)); 1650 } 1651 1652 void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) 1653 { 1654 if (!resourceLoadStatisticsEnabled()) { 1655 completionHandler(false); 1656 return; 1657 } 1658 1890 1659 auto* webPage = WebProcessProxy::webPage(pageID); 1891 1660 if (!webPage) { … … 1894 1663 } 1895 1664 1896 auto& networkProcess = webPage->process().processPool().ensureNetworkProcess(); 1897 networkProcess.hasStorageAccessForFrame(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(completionHandler)); 1898 } 1899 1900 void WebsiteDataStore::getAllStorageAccessEntries(uint64_t pageID, CompletionHandler<void(Vector<String>&& domains)>&& completionHandler) 1901 { 1665 if (auto networkProcess = webPage->process().processPool().networkProcess()) 1666 networkProcess->hasStorageAccess(m_sessionID, WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(completionHandler)); 1667 } 1668 1669 void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler) 1670 { 1671 if (!resourceLoadStatisticsEnabled()) { 1672 completionHandler(StorageAccessStatus::CannotRequestAccess); 1673 return; 1674 } 1675 1902 1676 auto* webPage = WebProcessProxy::webPage(pageID); 1903 1677 if (!webPage) { 1904 completionHandler({ }); 1905 return; 1906 } 1907 1908 auto& networkProcess = webPage->process().processPool().ensureNetworkProcess(); 1909 networkProcess.getAllStorageAccessEntries(m_sessionID, WTFMove(completionHandler)); 1910 } 1911 1912 void WebsiteDataStore::grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool wasGranted)>&& completionHandler) 1913 { 1678 completionHandler(StorageAccessStatus::CannotRequestAccess); 1679 return; 1680 } 1681 1682 if (auto networkProcess = webPage->process().processPool().networkProcess()) 1683 networkProcess->requestStorageAccess(m_sessionID, WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, promptEnabled, WTFMove(completionHandler)); 1684 } 1685 1686 void WebsiteDataStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler) 1687 { 1688 if (!resourceLoadStatisticsEnabled()) { 1689 completionHandler(false); 1690 return; 1691 } 1692 1914 1693 auto* webPage = WebProcessProxy::webPage(pageID); 1915 1694 if (!webPage) { … … 1918 1697 } 1919 1698 1920 auto& networkProcess = webPage->process().processPool().ensureNetworkProcess();1921 networkProcess.grantStorageAccess(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, false, WTFMove(completionHandler));1922 }1923 1924 void WebsiteDataStore::removeAllStorageAccessHandler(CompletionHandler<void()>&& completionHandler)1925 {1926 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));1927 1928 for (auto& processPool : processPools()) {1929 if (auto networkProcess = processPool->networkProcess())1930 networkProcess->removeAllStorageAccess(m_sessionID, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });1931 }1932 }1933 1934 void WebsiteDataStore::removePrevalentDomains(const Vector<String>& domains)1935 {1936 for (auto& processPool : processPools())1937 processPool->sendToNetworkingProcess(Messages::NetworkProcess::RemovePrevalentDomains(m_sessionID, domains));1938 }1939 1940 void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)1941 {1942 if (!resourceLoadStatisticsEnabled()) {1943 completionHandler(false);1944 return;1945 }1946 1947 if (m_resourceLoadStatistics) {1948 m_resourceLoadStatistics->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(completionHandler));1949 return;1950 }1951 1952 auto* webPage = WebProcessProxy::webPage(pageID);1953 if (!webPage) {1954 completionHandler(false);1955 return;1956 }1957 1958 if (auto networkProcess = webPage->process().processPool().networkProcess())1959 networkProcess->hasStorageAccess(m_sessionID, WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(completionHandler));1960 }1961 1962 void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)1963 {1964 if (!resourceLoadStatisticsEnabled()) {1965 completionHandler(StorageAccessStatus::CannotRequestAccess);1966 return;1967 }1968 1969 if (m_resourceLoadStatistics) {1970 m_resourceLoadStatistics->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, promptEnabled, WTFMove(completionHandler));1971 return;1972 }1973 1974 auto* webPage = WebProcessProxy::webPage(pageID);1975 if (!webPage) {1976 completionHandler(StorageAccessStatus::CannotRequestAccess);1977 return;1978 }1979 1980 if (auto networkProcess = webPage->process().processPool().networkProcess())1981 networkProcess->requestStorageAccess(m_sessionID, WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, promptEnabled, WTFMove(completionHandler));1982 }1983 1984 void WebsiteDataStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)1985 {1986 if (!resourceLoadStatisticsEnabled()) {1987 completionHandler(false);1988 return;1989 }1990 1991 if (m_resourceLoadStatistics) {1992 m_resourceLoadStatistics->grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(completionHandler));1993 return;1994 }1995 1996 auto* webPage = WebProcessProxy::webPage(pageID);1997 if (!webPage) {1998 completionHandler(false);1999 return;2000 }2001 2002 1699 if (auto networkProcess = webPage->process().processPool().networkProcess()) 2003 1700 networkProcess->grantStorageAccess(m_sessionID, WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(completionHandler)); … … 2006 1703 void WebsiteDataStore::setTimeToLiveUserInteraction(Seconds seconds, CompletionHandler<void()>&& completionHandler) 2007 1704 { 2008 if (m_resourceLoadStatistics) {2009 m_resourceLoadStatistics->setTimeToLiveUserInteraction(seconds, WTFMove(completionHandler));2010 return;2011 }2012 2013 1705 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 2014 1706 … … 2026 1718 } 2027 1719 2028 if (m_resourceLoadStatistics) {2029 m_resourceLoadStatistics->logUserInteraction(url, WTFMove(completionHandler));2030 return;2031 }2032 2033 1720 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 2034 1721 … … 2045 1732 if (url.protocolIsAbout() || url.isEmpty()) { 2046 1733 completionHandler(false); 2047 return;2048 }2049 2050 if (m_resourceLoadStatistics) {2051 m_resourceLoadStatistics->hasHadUserInteraction(url, WTFMove(completionHandler));2052 1734 return; 2053 1735 } … … 2071 1753 } 2072 1754 2073 if (m_resourceLoadStatistics) {2074 m_resourceLoadStatistics->clearUserInteraction(url, WTFMove(completionHandler));2075 return;2076 }2077 2078 1755 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 2079 1756 … … 2084 1761 } 2085 1762 2086 void WebsiteDataStore::isGrandfathered(const URL& url, CompletionHandler<void(bool)>&& completionHandler)2087 {2088 ASSERT(RunLoop::isMain());2089 2090 if (url.protocolIsAbout() || url.isEmpty()) {2091 completionHandler(false);2092 return;2093 }2094 2095 if (m_resourceLoadStatistics) {2096 m_resourceLoadStatistics->isGrandfathered(url, WTFMove(completionHandler));2097 return;2098 }2099 2100 for (auto& processPool : processPools()) {2101 if (auto* process = processPool->networkProcess()) {2102 process->isGrandfathered(m_sessionID, WebCore::ResourceLoadStatistics::primaryDomain(url), WTFMove(completionHandler));2103 ASSERT(processPools().size() == 1);2104 break;2105 }2106 }2107 }2108 2109 1763 void WebsiteDataStore::setGrandfathered(const URL& url, bool isGrandfathered, CompletionHandler<void()>&& completionHandler) 2110 1764 { … … 2113 1767 if (url.protocolIsAbout() || url.isEmpty()) { 2114 1768 completionHandler(); 2115 return;2116 }2117 2118 if (m_resourceLoadStatistics) {2119 m_resourceLoadStatistics->setGrandfathered(url, isGrandfathered, WTFMove(completionHandler));2120 1769 return; 2121 1770 } … … 2173 1822 if (m_storageManager) 2174 1823 m_storageManager->processWillOpenConnection(webProcessProxy, connection); 2175 2176 #if ENABLE(RESOURCE_LOAD_STATISTICS)2177 if (m_resourceLoadStatistics)2178 webProcessProxy.addMessageReceiver(Messages::WebResourceLoadStatisticsStore::messageReceiverName(), *m_resourceLoadStatistics);2179 #endif2180 1824 } 2181 1825 … … 2194 1838 void WebsiteDataStore::webProcessDidCloseConnection(WebProcessProxy& webProcessProxy, IPC::Connection& connection) 2195 1839 { 2196 #if ENABLE(RESOURCE_LOAD_STATISTICS)2197 if (m_resourceLoadStatistics)2198 webProcessProxy.removeMessageReceiver(Messages::WebResourceLoadStatisticsStore::messageReceiverName());2199 #endif2200 2201 1840 if (m_storageManager) 2202 1841 m_storageManager->processDidCloseConnection(webProcessProxy, connection); … … 2355 1994 #if ENABLE(RESOURCE_LOAD_STATISTICS) 2356 1995 m_resourceLoadStatisticsDebugMode = enabled; 2357 if (m_resourceLoadStatistics) { 2358 m_resourceLoadStatistics->setResourceLoadStatisticsDebugMode(enabled, WTFMove(completionHandler)); 2359 return; 2360 } 2361 1996 2362 1997 auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); 2363 1998 … … 2371 2006 2372 2007 #if ENABLE(RESOURCE_LOAD_STATISTICS) 2373 void WebsiteDataStore::unregisterWebResourceLoadStatisticsStoreAsMessageReceiver()2374 {2375 if (!m_resourceLoadStatistics)2376 return;2377 2378 for (auto* webProcessProxy : processes())2379 webProcessProxy->removeMessageReceiver(Messages::WebResourceLoadStatisticsStore::messageReceiverName());2380 }2381 2382 void WebsiteDataStore::registerWebResourceLoadStatisticsStoreAsMessageReceiver()2383 {2384 ASSERT(m_resourceLoadStatistics);2385 if (!m_resourceLoadStatistics)2386 return;2387 2388 for (auto* webProcessProxy : processes())2389 webProcessProxy->addMessageReceiver(Messages::WebResourceLoadStatisticsStore::messageReceiverName(), *m_resourceLoadStatistics);2390 }2391 2392 2008 void WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback(Function<void (const String&)>&& callback) 2393 2009 { … … 2492 2108 void WebsiteDataStore::didCreateNetworkProcess() 2493 2109 { 2494 #if ENABLE(RESOURCE_LOAD_STATISTICS) 2495 if (m_resourceLoadStatistics) 2496 m_resourceLoadStatistics->didCreateNetworkProcess(); 2497 #endif 2498 } 2499 2500 } 2110 } 2111 2112 } -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
r240555 r240586 120 120 #if ENABLE(RESOURCE_LOAD_STATISTICS) 121 121 void fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(Vector<WebsiteDataRecord>&&, HashSet<String>&&)>&& completionHandler); 122 void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void(HashSet<String>&&)>&& completionHandler);123 void removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(HashSet<String>&&)>&& completionHandler);124 122 125 123 void clearPrevalentResource(const URL&, CompletionHandler<void()>&&); 126 124 void clearUserInteraction(const URL&, CompletionHandler<void()>&&); 127 void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPages, CompletionHandler<void(const HashSet<String>&)>&&);128 125 void dumpResourceLoadStatistics(CompletionHandler<void(const String&)>&&); 129 126 void logTestingEvent(const String&); 130 127 void logUserInteraction(const URL&, CompletionHandler<void()>&&); 131 void updatePrevalentDomainsToBlockCookiesFor(const Vector<String>& domainsToBlock, CompletionHandler<void()>&&);132 void setAgeCapForClientSideCookies(Optional<Seconds>, CompletionHandler<void()>&&);133 void hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool hasAccess)>&&);134 128 void getAllStorageAccessEntries(uint64_t pageID, CompletionHandler<void(Vector<String>&& domains)>&&); 135 void grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool wasGranted)>&&);136 129 void hasHadUserInteraction(const URL&, CompletionHandler<void(bool)>&&); 137 void isGrandfathered(const URL&, CompletionHandler<void(bool)>&&);138 130 void isPrevalentResource(const URL&, CompletionHandler<void(bool)>&&); 139 131 void isRegisteredAsRedirectingTo(const URL& hostRedirectedFrom, const URL& hostRedirectedTo, CompletionHandler<void(bool)>&&); … … 141 133 void isRegisteredAsSubFrameUnder(const URL& subFrame, const URL& topFrame, CompletionHandler<void(bool)>&&); 142 134 void isVeryPrevalentResource(const URL&, CompletionHandler<void(bool)>&&); 143 void removeAllStorageAccessHandler(CompletionHandler<void()>&&);144 void removePrevalentDomains(const Vector<String>& domains);145 135 void resetParametersToDefaultValues(CompletionHandler<void()>&&); 146 136 void scheduleCookieBlockingUpdate(CompletionHandler<void()>&&); … … 149 139 void scheduleStatisticsAndDataRecordsProcessing(CompletionHandler<void()>&&); 150 140 void submitTelemetry(); 151 void setCacheMaxAgeCap(Seconds, CompletionHandler<void()>&&);152 141 void setGrandfathered(const URL&, bool, CompletionHandler<void()>&&); 153 142 void setGrandfatheringTime(Seconds, CompletionHandler<void()>&&); … … 261 250 static void platformRemoveRecentSearches(WallTime); 262 251 263 #if ENABLE(RESOURCE_LOAD_STATISTICS)264 void registerWebResourceLoadStatisticsStoreAsMessageReceiver();265 void unregisterWebResourceLoadStatisticsStoreAsMessageReceiver();266 #endif267 268 252 HashSet<RefPtr<WebProcessPool>> processPools(size_t count = std::numeric_limits<size_t>::max(), bool ensureAPoolExists = true) const; 269 253
Note: See TracChangeset
for help on using the changeset viewer.