Changeset 218116 in webkit


Ignore:
Timestamp:
Jun 12, 2017, 11:49:06 AM (8 years ago)
Author:
matthew_hanson@apple.com
Message:

Cherry-pick r218002. rdar://problem/32679311

Location:
tags/Safari-604.1.25/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • tags/Safari-604.1.25/Source/WebKit2/ChangeLog

    r218115 r218116  
     12017-06-12  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Cherry-pick r218002. rdar://problem/32679311
     4
     5    2017-06-09  Chris Dumez  <cdumez@apple.com>
     6
     7            Avoid some ref counting churn in WebResourceLoadStatisticsStore
     8            https://bugs.webkit.org/show_bug.cgi?id=173168
     9
     10            Reviewed by Brent Fulgham.
     11
     12            Move the protectedThis around instead of ref'ing it every time we capture it
     13            in a lambda. Also add a missing protectedThis in WebResourceLoadStatisticsStore::removeDataRecords()
     14            which likely fixes crashes.
     15
     16            * UIProcess/WebResourceLoadStatisticsStore.cpp:
     17            (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
     18            (WebKit::WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData):
     19
    1202017-06-12  Matthew Hanson  <matthew_hanson@apple.com>
    221
  • tags/Safari-604.1.25/Source/WebKit2/UIProcess/WebProcessProxy.cpp

    r218115 r218116  
    210210}
    211211
    212 void WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, std::function<void(Vector<String>)> completionHandler)
     212void WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, Function<void(Vector<String>)>&& completionHandler)
    213213{
    214214    struct CallbackAggregator : ThreadSafeRefCounted<CallbackAggregator> {
    215         explicit CallbackAggregator(std::function<void(Vector<String>)> completionHandler)
     215        explicit CallbackAggregator(Function<void(Vector<String>)>&& completionHandler)
    216216            : completionHandler(WTFMove(completionHandler))
    217217        {
     
    242242       
    243243        unsigned pendingCallbacks = 0;
    244         std::function<void(Vector<String>)> completionHandler;
     244        Function<void(Vector<String>)> completionHandler;
    245245        Vector<String> domainsWithDeletedWebsiteData;
    246246    };
  • tags/Safari-604.1.25/Source/WebKit2/UIProcess/WebProcessProxy.h

    r218115 r218116  
    142142    void deleteWebsiteData(WebCore::SessionID, OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, Function<void()> completionHandler);
    143143    void deleteWebsiteDataForOrigins(WebCore::SessionID, OptionSet<WebsiteDataType>, const Vector<WebCore::SecurityOriginData>&, Function<void()> completionHandler);
    144     static void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPages, std::function<void(Vector<String>)> completionHandler);
     144    static void deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType>, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPages, Function<void(Vector<String>)>&& completionHandler);
    145145    static void topPrivatelyControlledDomainsWithWebiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, Function<void(HashSet<String>&&)> completionHandler);
    146146    static void notifyPageStatisticsAndDataRecordsProcessed();
  • tags/Safari-604.1.25/Source/WebKit2/UIProcess/WebResourceLoadStatisticsStore.cpp

    r218115 r218116  
    120120    // Switch to the main thread to get the default website data store
    121121    RunLoop::main().dispatch([prevalentResourceDomains = CrossThreadCopier<Vector<String>>::copy(prevalentResourceDomains), this, protectedThis = makeRef(*this)] () mutable {
    122         WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(dataTypesToRemove, WTFMove(prevalentResourceDomains), notifyPages, [this](Vector<String> domainsWithDeletedWebsiteData) mutable {
     122        WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(dataTypesToRemove, WTFMove(prevalentResourceDomains), notifyPages, [this, protectedThis = WTFMove(protectedThis)](Vector<String> domainsWithDeletedWebsiteData) mutable {
    123123            // But always touch the ResourceLoadStatistics store on the worker queue.
    124             m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), topDomains = CrossThreadCopier<Vector<String>>::copy(domainsWithDeletedWebsiteData)] () mutable {
    125                 this->coreStore().updateStatisticsForRemovedDataRecords(topDomains);
    126                 this->coreStore().dataRecordsWereRemoved();
     124            m_statisticsQueue->dispatch([protectedThis = WTFMove(protectedThis), topDomains = CrossThreadCopier<Vector<String>>::copy(domainsWithDeletedWebsiteData)] () mutable {
     125                protectedThis->coreStore().updateStatisticsForRemovedDataRecords(topDomains);
     126                protectedThis->coreStore().dataRecordsWereRemoved();
    127127            });
    128128        });
     
    216216    // Switch to the main thread to get the default website data store
    217217    RunLoop::main().dispatch([this, protectedThis = makeRef(*this)] () mutable {
    218         WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData(dataTypesToRemove, notifyPages, [this, protectedThis = makeRef(*this)] (HashSet<String>&& topPrivatelyControlledDomainsWithWebsiteData) mutable {
     218        WebProcessProxy::topPrivatelyControlledDomainsWithWebiteData(dataTypesToRemove, notifyPages, [this, protectedThis = WTFMove(protectedThis)] (HashSet<String>&& topPrivatelyControlledDomainsWithWebsiteData) mutable {
    219219            // But always touch the ResourceLoadStatistics store on the worker queue
    220             m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), topDomains = CrossThreadCopier<HashSet<String>>::copy(topPrivatelyControlledDomainsWithWebsiteData)] () mutable {
    221                 this->coreStore().handleFreshStartWithEmptyOrNoStore(WTFMove(topDomains));
     220            m_statisticsQueue->dispatch([protectedThis = WTFMove(protectedThis), topDomains = CrossThreadCopier<HashSet<String>>::copy(topPrivatelyControlledDomainsWithWebsiteData)] () mutable {
     221                protectedThis->coreStore().handleFreshStartWithEmptyOrNoStore(WTFMove(topDomains));
    222222            });
    223223        });
Note: See TracChangeset for help on using the changeset viewer.