Changeset 248372 in webkit
- Timestamp:
- Aug 7, 2019 10:22:38 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r248371 r248372 1 2019-08-07 Chris Dumez <cdumez@apple.com> 2 3 Add more threading assertions to ITP code 4 https://bugs.webkit.org/show_bug.cgi?id=200505 5 6 Reviewed by Brent Fulgham. 7 8 Add more threading assertions to ITP code to help catch bugs and protect against future bad usage. 9 10 * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp: 11 (WebKit::ResourceLoadStatisticsMemoryStore::isEmpty const): 12 (WebKit::ResourceLoadStatisticsMemoryStore::setPersistentStorage): 13 (WebKit::ResourceLoadStatisticsMemoryStore::incrementRecordsDeletedCountForDomains): 14 (WebKit::ResourceLoadStatisticsMemoryStore::classifyPrevalentResources): 15 (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded): 16 (WebKit::ResourceLoadStatisticsMemoryStore::syncStorageImmediately): 17 (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherDataForDomains): 18 (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode): 19 * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp: 20 (WebKit::ResourceLoadStatisticsStore::statisticsEpirationTime const): 21 (WebKit::ResourceLoadStatisticsStore::mergeOperatingDates): 22 * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp: 23 (WebKit::WebResourceLoadStatisticsStore::hasStorageAccessForFrame): 24 (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): 25 (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): 26 (WebKit::WebResourceLoadStatisticsStore::applicationWillTerminate): 27 (WebKit::WebResourceLoadStatisticsStore::logFrameNavigation): 28 (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): 29 (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): 30 (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): 31 (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): 32 (WebKit::WebResourceLoadStatisticsStore::removePrevalentDomains): 33 (WebKit::WebResourceLoadStatisticsStore::networkSession): 34 (WebKit::WebResourceLoadStatisticsStore::invalidateAndCancel): 35 (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const): 36 (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const): 37 1 38 2019-08-07 Ryan Haddad <ryanhaddad@apple.com> 2 39 -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
r247119 r248372 83 83 bool ResourceLoadStatisticsMemoryStore::isEmpty() const 84 84 { 85 ASSERT(!RunLoop::isMain()); 86 85 87 return m_resourceStatisticsMap.isEmpty(); 86 88 } … … 88 90 void ResourceLoadStatisticsMemoryStore::setPersistentStorage(ResourceLoadStatisticsPersistentStorage& persistentStorage) 89 91 { 92 ASSERT(!RunLoop::isMain()); 93 90 94 m_persistentStorage = makeWeakPtr(persistentStorage); 91 95 } … … 101 105 void ResourceLoadStatisticsMemoryStore::incrementRecordsDeletedCountForDomains(HashSet<RegistrableDomain>&& domainsWithDeletedWebsiteData) 102 106 { 107 ASSERT(!RunLoop::isMain()); 108 103 109 for (auto& domain : domainsWithDeletedWebsiteData) { 104 110 auto& statistic = ensureResourceStatisticsForRegistrableDomain(domain); … … 173 179 void ResourceLoadStatisticsMemoryStore::classifyPrevalentResources() 174 180 { 181 ASSERT(!RunLoop::isMain()); 182 175 183 for (auto& resourceStatistic : m_resourceStatisticsMap.values()) { 176 184 if (shouldSkip(resourceStatistic.registrableDomain)) … … 190 198 void ResourceLoadStatisticsMemoryStore::syncStorageIfNeeded() 191 199 { 200 ASSERT(!RunLoop::isMain()); 201 192 202 if (m_persistentStorage) 193 203 m_persistentStorage->scheduleOrWriteMemoryStore(ResourceLoadStatisticsPersistentStorage::ForceImmediateWrite::No); … … 196 206 void ResourceLoadStatisticsMemoryStore::syncStorageImmediately() 197 207 { 208 ASSERT(!RunLoop::isMain()); 209 198 210 if (m_persistentStorage) 199 211 m_persistentStorage->scheduleOrWriteMemoryStore(ResourceLoadStatisticsPersistentStorage::ForceImmediateWrite::Yes); … … 316 328 void ResourceLoadStatisticsMemoryStore::grandfatherDataForDomains(const HashSet<RegistrableDomain>& domains) 317 329 { 330 ASSERT(!RunLoop::isMain()); 331 318 332 for (auto& domain : domains) { 319 333 auto& statistic = ensureResourceStatisticsForRegistrableDomain(domain); … … 324 338 Vector<RegistrableDomain> ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode() 325 339 { 340 ASSERT(!RunLoop::isMain()); 341 326 342 if (!debugModeEnabled()) 327 343 return { }; -
trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp
r247119 r248372 446 446 Optional<Seconds> ResourceLoadStatisticsStore::statisticsEpirationTime() const 447 447 { 448 ASSERT(!RunLoop::isMain()); 449 448 450 if (m_parameters.timeToLiveUserInteraction) 449 451 return WallTime::now().secondsSinceEpoch() - m_parameters.timeToLiveUserInteraction.value(); … … 476 478 void ResourceLoadStatisticsStore::mergeOperatingDates(Vector<OperatingDate>&& newDates) 477 479 { 480 ASSERT(!RunLoop::isMain()); 481 478 482 m_operatingDates = mergeOperatingDates(m_operatingDates, WTFMove(newDates)); 479 483 } -
trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp
r248144 r248372 307 307 bool WebResourceLoadStatisticsStore::hasStorageAccessForFrame(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, uint64_t frameID, PageIdentifier pageID) 308 308 { 309 if (m_networkSession) { 310 if (auto* storageSession = m_networkSession->networkStorageSession()) 311 return storageSession->hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID); 312 } 309 ASSERT(RunLoop::isMain()); 310 311 if (!m_networkSession) 312 return false; 313 314 if (auto* storageSession = m_networkSession->networkStorageSession()) 315 return storageSession->hasStorageAccess(resourceDomain, firstPartyDomain, frameID, pageID); 316 313 317 return false; 314 318 } … … 330 334 void WebResourceLoadStatisticsStore::requestStorageAccess(const RegistrableDomain& subFrameDomain, const RegistrableDomain& topFrameDomain, uint64_t frameID, PageIdentifier pageID, CompletionHandler<void(StorageAccessWasGranted, StorageAccessPromptWasShown)>&& completionHandler) 331 335 { 336 ASSERT(RunLoop::isMain()); 337 332 338 if (subFrameDomain == topFrameDomain) { 333 339 completionHandler(StorageAccessWasGranted::Yes, StorageAccessPromptWasShown::No); … … 410 416 StorageAccessWasGranted WebResourceLoadStatisticsStore::grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, PageIdentifier pageID) 411 417 { 418 ASSERT(RunLoop::isMain()); 419 412 420 bool isStorageGranted = false; 413 421 … … 455 463 void WebResourceLoadStatisticsStore::applicationWillTerminate() 456 464 { 465 ASSERT(RunLoop::isMain()); 457 466 flushAndDestroyPersistentStore(); 458 467 } … … 514 523 void WebResourceLoadStatisticsStore::logFrameNavigation(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, const RegistrableDomain& sourceDomain, bool isRedirect, bool isMainFrame) 515 524 { 525 ASSERT(RunLoop::isMain()); 526 516 527 postTask([this, targetDomain = targetDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), sourceDomain = sourceDomain.isolatedCopy(), isRedirect, isMainFrame] { 517 528 if (m_statisticsStore) … … 522 533 void WebResourceLoadStatisticsStore::logWebSocketLoading(const RegistrableDomain& targetDomain, const RegistrableDomain& topFrameDomain, WallTime lastSeen, CompletionHandler<void()>&& completionHandler) 523 534 { 535 ASSERT(RunLoop::isMain()); 536 524 537 postTask([this, targetDomain = targetDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), lastSeen, completionHandler = WTFMove(completionHandler)]() mutable { 525 538 if (m_statisticsStore) … … 532 545 void WebResourceLoadStatisticsStore::logSubresourceLoading(const SubResourceDomain& targetDomain, const TopFrameDomain& topFrameDomain, WallTime lastSeen, CompletionHandler<void()>&& completionHandler) 533 546 { 547 ASSERT(RunLoop::isMain()); 548 534 549 postTask([this, targetDomain = targetDomain.isolatedCopy(), topFrameDomain = topFrameDomain.isolatedCopy(), lastSeen, completionHandler = WTFMove(completionHandler)]() mutable { 535 550 if (m_statisticsStore) … … 542 557 void WebResourceLoadStatisticsStore::logSubresourceRedirect(const RegistrableDomain& sourceDomain, const RegistrableDomain& targetDomain, CompletionHandler<void()>&& completionHandler) 543 558 { 559 ASSERT(RunLoop::isMain()); 560 544 561 postTask([this, sourceDomain = sourceDomain.isolatedCopy(), targetDomain = targetDomain.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable { 545 562 if (m_statisticsStore) … … 585 602 void WebResourceLoadStatisticsStore::hasHadUserInteraction(const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler) 586 603 { 604 ASSERT(RunLoop::isMain()); 605 587 606 postTask([this, domain, completionHandler = WTFMove(completionHandler)]() mutable { 588 607 bool hadUserInteraction = m_statisticsStore ? m_statisticsStore->hasHadUserInteraction(domain, OperatingDatesWindow::Long) : false; … … 955 974 void WebResourceLoadStatisticsStore::removePrevalentDomains(const Vector<RegistrableDomain>& domains) 956 975 { 957 if (m_networkSession) { 958 if (auto* storageSession = m_networkSession->networkStorageSession()) 959 storageSession->removePrevalentDomains(domains); 960 } 976 ASSERT(RunLoop::isMain()); 977 if (!m_networkSession) 978 return; 979 980 if (auto* storageSession = m_networkSession->networkStorageSession()) 981 storageSession->removePrevalentDomains(domains); 961 982 } 962 983 … … 1021 1042 NetworkSession* WebResourceLoadStatisticsStore::networkSession() 1022 1043 { 1044 ASSERT(RunLoop::isMain()); 1023 1045 return m_networkSession.get(); 1024 1046 } … … 1026 1048 void WebResourceLoadStatisticsStore::invalidateAndCancel() 1027 1049 { 1050 ASSERT(RunLoop::isMain()); 1028 1051 m_networkSession = nullptr; 1029 1052 } … … 1055 1078 void WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue(const String& message, const String& description, unsigned value, unsigned sigDigits, WebCore::ShouldSample shouldSample) const 1056 1079 { 1080 ASSERT(RunLoop::isMain()); 1057 1081 if (m_networkSession) 1058 1082 const_cast<WebResourceLoadStatisticsStore*>(this)->networkSession()->logDiagnosticMessageWithValue(message, description, value, sigDigits, shouldSample); … … 1061 1085 void WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins) const 1062 1086 { 1087 ASSERT(RunLoop::isMain()); 1063 1088 if (m_networkSession) 1064 1089 const_cast<WebResourceLoadStatisticsStore*>(this)->networkSession()->notifyPageStatisticsTelemetryFinished(totalPrevalentResources, totalPrevalentResourcesWithUserInteraction, top3SubframeUnderTopFrameOrigins);
Note: See TracChangeset
for help on using the changeset viewer.