Skip to content

Commit b6e19c5

Browse files
Remove out-parameter variants of copyToVector
https://bugs.webkit.org/show_bug.cgi?id=178155 Reviewed by Tim Horton. Source/JavaScriptCore: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::dispatchBreakpointActionLog): (Inspector::ScriptDebugServer::dispatchBreakpointActionSound): (Inspector::ScriptDebugServer::dispatchBreakpointActionProbe): (Inspector::ScriptDebugServer::dispatchDidParseSource): (Inspector::ScriptDebugServer::dispatchFailedToParseSource): (Inspector::ScriptDebugServer::dispatchFunctionToListeners): Replace out-parameter based copyToVector, with one that returns a Vector. Source/WebCore: * Modules/geolocation/Geolocation.cpp: (WebCore::Geolocation::stopTimersForOneShots): (WebCore::Geolocation::cancelAllRequests): (WebCore::Geolocation::handleError): (WebCore::Geolocation::makeSuccessCallbacks): * Modules/indexeddb/IDBDatabase.cpp: (WebCore::IDBDatabase::transaction): * Modules/indexeddb/IDBGetAllResult.cpp: (WebCore::IDBGetAllResult::allBlobFilePaths const): * Modules/indexeddb/server/MemoryIndex.cpp: (WebCore::IDBServer::MemoryIndex::notifyCursorsOfValueChange): (WebCore::IDBServer::MemoryIndex::notifyCursorsOfAllRecordsChanged): * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::dispatchInvalidationCallbacks): * dom/Document.cpp: (WebCore::Document::moveNodeIteratorsToNewDocument): (WebCore::Document::resume): (WebCore::Document::didAssociateFormControlsTimerFired): * dom/IdTargetObserverRegistry.cpp: (WebCore::IdTargetObserverRegistry::notifyObserversInternal): * dom/MutationObserver.cpp: (WebCore::MutationObserver::notifyMutationObservers): * dom/Node.cpp: (WebCore::Document::invalidateNodeListAndCollectionCaches): * dom/RadioButtonGroups.cpp: * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::dispatchMessagePortEvents): (WebCore::ScriptExecutionContext::stopActiveDOMObjects): * loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): (WebCore::ApplicationCacheGroup::deliverDelayedMainResources): * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::forEachResource): (WebCore::MemoryCache::pruneDeadResourcesToSize): * page/DOMWindow.cpp: (WebCore::DOMWindow::willDestroyCachedFrame): (WebCore::DOMWindow::willDestroyDocumentInFrame): (WebCore::DOMWindow::willDetachDocumentFromFrame): (WebCore::DOMWindow::disconnectDOMWindowProperties): (WebCore::DOMWindow::reconnectDOMWindowProperties): * page/FrameView.cpp: (WebCore::collectAndProtectWidgets): * page/MemoryRelease.cpp: (WebCore::releaseCriticalMemory): * page/Performance.cpp: (WebCore::Performance::queueEntry): * platform/cocoa/PasteboardCocoa.mm: (WebCore::Pasteboard::typesForLegacyUnsafeBindings): * platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::systemFontFamilies): * platform/ios/PlatformPasteboardIOS.mm: (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): * platform/ios/WebCoreMotionManager.mm: (-[WebCoreMotionManager sendAccelerometerData:]): (-[WebCoreMotionManager sendMotionData:withHeading:]): * platform/mac/PlatformPasteboardMac.mm: (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): * platform/network/cocoa/WebCoreNSURLSession.mm: (-[WebCoreNSURLSession invalidateAndCancel]): * rendering/RenderBlock.cpp: (WebCore::RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction): * rendering/RenderBlockLineLayout.cpp: (WebCore::setLogicalWidthForTextRun): * rendering/RenderDeprecatedFlexibleBox.cpp: (WebCore::FlexBoxIterator::next): * rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::paintObject): Replace out-parameter based copyToVector, with one that returns a Vector. Source/WebKit: * Shared/API/Cocoa/_WKRemoteObjectInterface.mm: (-[_WKRemoteObjectInterface debugDescription]): * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: (WebKit::dump): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::resetState): * UIProcess/WebProcessPool.cpp: (WebKit::WebProcessPool::createNewWebProcess): * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: (WebKit::WebsiteDataStore::parameters): * UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::pendingCookies const): * UIProcess/ios/ProcessAssertionIOS.mm: (-[WKProcessAssertionBackgroundTaskManager _notifyClientsOfImminentSuspension]): * WebProcess/Cookies/WebCookieManager.cpp: (WebKit::WebCookieManager::getHostnamesWithCookies): * WebProcess/Geolocation/WebGeolocationManager.cpp: (WebKit::WebGeolocationManager::didChangePosition): (WebKit::WebGeolocationManager::didFailToDeterminePosition): * WebProcess/Network/WebLoaderStrategy.cpp: (WebKit::WebLoaderStrategy::internallyFailedLoadTimerFired): Replace out-parameter based copyToVector, with one that returns a Vector. Source/WebKitLegacy/ios: * Misc/WebGeolocationProviderIOS.mm: (-[WebGeolocationProviderIOS _handlePendingInitialPosition:]): (-[WebGeolocationProviderIOS positionChanged:]): (-[WebGeolocationProviderIOS errorOccurred:]): (-[WebGeolocationProviderIOS resetGeolocation]): Replace out-parameter based copyToVector, with one that returns a Vector. Source/WebKitLegacy/mac: * Plugins/WebNetscapePluginView.mm: (-[WebNetscapePluginView destroyPlugin]): * WebView/WebHTMLRepresentation.mm: (newArrayWithStrings): Replace out-parameter based copyToVector, with one that returns a Vector. Source/WTF: * wtf/HashMap.h: (WTF::copyToVector): Deleted. * wtf/HashSet.h: (WTF::copyToVector): Deleted. Remove copyToVector. * wtf/Vector.h: (WTF::copyToVectorSpecialization): Add another version of copyToVector, called copyToVectorSpecialization, that allows you to specify the entire specialization for the Vector you want to copy to. This can be useful if you want your resulting Vector to have an inline capacity. Tools: * DumpRenderTree/JavaScriptThreading.cpp: (stopJavaScriptThreads): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@223238 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 6069db2 commit b6e19c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+293
-237
lines changed

Source/JavaScriptCore/ChangeLog

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2017-10-11 Sam Weinig <[email protected]>
2+
3+
Remove out-parameter variants of copyToVector
4+
https://bugs.webkit.org/show_bug.cgi?id=178155
5+
6+
Reviewed by Tim Horton.
7+
8+
* inspector/ScriptDebugServer.cpp:
9+
(Inspector::ScriptDebugServer::dispatchBreakpointActionLog):
10+
(Inspector::ScriptDebugServer::dispatchBreakpointActionSound):
11+
(Inspector::ScriptDebugServer::dispatchBreakpointActionProbe):
12+
(Inspector::ScriptDebugServer::dispatchDidParseSource):
13+
(Inspector::ScriptDebugServer::dispatchFailedToParseSource):
14+
(Inspector::ScriptDebugServer::dispatchFunctionToListeners):
15+
16+
Replace out-parameter based copyToVector, with one that returns a Vector.
17+
118
2017-10-12 Yusuke Suzuki <[email protected]>
219

320
Support integrity="" on module scripts

Source/JavaScriptCore/inspector/ScriptDebugServer.cpp

+9-21
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ void ScriptDebugServer::dispatchBreakpointActionLog(ExecState* exec, const Strin
145145

146146
SetForScope<bool> change(m_callingListeners, true);
147147

148-
Vector<ScriptDebugListener*> listenersCopy;
149-
copyToVector(m_listeners, listenersCopy);
150-
for (auto* listener : listenersCopy)
148+
for (auto* listener : copyToVector(m_listeners))
151149
listener->breakpointActionLog(*exec, message);
152150
}
153151

@@ -161,9 +159,7 @@ void ScriptDebugServer::dispatchBreakpointActionSound(ExecState*, int breakpoint
161159

162160
SetForScope<bool> change(m_callingListeners, true);
163161

164-
Vector<ScriptDebugListener*> listenersCopy;
165-
copyToVector(m_listeners, listenersCopy);
166-
for (auto* listener : listenersCopy)
162+
for (auto* listener : copyToVector(m_listeners))
167163
listener->breakpointActionSound(breakpointActionIdentifier);
168164
}
169165

@@ -179,9 +175,7 @@ void ScriptDebugServer::dispatchBreakpointActionProbe(ExecState* exec, const Scr
179175

180176
unsigned sampleId = m_nextProbeSampleId++;
181177

182-
Vector<ScriptDebugListener*> listenersCopy;
183-
copyToVector(m_listeners, listenersCopy);
184-
for (auto* listener : listenersCopy)
178+
for (auto* listener : copyToVector(m_listeners))
185179
listener->breakpointActionProbe(*exec, action, m_currentProbeBatchId, sampleId, sampleValue);
186180
}
187181

@@ -221,10 +215,8 @@ void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, Sou
221215
else
222216
script.endColumn = sourceLength - lastLineStart;
223217

224-
Vector<ScriptDebugListener*> copy;
225-
copyToVector(listeners, copy);
226-
for (size_t i = 0; i < copy.size(); ++i)
227-
copy[i]->didParseSource(sourceID, script);
218+
for (auto* listener : copyToVector(listeners))
219+
listener->didParseSource(sourceID, script);
228220
}
229221

230222
void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners, SourceProvider* sourceProvider, int errorLine, const String& errorMessage)
@@ -233,10 +225,8 @@ void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners
233225
String data = sourceProvider->source().toString();
234226
int firstLine = sourceProvider->startPosition().m_line.oneBasedInt();
235227

236-
Vector<ScriptDebugListener*> copy;
237-
copyToVector(listeners, copy);
238-
for (size_t i = 0; i < copy.size(); ++i)
239-
copy[i]->failedToParseSource(url, data, firstLine, errorLine, errorMessage);
228+
for (auto* listener : copyToVector(listeners))
229+
listener->failedToParseSource(url, data, firstLine, errorLine, errorMessage);
240230
}
241231

242232
void ScriptDebugServer::sourceParsed(ExecState* exec, SourceProvider* sourceProvider, int errorLine, const String& errorMessage)
@@ -271,10 +261,8 @@ void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback
271261

272262
void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback)
273263
{
274-
Vector<ScriptDebugListener*> copy;
275-
copyToVector(listeners, copy);
276-
for (size_t i = 0; i < copy.size(); ++i)
277-
(this->*callback)(copy[i]);
264+
for (auto* listener : copyToVector(listeners))
265+
(this->*callback)(listener);
278266
}
279267

280268
void ScriptDebugServer::notifyDoneProcessingDebuggerEvents()

Source/WTF/ChangeLog

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
2017-10-11 Sam Weinig <[email protected]>
2+
3+
Remove out-parameter variants of copyToVector
4+
https://bugs.webkit.org/show_bug.cgi?id=178155
5+
6+
Reviewed by Tim Horton.
7+
8+
* wtf/HashMap.h:
9+
(WTF::copyToVector): Deleted.
10+
* wtf/HashSet.h:
11+
(WTF::copyToVector): Deleted.
12+
13+
Remove copyToVector.
14+
15+
* wtf/Vector.h:
16+
(WTF::copyToVectorSpecialization):
17+
18+
Add another version of copyToVector, called copyToVectorSpecialization, that allows
19+
you to specify the entire specialization for the Vector you want to copy to. This
20+
can be useful if you want your resulting Vector to have an inline capacity.
21+
122
2017-10-12 Sam Weinig <[email protected]>
223

324
It should be possible to iterate just the values (and not the counts) of a HashCountedSet

Source/WTF/wtf/HashMap.h

-13
Original file line numberDiff line numberDiff line change
@@ -576,19 +576,6 @@ inline bool operator!=(const HashMap<T, U, V, W, X>& a, const HashMap<T, U, V, W
576576
return !(a == b);
577577
}
578578

579-
template<typename T, typename U, typename V, typename W, typename X, typename Y>
580-
inline void copyToVector(const HashMap<T, U, V, W, X>& collection, Y& vector)
581-
{
582-
typedef typename HashMap<T, U, V, W, X>::const_iterator iterator;
583-
584-
vector.resize(collection.size());
585-
586-
iterator it = collection.begin();
587-
iterator end = collection.end();
588-
for (unsigned i = 0; it != end; ++it, ++i)
589-
vector[i] = { (*it).key, (*it).value };
590-
}
591-
592579
} // namespace WTF
593580

594581
using WTF::HashMap;

Source/WTF/wtf/HashSet.h

-7
Original file line numberDiff line numberDiff line change
@@ -355,13 +355,6 @@ namespace WTF {
355355
return true;
356356
}
357357

358-
template<typename C, typename W>
359-
inline void copyToVector(const C& collection, W& vector)
360-
{
361-
vector.resize(collection.size());
362-
std::copy(collection.begin(), collection.end(), vector.begin());
363-
}
364-
365358
template<typename T, typename U, typename V>
366359
template<typename OtherCollection>
367360
inline bool HashSet<T, U, V>::operator==(const OtherCollection& otherCollection) const

Source/WTF/wtf/Vector.h

+12
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,17 @@ Vector<typename Mapper<MapFunction, SourceType>::DestinationItemType> map(Source
16341634
return Mapper<MapFunction, SourceType>::map(std::forward<SourceType>(source), std::forward<MapFunction>(mapFunction));
16351635
}
16361636

1637+
template<typename DestinationVector, typename Collection>
1638+
inline auto copyToVectorSpecialization(const Collection& collection) -> DestinationVector
1639+
{
1640+
DestinationVector result;
1641+
// FIXME: Use std::size when available on all compilers.
1642+
result.reserveInitialCapacity(collection.size());
1643+
for (auto& item : collection)
1644+
result.uncheckedAppend(item);
1645+
return result;
1646+
}
1647+
16371648
template<typename DestinationItemType, typename Collection>
16381649
inline auto copyToVectorOf(const Collection& collection) -> Vector<DestinationItemType>
16391650
{
@@ -1657,6 +1668,7 @@ using WTF::UnsafeVectorOverflow;
16571668
using WTF::Vector;
16581669
using WTF::copyToVector;
16591670
using WTF::copyToVectorOf;
1671+
using WTF::copyToVectorSpecialization;
16601672
using WTF::removeRepeatedElements;
16611673

16621674
#endif // WTF_Vector_h

Source/WebCore/ChangeLog

+77-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,80 @@
1+
2017-10-11 Sam Weinig <[email protected]>
2+
3+
Remove out-parameter variants of copyToVector
4+
https://bugs.webkit.org/show_bug.cgi?id=178155
5+
6+
Reviewed by Tim Horton.
7+
8+
* Modules/geolocation/Geolocation.cpp:
9+
(WebCore::Geolocation::stopTimersForOneShots):
10+
(WebCore::Geolocation::cancelAllRequests):
11+
(WebCore::Geolocation::handleError):
12+
(WebCore::Geolocation::makeSuccessCallbacks):
13+
* Modules/indexeddb/IDBDatabase.cpp:
14+
(WebCore::IDBDatabase::transaction):
15+
* Modules/indexeddb/IDBGetAllResult.cpp:
16+
(WebCore::IDBGetAllResult::allBlobFilePaths const):
17+
* Modules/indexeddb/server/MemoryIndex.cpp:
18+
(WebCore::IDBServer::MemoryIndex::notifyCursorsOfValueChange):
19+
(WebCore::IDBServer::MemoryIndex::notifyCursorsOfAllRecordsChanged):
20+
* css/CSSFontSelector.cpp:
21+
(WebCore::CSSFontSelector::dispatchInvalidationCallbacks):
22+
* dom/Document.cpp:
23+
(WebCore::Document::moveNodeIteratorsToNewDocument):
24+
(WebCore::Document::resume):
25+
(WebCore::Document::didAssociateFormControlsTimerFired):
26+
* dom/IdTargetObserverRegistry.cpp:
27+
(WebCore::IdTargetObserverRegistry::notifyObserversInternal):
28+
* dom/MutationObserver.cpp:
29+
(WebCore::MutationObserver::notifyMutationObservers):
30+
* dom/Node.cpp:
31+
(WebCore::Document::invalidateNodeListAndCollectionCaches):
32+
* dom/RadioButtonGroups.cpp:
33+
* dom/ScriptExecutionContext.cpp:
34+
(WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
35+
(WebCore::ScriptExecutionContext::stopActiveDOMObjects):
36+
* loader/appcache/ApplicationCacheGroup.cpp:
37+
(WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
38+
(WebCore::ApplicationCacheGroup::deliverDelayedMainResources):
39+
* loader/cache/MemoryCache.cpp:
40+
(WebCore::MemoryCache::forEachResource):
41+
(WebCore::MemoryCache::pruneDeadResourcesToSize):
42+
* page/DOMWindow.cpp:
43+
(WebCore::DOMWindow::willDestroyCachedFrame):
44+
(WebCore::DOMWindow::willDestroyDocumentInFrame):
45+
(WebCore::DOMWindow::willDetachDocumentFromFrame):
46+
(WebCore::DOMWindow::disconnectDOMWindowProperties):
47+
(WebCore::DOMWindow::reconnectDOMWindowProperties):
48+
* page/FrameView.cpp:
49+
(WebCore::collectAndProtectWidgets):
50+
* page/MemoryRelease.cpp:
51+
(WebCore::releaseCriticalMemory):
52+
* page/Performance.cpp:
53+
(WebCore::Performance::queueEntry):
54+
* platform/cocoa/PasteboardCocoa.mm:
55+
(WebCore::Pasteboard::typesForLegacyUnsafeBindings):
56+
* platform/graphics/cocoa/FontCacheCoreText.cpp:
57+
(WebCore::FontCache::systemFontFamilies):
58+
* platform/ios/PlatformPasteboardIOS.mm:
59+
(WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
60+
* platform/ios/WebCoreMotionManager.mm:
61+
(-[WebCoreMotionManager sendAccelerometerData:]):
62+
(-[WebCoreMotionManager sendMotionData:withHeading:]):
63+
* platform/mac/PlatformPasteboardMac.mm:
64+
(WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
65+
* platform/network/cocoa/WebCoreNSURLSession.mm:
66+
(-[WebCoreNSURLSession invalidateAndCancel]):
67+
* rendering/RenderBlock.cpp:
68+
(WebCore::RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction):
69+
* rendering/RenderBlockLineLayout.cpp:
70+
(WebCore::setLogicalWidthForTextRun):
71+
* rendering/RenderDeprecatedFlexibleBox.cpp:
72+
(WebCore::FlexBoxIterator::next):
73+
* rendering/RenderTableSection.cpp:
74+
(WebCore::RenderTableSection::paintObject):
75+
76+
Replace out-parameter based copyToVector, with one that returns a Vector.
77+
178
2017-10-12 Yusuke Suzuki <[email protected]>
279

380
Support integrity="" on module scripts
@@ -83505,8 +83582,6 @@
8350583582
(WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges):
8350683583
* page/DOMWindow.cpp:
8350783584
(WebCore::DOMWindow::postMessage):
83508-
* page/DeviceController.cpp:
83509-
(WebCore::DeviceController::addDeviceEventListener):
8351083585
* page/EventHandler.cpp:
8351183586
(WebCore::EventHandler::scheduleHoverStateUpdate):
8351283587
* page/EventSource.cpp:

Source/WebCore/Modules/geolocation/Geolocation.cpp

+4-9
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,7 @@ void Geolocation::stopTimer(GeoNotifierVector& notifiers)
543543

544544
void Geolocation::stopTimersForOneShots()
545545
{
546-
GeoNotifierVector copy;
547-
copyToVector(m_oneShots, copy);
548-
546+
auto copy = copyToVector(m_oneShots);
549547
stopTimer(copy);
550548
}
551549

@@ -571,8 +569,7 @@ void Geolocation::cancelRequests(GeoNotifierVector& notifiers)
571569

572570
void Geolocation::cancelAllRequests()
573571
{
574-
GeoNotifierVector copy;
575-
copyToVector(m_oneShots, copy);
572+
auto copy = copyToVector(m_oneShots);
576573
cancelRequests(copy);
577574
m_watchers.getNotifiersVector(copy);
578575
cancelRequests(copy);
@@ -599,8 +596,7 @@ void Geolocation::copyToSet(const GeoNotifierVector& src, GeoNotifierSet& dest)
599596

600597
void Geolocation::handleError(PositionError& error)
601598
{
602-
GeoNotifierVector oneShotsCopy;
603-
copyToVector(m_oneShots, oneShotsCopy);
599+
auto oneShotsCopy = copyToVector(m_oneShots);
604600

605601
GeoNotifierVector watchersCopy;
606602
m_watchers.getNotifiersVector(watchersCopy);
@@ -651,8 +647,7 @@ void Geolocation::makeSuccessCallbacks(Geoposition& position)
651647
ASSERT(lastPosition());
652648
ASSERT(isAllowed());
653649

654-
GeoNotifierVector oneShotsCopy;
655-
copyToVector(m_oneShots, oneShotsCopy);
650+
auto oneShotsCopy = copyToVector(m_oneShots);
656651

657652
GeoNotifierVector watchersCopy;
658653
m_watchers.getNotifiersVector(watchersCopy);

Source/WebCore/Modules/indexeddb/IDBDatabase.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ ExceptionOr<Ref<IDBTransaction>> IDBDatabase::transaction(StringOrVectorOfString
191191
for (auto& objectStore : objectStores)
192192
objectStoreSet.add(objectStore);
193193

194-
objectStores.clear();
195-
copyToVector(objectStoreSet, objectStores);
194+
objectStores = copyToVector(objectStoreSet);
196195

197196
for (auto& objectStoreName : objectStores) {
198197
if (m_info.hasObjectStore(objectStoreName))

Source/WebCore/Modules/indexeddb/IDBGetAllResult.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ Vector<String> IDBGetAllResult::allBlobFilePaths() const
107107
pathSet.add(path);
108108
}
109109

110-
Vector<String> paths;
111-
copyToVector(pathSet, paths);
112-
113-
return paths;
110+
return copyToVector(pathSet);
114111
}
115112

116113
} // namespace WebCore

Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,13 @@ void MemoryIndex::objectStoreCleared()
7979

8080
void MemoryIndex::notifyCursorsOfValueChange(const IDBKeyData& indexKey, const IDBKeyData& primaryKey)
8181
{
82-
Vector<MemoryIndexCursor*> cursors;
83-
copyToVector(m_cleanCursors, cursors);
84-
for (auto* cursor : cursors)
82+
for (auto* cursor : copyToVector(m_cleanCursors))
8583
cursor->indexValueChanged(indexKey, primaryKey);
8684
}
8785

8886
void MemoryIndex::notifyCursorsOfAllRecordsChanged()
8987
{
90-
Vector<MemoryIndexCursor*> cursors;
91-
copyToVector(m_cleanCursors, cursors);
92-
for (auto* cursor : cursors)
88+
for (auto* cursor : copyToVector(m_cleanCursors))
9389
cursor->indexRecordsAllChanged();
9490

9591
ASSERT(m_cleanCursors.isEmpty());

Source/WebCore/css/CSSFontSelector.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,8 @@ void CSSFontSelector::dispatchInvalidationCallbacks()
239239
{
240240
++m_version;
241241

242-
Vector<FontSelectorClient*> clients;
243-
copyToVector(m_clients, clients);
244-
for (size_t i = 0; i < clients.size(); ++i)
245-
clients[i]->fontsNeedUpdate(*this);
242+
for (auto& client : copyToVector(m_clients))
243+
client->fontsNeedUpdate(*this);
246244
}
247245

248246
void CSSFontSelector::fontLoaded()

Source/WebCore/dom/Document.cpp

+3-10
Original file line numberDiff line numberDiff line change
@@ -4037,9 +4037,7 @@ void Document::detachNodeIterator(NodeIterator* ni)
40374037

40384038
void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument)
40394039
{
4040-
Vector<NodeIterator*> nodeIterators;
4041-
copyToVector(m_nodeIterators, nodeIterators);
4042-
for (auto* it : nodeIterators) {
4040+
for (auto* it : copyToVector(m_nodeIterators)) {
40434041
if (&it->root() == &node) {
40444042
detachNodeIterator(it);
40454043
newDocument.attachNodeIterator(it);
@@ -4827,9 +4825,7 @@ void Document::resume(ActiveDOMObject::ReasonForSuspension reason)
48274825
if (!m_isSuspended)
48284826
return;
48294827

4830-
Vector<Element*> elements;
4831-
copyToVector(m_documentSuspensionCallbackElements, elements);
4832-
for (auto* element : elements)
4828+
for (auto* element : copyToVector(m_documentSuspensionCallbackElements))
48334829
element->resumeFromDocumentSuspension();
48344830

48354831
if (renderView())
@@ -6869,10 +6865,7 @@ void Document::didAssociateFormControlsTimerFired()
68696865
if (!frame() || !frame()->page())
68706866
return;
68716867

6872-
Vector<RefPtr<Element>> associatedFormControls;
6873-
copyToVector(m_associatedFormControls, associatedFormControls);
6874-
6875-
frame()->page()->chrome().client().didAssociateFormControls(associatedFormControls);
6868+
frame()->page()->chrome().client().didAssociateFormControls(copyToVector(m_associatedFormControls));
68766869
m_associatedFormControls.clear();
68776870
}
68786871

0 commit comments

Comments
 (0)