WebKit Bugzilla
Attachment 343862 Details for
Bug 187154
: Resource Load Statistics: Don't create a WebResourceLoadStatisticsStore for ephemeral sessions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187154-20180628153226.patch (text/plain), 14.98 KB, created by
John Wilander
on 2018-06-28 15:32:26 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
John Wilander
Created:
2018-06-28 15:32:26 PDT
Size:
14.98 KB
patch
obsolete
>Subversion Revision: 233333 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 413c6839bbdf2b10cd6e7ef18b3f129232a41b7f..f882f6606c77a68ac84891b4cf1c676eebd4942d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,30 @@ >+2018-06-28 John Wilander <wilander@apple.com> >+ >+ Resource Load Statistics: Don't create a WebResourceLoadStatisticsStore for ephemeral sessions >+ https://bugs.webkit.org/show_bug.cgi?id=187154 >+ <rdar://problem/41487250> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Most of the changes in this patch removes the boolean parameter for tracking >+ ephemeral sessions and the IsReadOnly enum. >+ >+ * UIProcess/API/Cocoa/WKWebsiteDataStore.mm: >+ (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]): >+ Now returns early for ephemeral sessions. >+ * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: >+ (WebKit::ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage): >+ (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk): >+ (WebKit::ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore): >+ * UIProcess/ResourceLoadStatisticsPersistentStorage.h: >+ * UIProcess/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore): >+ * UIProcess/WebResourceLoadStatisticsStore.h: >+ * UIProcess/WebsiteData/WebsiteDataStore.cpp: >+ (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled): >+ Now returns early for ephemeral sessions. >+ (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): >+ > 2018-06-28 Jeremy Jones <jeremyj@apple.com> > > Fullscreen exits when placeholder is removed then added during a single runloop. >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >index 56b8a61b647961ab80890a3469328324ac2926e5..872ba3db746784b1b2d96f7856fcea1246242868 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm >@@ -321,6 +321,9 @@ - (void)_resourceLoadStatisticsSetShouldSubmitTelemetry:(BOOL)value > > - (void)_setResourceLoadStatisticsTestingCallback:(void (^)(WKWebsiteDataStore *, NSString *))callback > { >+ if (!_websiteDataStore->isPersistent()) >+ return; >+ > if (callback) { > _websiteDataStore->websiteDataStore().enableResourceLoadStatisticsAndSetTestingCallback([callback = makeBlockPtr(callback), self](const String& event) { > callback(self, (NSString *)event); >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp >index 09687222ae13758e2af484661313315277180cf7..29acae014f2b03e86b433bd4d8adebb1630d7b17 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp >@@ -82,11 +82,10 @@ static std::unique_ptr<KeyedDecoder> createDecoderForFile(const String& path) > return KeyedDecoder::decoder(reinterpret_cast<const uint8_t*>(buffer.data()), buffer.size()); > } > >-ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage(ResourceLoadStatisticsMemoryStore& memoryStore, WorkQueue& workQueue, const String& storageDirectoryPath, IsReadOnly isReadOnly) >+ResourceLoadStatisticsPersistentStorage::ResourceLoadStatisticsPersistentStorage(ResourceLoadStatisticsMemoryStore& memoryStore, WorkQueue& workQueue, const String& storageDirectoryPath) > : m_memoryStore(memoryStore) > , m_workQueue(workQueue) > , m_storageDirectoryPath(storageDirectoryPath) >- , m_isReadOnly(isReadOnly) > { > ASSERT(!RunLoop::isMain()); > >@@ -247,7 +246,6 @@ void ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk() > void ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk() > { > ASSERT(!RunLoop::isMain()); >- RELEASE_ASSERT(m_isReadOnly != IsReadOnly::Yes); > > m_hasPendingWrite = false; > stopMonitoringDisk(); >@@ -282,8 +280,6 @@ void ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk() > void ResourceLoadStatisticsPersistentStorage::scheduleOrWriteMemoryStore(ForceImmediateWrite forceImmediateWrite) > { > ASSERT(!RunLoop::isMain()); >- if (m_isReadOnly == IsReadOnly::Yes) >- return; > > auto timeSinceLastWrite = MonotonicTime::now() - m_lastStatisticsWriteTime; > if (forceImmediateWrite != ForceImmediateWrite::Yes && timeSinceLastWrite < minimumWriteInterval) { >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h >index 05ea99347b7e3a0b6767bea3fc7b1b7fd040d533..12aa9b8aec2fd5001f1d2cc6aa33dbb2728ee6be 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.h >@@ -44,8 +44,7 @@ class ResourceLoadStatisticsMemoryStore; > // Can only be constructed / destroyed / used from the WebResourceLoadStatisticsStore's statistic queue. > class ResourceLoadStatisticsPersistentStorage : public CanMakeWeakPtr<ResourceLoadStatisticsPersistentStorage> { > public: >- enum class IsReadOnly { No, Yes }; >- ResourceLoadStatisticsPersistentStorage(ResourceLoadStatisticsMemoryStore&, WorkQueue&, const String& storageDirectoryPath, IsReadOnly); >+ ResourceLoadStatisticsPersistentStorage(ResourceLoadStatisticsMemoryStore&, WorkQueue&, const String& storageDirectoryPath); > ~ResourceLoadStatisticsPersistentStorage(); > > void clear(); >@@ -72,7 +71,6 @@ private: > std::unique_ptr<WebCore::FileMonitor> m_fileMonitor; > WallTime m_lastStatisticsFileSyncTime; > MonotonicTime m_lastStatisticsWriteTime; >- IsReadOnly m_isReadOnly { IsReadOnly::No }; > bool m_hasPendingWrite { false }; > }; > >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >index f36450126adadf4dffe892f741a46c7a50e8346d..5b6960c59aa98197db85434bf8ae2ce11c6683ea 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >@@ -111,7 +111,7 @@ void WebResourceLoadStatisticsStore::setShouldSubmitTelemetry(bool value) > }); > } > >-WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& resourceLoadStatisticsDirectory, Function<void(const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler, GrantStorageAccessHandler&& grantStorageAccessHandler, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler, RemovePrevalentDomainsHandler&& removeDomainsHandler) >+WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& resourceLoadStatisticsDirectory, Function<void(const String&)>&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler, GrantStorageAccessHandler&& grantStorageAccessHandler, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler, RemovePrevalentDomainsHandler&& removeDomainsHandler) > : m_statisticsQueue(WorkQueue::create("WebResourceLoadStatisticsStore Process Data Queue", WorkQueue::Type::Serial, WorkQueue::QOS::Utility)) > , m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler)) > , m_hasStorageAccessForFrameHandler(WTFMove(hasStorageAccessForFrameHandler)) >@@ -123,9 +123,9 @@ WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& res > { > ASSERT(RunLoop::isMain()); > >- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), isEphemeral, resourceLoadStatisticsDirectory = resourceLoadStatisticsDirectory.isolatedCopy()] { >+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), resourceLoadStatisticsDirectory = resourceLoadStatisticsDirectory.isolatedCopy()] { > m_memoryStore = std::make_unique<ResourceLoadStatisticsMemoryStore>(*this, m_statisticsQueue); >- m_persistentStorage = std::make_unique<ResourceLoadStatisticsPersistentStorage>(*m_memoryStore, m_statisticsQueue, resourceLoadStatisticsDirectory, isEphemeral ? ResourceLoadStatisticsPersistentStorage::IsReadOnly::Yes : ResourceLoadStatisticsPersistentStorage::IsReadOnly::No); >+ m_persistentStorage = std::make_unique<ResourceLoadStatisticsPersistentStorage>(*m_memoryStore, m_statisticsQueue, resourceLoadStatisticsDirectory); > }); > > m_statisticsQueue->dispatchAfter(5_s, [this, protectedThis = makeRef(*this)] { >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >index 7a90a0b2f827ddbe23d2a09d162f6c630f5fb472..595bc01332d1d3513544cb8a4c2a8f3e2d08290c 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >@@ -64,9 +64,9 @@ public: > using GrantStorageAccessHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::Function<void(bool wasGranted)>&& callback)>; > using RemoveAllStorageAccessHandler = WTF::Function<void()>; > using RemovePrevalentDomainsHandler = WTF::Function<void(const WTF::Vector<String>&)>; >- static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, WTF::Function<void(const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const WTF::Vector<String>&, const WTF::Vector<String>&, const WTF::Vector<String>&, ShouldClearFirst, CompletionHandler<void()>&& callback) { callback(); }, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, GrantStorageAccessHandler&& grantStorageAccessHandler = [](const String&, const String&, std::optional<uint64_t>, uint64_t, WTF::Function<void(bool)>&&) { }, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler = []() { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const WTF::Vector<String>&) { }) >+ static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, WTF::Function<void(const String&)>&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const WTF::Vector<String>&, const WTF::Vector<String>&, const WTF::Vector<String>&, ShouldClearFirst, CompletionHandler<void()>&& callback) { callback(); }, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, GrantStorageAccessHandler&& grantStorageAccessHandler = [](const String&, const String&, std::optional<uint64_t>, uint64_t, WTF::Function<void(bool)>&&) { }, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler = []() { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const WTF::Vector<String>&) { }) > { >- return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), isEphemeral, WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(hasStorageAccessForFrameHandler), WTFMove(grantStorageAccessHandler), WTFMove(removeAllStorageAccessHandler), WTFMove(removeDomainsHandler))); >+ return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(hasStorageAccessForFrameHandler), WTFMove(grantStorageAccessHandler), WTFMove(removeAllStorageAccessHandler), WTFMove(removeDomainsHandler))); > } > > ~WebResourceLoadStatisticsStore(); >@@ -148,7 +148,7 @@ public: > void callHasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::Function<void(bool)>&&); > > private: >- WebResourceLoadStatisticsStore(const String&, WTF::Function<void(const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&&, HasStorageAccessForFrameHandler&&, GrantStorageAccessHandler&&, RemoveAllStorageAccessHandler&&, RemovePrevalentDomainsHandler&&); >+ WebResourceLoadStatisticsStore(const String&, WTF::Function<void(const String&)>&& testingCallback, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&&, HasStorageAccessForFrameHandler&&, GrantStorageAccessHandler&&, RemoveAllStorageAccessHandler&&, RemovePrevalentDomainsHandler&&); > > // IPC::MessageReceiver > void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >index 7d181b9ce692638f356b8e1fab90ea955da99027..7eed05d74c6591177b55af130d0c4ec6e74a64b3 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -1441,7 +1441,7 @@ bool WebsiteDataStore::resourceLoadStatisticsEnabled() const > > void WebsiteDataStore::setResourceLoadStatisticsEnabled(bool enabled) > { >- if (enabled == resourceLoadStatisticsEnabled()) >+ if (m_sessionID.isEphemeral() || enabled == resourceLoadStatisticsEnabled()) > return; > > if (enabled) { >@@ -1477,7 +1477,7 @@ void WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback(Functio > } > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(m_configuration.resourceLoadStatisticsDirectory, WTFMove(callback), m_sessionID.isEphemeral(), [weakThis = makeWeakPtr(*this)] (const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) { >+ m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(m_configuration.resourceLoadStatisticsDirectory, WTFMove(callback), [weakThis = makeWeakPtr(*this)] (const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) { > if (weakThis) > weakThis->updatePrevalentDomainsToPartitionOrBlockCookies(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, WTFMove(completionHandler)); > }, [weakThis = makeWeakPtr(*this)] (const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool hasAccess)>&& completionHandler) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187154
:
343846
|
343862
|
343863
|
343865
|
343902
|
343931