Changeset 233384 in webkit


Ignore:
Timestamp:
Jun 29, 2018 6:07:38 PM (6 years ago)
Author:
wilander@apple.com
Message:

Resource Load Statistics: Make network process calls only for the process pool that the page belongs to
https://bugs.webkit.org/show_bug.cgi?id=187206
<rdar://problem/41659160>

Reviewed by Chris Dumez.

Instead of iterating over all process pools, we should resolve which
process pool the page belongs to and call the network process only for
that pool. This is especially important since we use WTFMove for the
completion handlers.

This patch also renames "callback" to "completionHandler" for
the functions touched.

A FIXME comment is added to WebsiteDataStore::getAllStorageAccessEntries()
where we currently don't have a page ID to do the lookup with.

  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies):
(WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
(WebKit::WebsiteDataStore::getAllStorageAccessEntries):
(WebKit::WebsiteDataStore::grantStorageAccessHandler):
(WebKit::WebsiteDataStore::hasStorageAccess):
(WebKit::WebsiteDataStore::requestStorageAccess):
(WebKit::WebsiteDataStore::grantStorageAccess):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r233381 r233384  
     12018-06-29  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Make network process calls only for the process pool that the page belongs to
     4        https://bugs.webkit.org/show_bug.cgi?id=187206
     5        <rdar://problem/41659160>
     6
     7        Reviewed by Chris Dumez.
     8
     9        Instead of iterating over all process pools, we should resolve which
     10        process pool the page belongs to and call the network process only for
     11        that pool. This is especially important since we use WTFMove for the
     12        completion handlers.
     13
     14        This patch also renames "callback" to "completionHandler" for
     15        the functions touched.
     16
     17        A FIXME comment is added to WebsiteDataStore::getAllStorageAccessEntries()
     18        where we currently don't have a page ID to do the lookup with.
     19
     20        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     21        (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies):
     22        (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
     23        (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
     24        (WebKit::WebsiteDataStore::grantStorageAccessHandler):
     25        (WebKit::WebsiteDataStore::hasStorageAccess):
     26        (WebKit::WebsiteDataStore::requestStorageAccess):
     27        (WebKit::WebsiteDataStore::grantStorageAccess):
     28
    1292018-06-29  Chris Dumez  <cdumez@apple.com>
    230
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r233371 r233384  
    12151215    for (auto& processPool : processPools()) {
    12161216        if (auto* process = processPool->networkProcess())
    1217             process->updatePrevalentDomainsToPartitionOrBlockCookies(m_sessionID, domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst,  [callbackAggregator = callbackAggregator.copyRef()] { });
    1218     }
    1219 }
    1220 
    1221 void WebsiteDataStore::hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback)
    1222 {
     1217            process->updatePrevalentDomainsToPartitionOrBlockCookies(m_sessionID, domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, [callbackAggregator = callbackAggregator.copyRef()] { });
     1218    }
     1219}
     1220
     1221void WebsiteDataStore::hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool hasAccess)>&& completionHandler)
     1222{
     1223    auto* webPage = WebProcessProxy::webPage(pageID);
     1224    if (!webPage) {
     1225        completionHandler(false);
     1226        return;
     1227    }
     1228
     1229    auto& networkProcess = webPage->process().processPool().ensureNetworkProcess();
     1230    networkProcess.hasStorageAccessForFrame(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(completionHandler));
     1231}
     1232
     1233void WebsiteDataStore::getAllStorageAccessEntries(CompletionHandler<void(Vector<String>&& domains)>&& completionHandler)
     1234{
     1235    // FIXME: Although this is only used for testing, it should not iterate and WTFMove the completion handler.
    12231236    for (auto& processPool : processPools())
    1224         processPool->networkProcess()->hasStorageAccessForFrame(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));
    1225 }
    1226 
    1227 void WebsiteDataStore::getAllStorageAccessEntries(CompletionHandler<void(Vector<String>&& domains)>&& callback)
    1228 {
    1229     for (auto& processPool : processPools())
    1230         processPool->networkProcess()->getAllStorageAccessEntries(m_sessionID, WTFMove(callback));
    1231 }
    1232 
    1233 void WebsiteDataStore::grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback)
    1234 {
    1235     for (auto& processPool : processPools())
    1236         processPool->networkProcess()->grantStorageAccess(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));
     1237        processPool->networkProcess()->getAllStorageAccessEntries(m_sessionID, WTFMove(completionHandler));
     1238}
     1239
     1240void WebsiteDataStore::grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool wasGranted)>&& completionHandler)
     1241{
     1242    auto* webPage = WebProcessProxy::webPage(pageID);
     1243    if (!webPage) {
     1244        completionHandler(false);
     1245        return;
     1246    }
     1247
     1248    auto& networkProcess = webPage->process().processPool().ensureNetworkProcess();
     1249    networkProcess.grantStorageAccess(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(completionHandler));
    12371250}
    12381251
     
    12511264}
    12521265
    1253 void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback)
     1266void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler)
    12541267{
    12551268    if (!resourceLoadStatisticsEnabled()) {
    1256         callback(false);
     1269        completionHandler(false);
    12571270        return;
    12581271    }
    12591272   
    1260     m_resourceLoadStatistics->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(callback));
    1261 }
    1262 
    1263 void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& callback)
     1273    m_resourceLoadStatistics->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(completionHandler));
     1274}
     1275
     1276void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler)
    12641277{
    12651278    if (!resourceLoadStatisticsEnabled()) {
    1266         callback(StorageAccessStatus::CannotRequestAccess);
     1279        completionHandler(StorageAccessStatus::CannotRequestAccess);
    12671280        return;
    12681281    }
    12691282   
    1270     m_resourceLoadStatistics->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, promptEnabled, WTFMove(callback));
    1271 }
    1272 
    1273 void WebsiteDataStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& callback)
     1283    m_resourceLoadStatistics->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, promptEnabled, WTFMove(completionHandler));
     1284}
     1285
     1286void WebsiteDataStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler)
    12741287{
    12751288    if (!resourceLoadStatisticsEnabled()) {
    1276         callback(false);
     1289        completionHandler(false);
    12771290        return;
    12781291    }
    12791292   
    1280     m_resourceLoadStatistics->grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(callback));
     1293    m_resourceLoadStatistics->grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(completionHandler));
    12811294}
    12821295#endif
Note: See TracChangeset for help on using the changeset viewer.