Changeset 218753 in webkit
- Timestamp:
- Jun 23, 2017 11:05:22 AM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r218750 r218753 1 2017-06-23 Brent Fulgham <bfulgham@apple.com> 2 3 Avoid moving the same vector multiple times 4 https://bugs.webkit.org/show_bug.cgi?id=173748 5 <rdar://problem/32936804> 6 7 Reviewed by Chris Dumez. 8 9 We discovered that a Vector<String> was being moved inside a loop, causing it to be moved more than once. 10 We should never do this! 11 12 * UIProcess/WebProcessProxy.cpp: 13 (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores): 14 Do not perform a move at each step of the iteration. 15 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 16 (WebKit::WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains): Receive vector of top privately 17 controlled domains as a const reference. Copy this vector into the completion handler. Do not move 18 origins out of the vector in the inner loop. 19 (WebKit::WebsiteDataStore::removeDataForTopPrivatelyControlledDomains): Receive vector of top privately 20 controlled domains as a const reference. 21 * UIProcess/WebsiteData/WebsiteDataStore.h: 22 1 23 2017-06-23 Alex Christensen <achristensen@webkit.org> 2 24 -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp
r218506 r218753 258 258 visitedSessionIDs.add(dataStore.sessionID()); 259 259 callbackAggregator->addPendingCallback(); 260 dataStore.removeDataForTopPrivatelyControlledDomains(dataTypes, { }, WTFMove(topPrivatelyControlledDomains), [callbackAggregator, shouldNotifyPage, page](Vector<String>&& domainsWithDeletedWebsiteData) {260 dataStore.removeDataForTopPrivatelyControlledDomains(dataTypes, { }, topPrivatelyControlledDomains, [callbackAggregator, shouldNotifyPage, page](Vector<String>&& domainsWithDeletedWebsiteData) { 261 261 // When completing the task, we should be getting called on the main thread. 262 262 ASSERT(isMainThread()); -
trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp
r218506 r218753 508 508 } 509 509 510 void WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, Vector<String>&& topPrivatelyControlledDomains, Function<void(Vector<WebsiteDataRecord>&&, Vector<String>&&)>&& completionHandler)511 { 512 fetchData(dataTypes, fetchOptions, [topPrivatelyControlledDomains = WTFMove(topPrivatelyControlledDomains), completionHandler = WTFMove(completionHandler)](auto&& existingDataRecords) {510 void WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, const Vector<String>& topPrivatelyControlledDomains, Function<void(Vector<WebsiteDataRecord>&&, Vector<String>&&)>&& completionHandler) 511 { 512 fetchData(dataTypes, fetchOptions, [topPrivatelyControlledDomains, completionHandler = WTFMove(completionHandler)](auto&& existingDataRecords) { 513 513 Vector<WebsiteDataRecord> matchingDataRecords; 514 514 Vector<String> domainsWithMatchingDataRecords; 515 515 for (auto&& dataRecord : existingDataRecords) { 516 for (auto& &topPrivatelyControlledDomain : topPrivatelyControlledDomains) {516 for (auto& topPrivatelyControlledDomain : topPrivatelyControlledDomains) { 517 517 if (dataRecord.matchesTopPrivatelyControlledDomain(topPrivatelyControlledDomain)) { 518 518 matchingDataRecords.append(WTFMove(dataRecord)); … … 1077 1077 } 1078 1078 1079 void WebsiteDataStore::removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, Vector<String>&& topPrivatelyControlledDomains, Function<void(Vector<String>&&)>&& completionHandler)1080 { 1081 fetchDataForTopPrivatelyControlledDomains(dataTypes, fetchOptions, WTFMove(topPrivatelyControlledDomains), [dataTypes, completionHandler = WTFMove(completionHandler), this, protectedThis = makeRef(*this)](Vector<WebsiteDataRecord>&& websiteDataRecords, Vector<String>&& domainsWithDataRecords) mutable {1079 void WebsiteDataStore::removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, const Vector<String>& topPrivatelyControlledDomains, Function<void(Vector<String>&&)>&& completionHandler) 1080 { 1081 fetchDataForTopPrivatelyControlledDomains(dataTypes, fetchOptions, topPrivatelyControlledDomains, [dataTypes, completionHandler = WTFMove(completionHandler), this, protectedThis = makeRef(*this)](Vector<WebsiteDataRecord>&& websiteDataRecords, Vector<String>&& domainsWithDataRecords) mutable { 1082 1082 this->removeData(dataTypes, websiteDataRecords, [domainsWithDataRecords = WTFMove(domainsWithDataRecords), completionHandler = WTFMove(completionHandler)]() mutable { 1083 1083 completionHandler(WTFMove(domainsWithDataRecords)); -
trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h
r218457 r218753 95 95 96 96 void fetchData(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, Function<void(Vector<WebsiteDataRecord>)>&& completionHandler); 97 void fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, Vector<String>&& topPrivatelyControlledDomains, Function<void(Vector<WebsiteDataRecord>&&, Vector<String>&&)>&& completionHandler);97 void fetchDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(Vector<WebsiteDataRecord>&&, Vector<String>&&)>&& completionHandler); 98 98 void topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void(HashSet<String>&&)>&& completionHandler); 99 99 void removeData(OptionSet<WebsiteDataType>, std::chrono::system_clock::time_point modifiedSince, Function<void()>&& completionHandler); 100 100 void removeData(OptionSet<WebsiteDataType>, const Vector<WebsiteDataRecord>&, Function<void()>&& completionHandler); 101 void removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, Vector<String>&& topPrivatelyControlledDomains, Function<void(Vector<String>&&)>&& completionHandler);101 void removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(Vector<String>&&)>&& completionHandler); 102 102 103 103 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
Note: See TracChangeset
for help on using the changeset viewer.