https://bugs.webkit.org/show_bug.cgi?id=174686
Reviewed by Geoffrey Garen.
Avoid unnecessary WorkQueue dispatch in WebResourceLoadStatisticsStore::processStatisticsAndDataRecords(). The most common
call site is already on the right thread.
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _resourceLoadStatisticsProcessStatisticsAndDataRecords]):
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
(WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
* UIProcess/WebResourceLoadStatisticsStore.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219705
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2017-07-20 Chris Dumez <cdumez@apple.com>
+ Avoid unnecessary WorkQueue dispatch in WebResourceLoadStatisticsStore::processStatisticsAndDataRecords()
+ https://bugs.webkit.org/show_bug.cgi?id=174686
+
+ Reviewed by Geoffrey Garen.
+
+ Avoid unnecessary WorkQueue dispatch in WebResourceLoadStatisticsStore::processStatisticsAndDataRecords(). The most common
+ call site is already on the right thread.
+
+ * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+ (-[WKWebsiteDataStore _resourceLoadStatisticsProcessStatisticsAndDataRecords]):
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
+ (WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+
+2017-07-20 Chris Dumez <cdumez@apple.com>
+
Regression(ITP): May get frequently logged out of wsj.com
https://bugs.webkit.org/show_bug.cgi?id=174661
<rdar://problem/32343256>
if (!store)
return;
- store->processStatisticsAndDataRecords();
+ store->scheduleStatisticsAndDataRecordsProcessing();
}
- (void)_resourceLoadStatisticsUpdateCookiePartitioning
});
}
+void WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing()
+{
+ ASSERT(RunLoop::isMain());
+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] {
+ processStatisticsAndDataRecords();
+ });
+}
+
void WebResourceLoadStatisticsStore::processStatisticsAndDataRecords()
{
- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] () {
- if (m_parameters.shouldClassifyResourcesBeforeDataRecordsRemoval) {
- for (auto& resourceStatistic : m_resourceStatisticsMap.values()) {
- if (!resourceStatistic.isPrevalentResource && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic))
- resourceStatistic.isPrevalentResource = true;
- }
- }
- removeDataRecords();
-
- pruneStatisticsIfNeeded();
+ ASSERT(!RunLoop::isMain());
- if (m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned) {
- RunLoop::main().dispatch([] {
- WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed();
- });
+ if (m_parameters.shouldClassifyResourcesBeforeDataRecordsRemoval) {
+ for (auto& resourceStatistic : m_resourceStatisticsMap.values()) {
+ if (!resourceStatistic.isPrevalentResource && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic))
+ resourceStatistic.isPrevalentResource = true;
}
+ }
+ removeDataRecords();
- m_persistentStorage.scheduleOrWriteMemoryStore();
- });
+ pruneStatisticsIfNeeded();
+
+ if (m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned) {
+ RunLoop::main().dispatch([] {
+ WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed();
+ });
+ }
+
+ m_persistentStorage.scheduleOrWriteMemoryStore();
}
void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&& origins)
void setSubresourceUniqueRedirectTo(const WebCore::URL& subresource, const WebCore::URL& hostNameRedirectedTo);
void scheduleCookiePartitioningUpdate();
void scheduleCookiePartitioningUpdateForDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, ShouldClearFirst);
- void processStatisticsAndDataRecords();
+ void scheduleStatisticsAndDataRecordsProcessing();
void submitTelemetry();
void scheduleCookiePartitioningStateReset();
void updateCookiePartitioningForDomains(const Vector<String>& domainsToRemove, const Vector<String>& domainsToAdd, ShouldClearFirst);
void mergeStatistics(Vector<WebCore::ResourceLoadStatistics>&&);
WebCore::ResourceLoadStatistics& ensureResourceStatisticsForPrimaryDomain(const String&);
+ void processStatisticsAndDataRecords();
void resetCookiePartitioningState();