⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 236229 in webkit


Ignore:
Timestamp:
Sep 19, 2018, 3:57:23 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Clear persistent storage between tests for resourceLoadStatistics
​https://bugs.webkit.org/show_bug.cgi?id=189684
<rdar://problem/44540099>

Patch by Woodrow Wang <​woodrow_wang@apple.com> on 2018-09-19
Reviewed by Chris Dumez.

  • 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.

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r236227 r236229  
     12018-09-19  Woodrow Wang  <woodrow_wang@apple.com>
     2
     3        Clear persistent storage between tests for resourceLoadStatistics
     4        https://bugs.webkit.org/show_bug.cgi?id=189684
     5        <rdar://problem/44540099>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
     10        (WKWebsiteDataStoreStatisticsResetToConsistentState):
     11        * UIProcess/WebResourceLoadStatisticsStore.cpp:
     12        (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
     13
     14        Remove function only called in testing for resetting statistics to consistent
     15        state.
     16       
     17        (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory): Deleted.
     18
    1192018-09-19  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp

    r236216 r236229  
    485485
    486486    statisticsStore->resetParametersToDefaultValues([callbackAggregator = callbackAggregator.copyRef()] { });
    487     statisticsStore->scheduleClearInMemory([callbackAggregator = callbackAggregator.copyRef()] { });
     487    statisticsStore->scheduleClearInMemoryAndPersistent(WebKit::WebResourceLoadStatisticsStore::ShouldGrandfather::No, [callbackAggregator = callbackAggregator.copyRef()] { });
    488488}
    489489
  • trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp

    r236216 r236229  
    760760#endif
    761761
    762 void WebResourceLoadStatisticsStore::scheduleClearInMemory(CompletionHandler<void()>&& completionHandler)
    763 {
    764     ASSERT(RunLoop::isMain());
    765     postTask([this, completionHandler = WTFMove(completionHandler)]() mutable {
    766 
    767         CompletionHandler<void()> callCompletionHandlerOnMainThread = [completionHandler = WTFMove(completionHandler)]() mutable {
    768             postTaskReply(WTFMove(completionHandler));
    769         };
    770 
    771         if (!m_memoryStore) {
    772             callCompletionHandlerOnMainThread();
    773             return;
    774         }
    775 
    776         m_memoryStore->clear(WTFMove(callCompletionHandlerOnMainThread));
    777     });
    778 }
    779 
    780762void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(ShouldGrandfather shouldGrandfather, CompletionHandler<void()>&& completionHandler)
    781763{
    782764    ASSERT(RunLoop::isMain());
    783     postTask([this, shouldGrandfather, completionHandler = WTFMove(completionHandler)] () mutable {
    784         if (m_memoryStore)
    785             m_memoryStore->clear([] { });
     765    postTask([this, protectedThis = makeRef(*this), shouldGrandfather, completionHandler = WTFMove(completionHandler)] () mutable {
    786766        if (m_persistentStorage)
    787767            m_persistentStorage->clear();
    788        
    789         CompletionHandler<void()> callCompletionHandlerOnMainThread = [completionHandler = WTFMove(completionHandler)]() mutable {
     768
     769        CompletionHandlerCallingScope completionHandlerCaller([completionHandler = WTFMove(completionHandler)]() mutable {
    790770            postTaskReply(WTFMove(completionHandler));
    791         };
    792 
    793         if (shouldGrandfather == ShouldGrandfather::Yes && m_memoryStore)
    794             m_memoryStore->grandfatherExistingWebsiteData(WTFMove(callCompletionHandlerOnMainThread));
    795         else
    796             callCompletionHandlerOnMainThread();
     771        });
     772
     773        if (m_memoryStore) {
     774            m_memoryStore->clear([this, protectedThis = protectedThis.copyRef(), shouldGrandfather, completionHandlerCaller = WTFMove(completionHandlerCaller)] () mutable {
     775                if (shouldGrandfather == ShouldGrandfather::Yes) {
     776                    if (m_memoryStore)
     777                        m_memoryStore->grandfatherExistingWebsiteData(completionHandlerCaller.release());
     778                    else
     779                        RELEASE_LOG(ResourceLoadStatistics, "WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent After being cleared, m_memoryStore is null when trying to grandfather data.");
     780                }
     781            });
     782        } else {
     783            if (shouldGrandfather == ShouldGrandfather::Yes)
     784                RELEASE_LOG(ResourceLoadStatistics, "WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent Before being cleared, m_memoryStore is null when trying to grandfather data.");
     785        }
    797786    });
    798787}
Note: See TracChangeset for help on using the changeset viewer.