Changeset 233384 in webkit
- Timestamp:
- Jun 29, 2018 6:07:38 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r233381 r233384 1 2018-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 1 29 2018-06-29 Chris Dumez <cdumez@apple.com> 2 30 -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r233371 r233384 1215 1215 for (auto& processPool : processPools()) { 1216 1216 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 1221 void 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 1233 void 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. 1223 1236 for (auto& processPool : processPools()) 1224 processPool->networkProcess()-> hasStorageAccessForFrame(m_sessionID, resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback));1225 } 1226 1227 void WebsiteDataStore::g etAllStorageAccessEntries(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 1240 void 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)); 1237 1250 } 1238 1251 … … 1251 1264 } 1252 1265 1253 void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback)1266 void WebsiteDataStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& completionHandler) 1254 1267 { 1255 1268 if (!resourceLoadStatisticsEnabled()) { 1256 c allback(false);1269 completionHandler(false); 1257 1270 return; 1258 1271 } 1259 1272 1260 m_resourceLoadStatistics->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(c allback));1261 } 1262 1263 void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& c allback)1273 m_resourceLoadStatistics->hasStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, WTFMove(completionHandler)); 1274 } 1275 1276 void WebsiteDataStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler) 1264 1277 { 1265 1278 if (!resourceLoadStatisticsEnabled()) { 1266 c allback(StorageAccessStatus::CannotRequestAccess);1279 completionHandler(StorageAccessStatus::CannotRequestAccess); 1267 1280 return; 1268 1281 } 1269 1282 1270 m_resourceLoadStatistics->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, promptEnabled, WTFMove(c allback));1271 } 1272 1273 void WebsiteDataStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& c allback)1283 m_resourceLoadStatistics->requestStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, promptEnabled, WTFMove(completionHandler)); 1284 } 1285 1286 void WebsiteDataStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&& completionHandler) 1274 1287 { 1275 1288 if (!resourceLoadStatisticsEnabled()) { 1276 c allback(false);1289 completionHandler(false); 1277 1290 return; 1278 1291 } 1279 1292 1280 m_resourceLoadStatistics->grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(c allback));1293 m_resourceLoadStatistics->grantStorageAccess(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPrompted, WTFMove(completionHandler)); 1281 1294 } 1282 1295 #endif
Note: See TracChangeset
for help on using the changeset viewer.