WebKit Bugzilla
Attachment 350082 Details for
Bug 189684
: Clear persistent storage between tests for resourceLoadStatistics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189684-20180918173912.patch (text/plain), 5.41 KB, created by
Woodrow Wang
on 2018-09-18 17:39:13 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Woodrow Wang
Created:
2018-09-18 17:39:13 PDT
Size:
5.41 KB
patch
obsolete
>Subversion Revision: 236158 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 9ae6d78abc68d13001b8630035df0ecd0dceaf5b..3a0cde41e21d55ff9b31f3d98181c9bbf60750c4 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,21 @@ >+2018-09-17 Woodrow Wang <woodrow_wang@apple.com> >+ >+ Clear persistent storage between tests for resourceLoadStatistics >+ https://bugs.webkit.org/show_bug.cgi?id=189684 >+ <rdar://problem/44540099> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp: >+ (WKWebsiteDataStoreStatisticsResetToConsistentState): >+ * UIProcess/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): >+ >+ Remove function only called in testing for resetting statistics to consistent >+ state. >+ >+ (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted. >+ > 2018-09-14 Woodrow Wang <woodrow_wang@apple.com> > > Clear pending resource load statistics' writes after tests >diff --git a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp >index 7f23e90ff7c6e2ce4d54792c64a0b9623f2efe83..6ef3bf6560358dcd77a2f542f436b463659bb441 100644 >--- a/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp >+++ b/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp >@@ -476,7 +476,7 @@ void WKWebsiteDataStoreStatisticsResetToConsistentState(WKWebsiteDataStoreRef da > return; > > statisticsStore->resetParametersToDefaultValues([callbackAggregator = callbackAggregator.copyRef()] { }); >- statisticsStore->scheduleClearInMemory([callbackAggregator = callbackAggregator.copyRef()] { }); >+ statisticsStore->scheduleClearInMemoryAndPersistent(WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::No, [callbackAggregator = callbackAggregator.copyRef()] { }); > } > > void WKWebsiteDataStoreRemoveAllFetchCaches(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveFetchCacheRemovalFunction callback) >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >index c7db69b15d1d48d7a4da378f986c445c02e32b37..883a1105db8d2816de591978e976b9926a42e39d 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >@@ -38,6 +38,7 @@ > #include "WebsiteDataFetchOption.h" > #include "WebsiteDataStore.h" > #include <WebCore/ResourceLoadStatistics.h> >+#include <wtf/CallbackAggregator.h> > #include <wtf/CrossThreadCopier.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/threads/BinarySemaphore.h> >@@ -759,41 +760,33 @@ void WebResourceLoadStatisticsStore::scheduleCookieBlockingStateReset() > } > #endif > >-void WebResourceLoadStatisticsStore::scheduleClearInMemory(CompletionHandler<void()>&& completionHandler) >-{ >- ASSERT(RunLoop::isMain()); >- postTask([this, completionHandler = WTFMove(completionHandler)]() mutable { >- >- CompletionHandler<void()> callCompletionHandlerOnMainThread = [completionHandler = WTFMove(completionHandler)]() mutable { >- postTaskReply(WTFMove(completionHandler)); >- }; >- >- if (!m_memoryStore) { >- callCompletionHandlerOnMainThread(); >- return; >- } >- >- m_memoryStore->clear(WTFMove(callCompletionHandlerOnMainThread)); >- }); >-} >- > void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(ShouldGrandfather shouldGrandfather, CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); > postTask([this, shouldGrandfather, completionHandler = WTFMove(completionHandler)] () mutable { >- if (m_memoryStore) >- m_memoryStore->clear([] { }); > if (m_persistentStorage) > m_persistentStorage->clear(); >- >+ > CompletionHandler<void()> callCompletionHandlerOnMainThread = [completionHandler = WTFMove(completionHandler)]() mutable { > postTaskReply(WTFMove(completionHandler)); > }; > >- if (shouldGrandfather == ShouldGrandfather::Yes && m_memoryStore) >- m_memoryStore->grandfatherExistingWebsiteData(WTFMove(callCompletionHandlerOnMainThread)); >- else >- callCompletionHandlerOnMainThread(); >+ if (m_memoryStore) { >+ m_memoryStore->clear([this, protectedThis = makeRef(*this), shouldGrandfather, callCompletionHandlerOnMainThread = WTFMove(callCompletionHandlerOnMainThread)] () mutable { >+ if (shouldGrandfather == ShouldGrandfather::Yes) { >+ if (m_memoryStore) >+ m_memoryStore->grandfatherExistingWebsiteData(WTFMove(callCompletionHandlerOnMainThread)); >+ else >+ RELEASE_LOG(ResourceLoadStatistics, "WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent After being cleared, m_memoryStore is null when trying to grandfather data."); >+ >+ } else >+ callCompletionHandlerOnMainThread(); >+ }); >+ } else >+ if (shouldGrandfather == ShouldGrandfather::Yes) >+ RELEASE_LOG(ResourceLoadStatistics, "WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent Before being cleared, m_memoryStore is null when trying to grandfather data."); >+ else >+ callCompletionHandlerOnMainThread(); > }); > } >
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
Flags:
cdumez
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189684
:
349977
|
349986
|
350032
|
350059
|
350082
|
350130
|
350147
|
350151
|
350279