Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (223237 => 223238)
--- trunk/Source/_javascript_Core/ChangeLog 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1,3 +1,20 @@
+2017-10-11 Sam Weinig <s...@webkit.org>
+
+ Remove out-parameter variants of copyToVector
+ https://bugs.webkit.org/show_bug.cgi?id=178155
+
+ Reviewed by Tim Horton.
+
+ * 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.
+
2017-10-12 Yusuke Suzuki <utatane....@gmail.com>
Support integrity="" on module scripts
Modified: trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp (223237 => 223238)
--- trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -145,9 +145,7 @@
SetForScope<bool> change(m_callingListeners, true);
- Vector<ScriptDebugListener*> listenersCopy;
- copyToVector(m_listeners, listenersCopy);
- for (auto* listener : listenersCopy)
+ for (auto* listener : copyToVector(m_listeners))
listener->breakpointActionLog(*exec, message);
}
@@ -161,9 +159,7 @@
SetForScope<bool> change(m_callingListeners, true);
- Vector<ScriptDebugListener*> listenersCopy;
- copyToVector(m_listeners, listenersCopy);
- for (auto* listener : listenersCopy)
+ for (auto* listener : copyToVector(m_listeners))
listener->breakpointActionSound(breakpointActionIdentifier);
}
@@ -179,9 +175,7 @@
unsigned sampleId = m_nextProbeSampleId++;
- Vector<ScriptDebugListener*> listenersCopy;
- copyToVector(m_listeners, listenersCopy);
- for (auto* listener : listenersCopy)
+ for (auto* listener : copyToVector(m_listeners))
listener->breakpointActionProbe(*exec, action, m_currentProbeBatchId, sampleId, sampleValue);
}
@@ -221,10 +215,8 @@
else
script.endColumn = sourceLength - lastLineStart;
- Vector<ScriptDebugListener*> copy;
- copyToVector(listeners, copy);
- for (size_t i = 0; i < copy.size(); ++i)
- copy[i]->didParseSource(sourceID, script);
+ for (auto* listener : copyToVector(listeners))
+ listener->didParseSource(sourceID, script);
}
void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners, SourceProvider* sourceProvider, int errorLine, const String& errorMessage)
@@ -233,10 +225,8 @@
String data = ""
int firstLine = sourceProvider->startPosition().m_line.oneBasedInt();
- Vector<ScriptDebugListener*> copy;
- copyToVector(listeners, copy);
- for (size_t i = 0; i < copy.size(); ++i)
- copy[i]->failedToParseSource(url, data, firstLine, errorLine, errorMessage);
+ for (auto* listener : copyToVector(listeners))
+ listener->failedToParseSource(url, data, firstLine, errorLine, errorMessage);
}
void ScriptDebugServer::sourceParsed(ExecState* exec, SourceProvider* sourceProvider, int errorLine, const String& errorMessage)
@@ -271,10 +261,8 @@
void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners, _javascript_ExecutionCallback callback)
{
- Vector<ScriptDebugListener*> copy;
- copyToVector(listeners, copy);
- for (size_t i = 0; i < copy.size(); ++i)
- (this->*callback)(copy[i]);
+ for (auto* listener : copyToVector(listeners))
+ (this->*callback)(listener);
}
void ScriptDebugServer::notifyDoneProcessingDebuggerEvents()
Modified: trunk/Source/WTF/ChangeLog (223237 => 223238)
--- trunk/Source/WTF/ChangeLog 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WTF/ChangeLog 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1,3 +1,24 @@
+2017-10-11 Sam Weinig <s...@webkit.org>
+
+ Remove out-parameter variants of copyToVector
+ https://bugs.webkit.org/show_bug.cgi?id=178155
+
+ Reviewed by Tim Horton.
+
+ * 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.
+
2017-10-12 Sam Weinig <s...@webkit.org>
It should be possible to iterate just the values (and not the counts) of a HashCountedSet
Modified: trunk/Source/WTF/wtf/HashMap.h (223237 => 223238)
--- trunk/Source/WTF/wtf/HashMap.h 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WTF/wtf/HashMap.h 2017-10-12 15:38:42 UTC (rev 223238)
@@ -576,19 +576,6 @@
return !(a == b);
}
-template<typename T, typename U, typename V, typename W, typename X, typename Y>
-inline void copyToVector(const HashMap<T, U, V, W, X>& collection, Y& vector)
-{
- typedef typename HashMap<T, U, V, W, X>::const_iterator iterator;
-
- vector.resize(collection.size());
-
- iterator it = collection.begin();
- iterator end = collection.end();
- for (unsigned i = 0; it != end; ++it, ++i)
- vector[i] = { (*it).key, (*it).value };
-}
-
} // namespace WTF
using WTF::HashMap;
Modified: trunk/Source/WTF/wtf/HashSet.h (223237 => 223238)
--- trunk/Source/WTF/wtf/HashSet.h 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WTF/wtf/HashSet.h 2017-10-12 15:38:42 UTC (rev 223238)
@@ -355,13 +355,6 @@
return true;
}
- template<typename C, typename W>
- inline void copyToVector(const C& collection, W& vector)
- {
- vector.resize(collection.size());
- std::copy(collection.begin(), collection.end(), vector.begin());
- }
-
template<typename T, typename U, typename V>
template<typename OtherCollection>
inline bool HashSet<T, U, V>::operator==(const OtherCollection& otherCollection) const
Modified: trunk/Source/WTF/wtf/Vector.h (223237 => 223238)
--- trunk/Source/WTF/wtf/Vector.h 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WTF/wtf/Vector.h 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1634,6 +1634,17 @@
return Mapper<MapFunction, SourceType>::map(std::forward<SourceType>(source), std::forward<MapFunction>(mapFunction));
}
+template<typename DestinationVector, typename Collection>
+inline auto copyToVectorSpecialization(const Collection& collection) -> DestinationVector
+{
+ DestinationVector result;
+ // FIXME: Use std::size when available on all compilers.
+ result.reserveInitialCapacity(collection.size());
+ for (auto& item : collection)
+ result.uncheckedAppend(item);
+ return result;
+}
+
template<typename DestinationItemType, typename Collection>
inline auto copyToVectorOf(const Collection& collection) -> Vector<DestinationItemType>
{
@@ -1657,6 +1668,7 @@
using WTF::Vector;
using WTF::copyToVector;
using WTF::copyToVectorOf;
+using WTF::copyToVectorSpecialization;
using WTF::removeRepeatedElements;
#endif // WTF_Vector_h
Modified: trunk/Source/WebCore/ChangeLog (223237 => 223238)
--- trunk/Source/WebCore/ChangeLog 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/ChangeLog 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1,3 +1,80 @@
+2017-10-11 Sam Weinig <s...@webkit.org>
+
+ Remove out-parameter variants of copyToVector
+ https://bugs.webkit.org/show_bug.cgi?id=178155
+
+ Reviewed by Tim Horton.
+
+ * 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.
+
2017-10-12 Yusuke Suzuki <utatane....@gmail.com>
Support integrity="" on module scripts
@@ -83505,8 +83582,6 @@
(WebCore::CaptionUserPreferencesMediaAF::setInterestedInCaptionPreferenceChanges):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
- * page/DeviceController.cpp:
- (WebCore::DeviceController::addDeviceEventListener):
* page/EventHandler.cpp:
(WebCore::EventHandler::scheduleHoverStateUpdate):
* page/EventSource.cpp:
Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (223237 => 223238)
--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -543,9 +543,7 @@
void Geolocation::stopTimersForOneShots()
{
- GeoNotifierVector copy;
- copyToVector(m_oneShots, copy);
-
+ auto copy = copyToVector(m_oneShots);
stopTimer(copy);
}
@@ -571,8 +569,7 @@
void Geolocation::cancelAllRequests()
{
- GeoNotifierVector copy;
- copyToVector(m_oneShots, copy);
+ auto copy = copyToVector(m_oneShots);
cancelRequests(copy);
m_watchers.getNotifiersVector(copy);
cancelRequests(copy);
@@ -599,8 +596,7 @@
void Geolocation::handleError(PositionError& error)
{
- GeoNotifierVector oneShotsCopy;
- copyToVector(m_oneShots, oneShotsCopy);
+ auto _oneShotsCopy_ = copyToVector(m_oneShots);
GeoNotifierVector watchersCopy;
m_watchers.getNotifiersVector(watchersCopy);
@@ -651,8 +647,7 @@
ASSERT(lastPosition());
ASSERT(isAllowed());
- GeoNotifierVector oneShotsCopy;
- copyToVector(m_oneShots, oneShotsCopy);
+ auto _oneShotsCopy_ = copyToVector(m_oneShots);
GeoNotifierVector watchersCopy;
m_watchers.getNotifiersVector(watchersCopy);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (223237 => 223238)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -191,8 +191,7 @@
for (auto& objectStore : objectStores)
objectStoreSet.add(objectStore);
- objectStores.clear();
- copyToVector(objectStoreSet, objectStores);
+ objectStores = copyToVector(objectStoreSet);
for (auto& objectStoreName : objectStores) {
if (m_info.hasObjectStore(objectStoreName))
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBGetAllResult.cpp (223237 => 223238)
--- trunk/Source/WebCore/Modules/indexeddb/IDBGetAllResult.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBGetAllResult.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -107,10 +107,7 @@
pathSet.add(path);
}
- Vector<String> paths;
- copyToVector(pathSet, paths);
-
- return paths;
+ return copyToVector(pathSet);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp (223237 => 223238)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -79,17 +79,13 @@
void MemoryIndex::notifyCursorsOfValueChange(const IDBKeyData& indexKey, const IDBKeyData& primaryKey)
{
- Vector<MemoryIndexCursor*> cursors;
- copyToVector(m_cleanCursors, cursors);
- for (auto* cursor : cursors)
+ for (auto* cursor : copyToVector(m_cleanCursors))
cursor->indexValueChanged(indexKey, primaryKey);
}
void MemoryIndex::notifyCursorsOfAllRecordsChanged()
{
- Vector<MemoryIndexCursor*> cursors;
- copyToVector(m_cleanCursors, cursors);
- for (auto* cursor : cursors)
+ for (auto* cursor : copyToVector(m_cleanCursors))
cursor->indexRecordsAllChanged();
ASSERT(m_cleanCursors.isEmpty());
Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (223237 => 223238)
--- trunk/Source/WebCore/css/CSSFontSelector.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -239,10 +239,8 @@
{
++m_version;
- Vector<FontSelectorClient*> clients;
- copyToVector(m_clients, clients);
- for (size_t i = 0; i < clients.size(); ++i)
- clients[i]->fontsNeedUpdate(*this);
+ for (auto& client : copyToVector(m_clients))
+ client->fontsNeedUpdate(*this);
}
void CSSFontSelector::fontLoaded()
Modified: trunk/Source/WebCore/dom/Document.cpp (223237 => 223238)
--- trunk/Source/WebCore/dom/Document.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/dom/Document.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -4037,9 +4037,7 @@
void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument)
{
- Vector<NodeIterator*> nodeIterators;
- copyToVector(m_nodeIterators, nodeIterators);
- for (auto* it : nodeIterators) {
+ for (auto* it : copyToVector(m_nodeIterators)) {
if (&it->root() == &node) {
detachNodeIterator(it);
newDocument.attachNodeIterator(it);
@@ -4827,9 +4825,7 @@
if (!m_isSuspended)
return;
- Vector<Element*> elements;
- copyToVector(m_documentSuspensionCallbackElements, elements);
- for (auto* element : elements)
+ for (auto* element : copyToVector(m_documentSuspensionCallbackElements))
element->resumeFromDocumentSuspension();
if (renderView())
@@ -6869,10 +6865,7 @@
if (!frame() || !frame()->page())
return;
- Vector<RefPtr<Element>> associatedFormControls;
- copyToVector(m_associatedFormControls, associatedFormControls);
-
- frame()->page()->chrome().client().didAssociateFormControls(associatedFormControls);
+ frame()->page()->chrome().client().didAssociateFormControls(copyToVector(m_associatedFormControls));
m_associatedFormControls.clear();
}
Modified: trunk/Source/WebCore/dom/IdTargetObserverRegistry.cpp (223237 => 223238)
--- trunk/Source/WebCore/dom/IdTargetObserverRegistry.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/dom/IdTargetObserverRegistry.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -63,9 +63,7 @@
if (!m_notifyingObserversInSet)
return;
- Vector<IdTargetObserver*> copy;
- copyToVector(*m_notifyingObserversInSet, copy);
- for (auto& observer : copy) {
+ for (auto& observer : copyToVector(*m_notifyingObserversInSet)) {
if (m_notifyingObserversInSet->contains(observer))
observer->idTargetChanged();
}
Modified: trunk/Source/WebCore/dom/MutationObserver.cpp (223237 => 223238)
--- trunk/Source/WebCore/dom/MutationObserver.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/dom/MutationObserver.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -248,9 +248,7 @@
deliveryInProgress = true;
if (!suspendedMutationObservers().isEmpty()) {
- Vector<RefPtr<MutationObserver>> suspended;
- copyToVector(suspendedMutationObservers(), suspended);
- for (auto& observer : suspended) {
+ for (auto& observer : copyToVector(suspendedMutationObservers())) {
if (!observer->canDeliver())
continue;
@@ -261,8 +259,7 @@
while (!activeMutationObservers().isEmpty() || !signalSlotList().isEmpty()) {
// 2. Let notify list be a copy of unit of related similar-origin browsing contexts' list of MutationObserver objects.
- Vector<RefPtr<MutationObserver>> notifyList;
- copyToVector(activeMutationObservers(), notifyList);
+ auto notifyList = copyToVector(activeMutationObservers());
activeMutationObservers().clear();
std::sort(notifyList.begin(), notifyList.end(), [](auto& lhs, auto& rhs) {
return lhs->m_priority < rhs->m_priority;
Modified: trunk/Source/WebCore/dom/Node.cpp (223237 => 223238)
--- trunk/Source/WebCore/dom/Node.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/dom/Node.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -853,14 +853,10 @@
template <typename InvalidationFunction>
void Document::invalidateNodeListAndCollectionCaches(InvalidationFunction invalidate)
{
- Vector<LiveNodeList*, 8> lists;
- copyToVector(m_listsInvalidatedAtDocument, lists);
- for (auto* list : lists)
+ for (auto* list : copyToVectorSpecialization<Vector<LiveNodeList*, 8>>(m_listsInvalidatedAtDocument))
invalidate(*list);
- Vector<HTMLCollection*, 8> collections;
- copyToVector(m_collectionsInvalidatedAtDocument, collections);
- for (auto* collection : collections)
+ for (auto* collection : copyToVectorSpecialization<Vector<HTMLCollection*, 8>>(m_collectionsInvalidatedAtDocument))
invalidate(*collection);
}
Modified: trunk/Source/WebCore/dom/RadioButtonGroups.cpp (223237 => 223238)
--- trunk/Source/WebCore/dom/RadioButtonGroups.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/dom/RadioButtonGroups.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -66,8 +66,7 @@
Vector<HTMLInputElement*> RadioButtonGroup::members() const
{
- Vector<HTMLInputElement*> members;
- copyToVector(m_members, members);
+ auto members = copyToVector(m_members);
std::sort(members.begin(), members.end(), documentOrderComparator);
return members;
}
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (223237 => 223238)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -143,9 +143,7 @@
m_willProcessMessagePortMessagesSoon = false;
// Make a frozen copy of the ports so we can iterate while new ones might be added or destroyed.
- Vector<MessagePort*> possibleMessagePorts;
- copyToVector(m_messagePorts, possibleMessagePorts);
- for (auto* messagePort : possibleMessagePorts) {
+ for (auto* messagePort : copyToVector(m_messagePorts)) {
// The port may be destroyed, and another one created at the same address,
// but this is harmless. The worst that can happen as a result is that
// dispatchMessages() will be called needlessly.
@@ -279,8 +277,7 @@
m_activeDOMObjectsAreStopped = true;
// Make a frozen copy of the objects so we can iterate while new ones might be destroyed.
- Vector<ActiveDOMObject*> possibleActiveDOMObjects;
- copyToVector(m_activeDOMObjects, possibleActiveDOMObjects);
+ auto possibleActiveDOMObjects = copyToVector(m_activeDOMObjects);
m_activeDOMObjectAdditionForbidden = true;
Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (223237 => 223238)
--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -930,9 +930,7 @@
// some other cache in this group. They are not associated with the failed new cache.
// Need to copy loaders, because the cache group may be destroyed at the end of iteration.
- Vector<DocumentLoader*> loaders;
- copyToVector(m_pendingMasterResourceLoaders, loaders);
- for (auto& loader : loaders)
+ for (auto& loader : copyToVector(m_pendingMasterResourceLoaders))
disassociateDocumentLoader(*loader); // This can delete this group.
// Reinstate the oldNewestCache, if there was one.
@@ -979,8 +977,7 @@
void ApplicationCacheGroup::deliverDelayedMainResources()
{
// Need to copy loaders, because the cache group may be destroyed at the end of iteration.
- Vector<DocumentLoader*> loaders;
- copyToVector(m_pendingMasterResourceLoaders, loaders);
+ auto loaders = copyToVector(m_pendingMasterResourceLoaders);
for (auto* loader : loaders) {
if (loader->isLoadingMainResource())
continue;
Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (223237 => 223238)
--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -265,9 +265,7 @@
void MemoryCache::forEachResource(const WTF::Function<void(CachedResource&)>& function)
{
for (auto& unprotectedLRUList : m_allResources) {
- Vector<CachedResourceHandle<CachedResource>> lruList;
- copyToVector(*unprotectedLRUList, lruList);
- for (auto& resource : lruList)
+ for (auto& resource : copyToVector(*unprotectedLRUList))
function(*resource);
}
}
@@ -363,8 +361,7 @@
for (int i = m_allResources.size() - 1; i >= 0; i--) {
// Make a copy of the LRUList first (and ref the resources) as calling
// destroyDecodedData() can alter the LRUList.
- Vector<CachedResourceHandle<CachedResource>> lruList;
- copyToVector(*m_allResources[i], lruList);
+ auto lruList = copyToVector(*m_allResources[i]);
// First flush all the decoded data in this queue.
// Remove from the head, since this is the least frequently accessed of the objects.
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (223237 => 223238)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -482,9 +482,7 @@
{
// It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
// unregister themselves from the DOMWindow as a result of the call to willDestroyGlobalObjectInCachedFrame.
- Vector<DOMWindowProperty*> properties;
- copyToVector(m_properties, properties);
- for (auto& property : properties)
+ for (auto& property : copyToVector(m_properties))
property->willDestroyGlobalObjectInCachedFrame();
}
@@ -492,9 +490,7 @@
{
// It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
// unregister themselves from the DOMWindow as a result of the call to willDestroyGlobalObjectInFrame.
- Vector<DOMWindowProperty*> properties;
- copyToVector(m_properties, properties);
- for (auto& property : properties)
+ for (auto& property : copyToVector(m_properties))
property->willDestroyGlobalObjectInFrame();
}
@@ -502,9 +498,7 @@
{
// It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
// unregister themselves from the DOMWindow as a result of the call to willDetachGlobalObjectFromFrame.
- Vector<DOMWindowProperty*> properties;
- copyToVector(m_properties, properties);
- for (auto& property : properties)
+ for (auto& property : copyToVector(m_properties))
property->willDetachGlobalObjectFromFrame();
if (m_performance)
@@ -563,9 +557,7 @@
{
// It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
// unregister themselves from the DOMWindow as a result of the call to disconnectFrameForDocumentSuspension.
- Vector<DOMWindowProperty*> properties;
- copyToVector(m_properties, properties);
- for (auto& property : properties)
+ for (auto& property : copyToVector(m_properties))
property->disconnectFrameForDocumentSuspension();
}
@@ -574,9 +566,7 @@
ASSERT(m_suspendedForDocumentSuspension);
// It is necessary to copy m_properties to a separate vector because the DOMWindowProperties may
// unregister themselves from the DOMWindow as a result of the call to reconnectFromPageCache.
- Vector<DOMWindowProperty*> properties;
- copyToVector(m_properties, properties);
- for (auto& property : properties)
+ for (auto& property : copyToVector(m_properties))
property->reconnectFrameFromDocumentSuspension(m_frame);
}
Modified: trunk/Source/WebCore/page/FrameView.cpp (223237 => 223238)
--- trunk/Source/WebCore/page/FrameView.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/page/FrameView.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -5344,9 +5344,7 @@
static Vector<RefPtr<Widget>> collectAndProtectWidgets(const HashSet<Widget*>& set)
{
- Vector<RefPtr<Widget>> widgets;
- copyToVector(set, widgets);
- return widgets;
+ return copyToVectorOf<RefPtr<Widget>>(set);
}
void FrameView::updateWidgetPositions()
Modified: trunk/Source/WebCore/page/MemoryRelease.cpp (223237 => 223238)
--- trunk/Source/WebCore/page/MemoryRelease.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/page/MemoryRelease.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -83,9 +83,7 @@
CSSValuePool::singleton().drain();
- Vector<RefPtr<Document>> documents;
- copyToVector(Document::allDocuments(), documents);
- for (auto& document : documents) {
+ for (auto& document : copyToVectorOf<RefPtr<Document>>(Document::allDocuments())) {
document->styleScope().clearResolver();
document->fontSelector().emptyCaches();
}
Modified: trunk/Source/WebCore/page/Performance.cpp (223237 => 223238)
--- trunk/Source/WebCore/page/Performance.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/page/Performance.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -271,9 +271,7 @@
return;
m_performanceTimelineTaskQueue.enqueueTask([this] () {
- Vector<RefPtr<PerformanceObserver>> observers;
- copyToVector(m_observers, observers);
- for (auto& observer : observers)
+ for (auto& observer : copyToVector(m_observers))
observer->deliver();
});
}
Modified: trunk/Source/WebCore/platform/cocoa/PasteboardCocoa.mm (223237 => 223238)
--- trunk/Source/WebCore/platform/cocoa/PasteboardCocoa.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/platform/cocoa/PasteboardCocoa.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -165,9 +165,7 @@
for (auto& cocoaType : cocoaTypes)
addHTMLClipboardTypesForCocoaType(result, cocoaType);
- Vector<String> types;
- copyToVector(result, types);
- return types;
+ return copyToVector(result);
}
#if PLATFORM(MAC)
Modified: trunk/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp (223237 => 223238)
--- trunk/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -86,8 +86,7 @@
// Calling out to the hosts can cause m_hostsWithChangesToFlush to be modified, so we copy it
// into a Vector first.
- Vector<AbstractCACFLayerTreeHost*> hosts;
- copyToVector(m_hostsWithChangesToFlush, hosts);
+ auto hosts = copyToVector(m_hostsWithChangesToFlush);
m_hostsWithChangesToFlush.clear();
m_isCallingHosts = true;
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (223237 => 223238)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -748,9 +748,7 @@
visited.add(familyName.get());
}
- Vector<String> result;
- copyToVector(visited, result);
- return result;
+ return copyToVector(visited);
}
static CTFontSymbolicTraits computeTraits(const FontDescription& fontDescription)
Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (223237 => 223238)
--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -392,9 +392,7 @@
domPasteboardTypes.add(String::fromUTF8(coercedType));
}
- Vector<String> result;
- copyToVector(domPasteboardTypes, result);
- return result;
+ return copyToVector(domPasteboardTypes);
}
long PlatformPasteboard::write(const PasteboardCustomData& data)
Modified: trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm (223237 => 223238)
--- trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -223,10 +223,8 @@
WebThreadRun(^{
CMAcceleration accel = newAcceleration.acceleration;
- Vector<WebCore::DeviceMotionClientIOS*> clients;
- copyToVector(m_deviceMotionClients, clients);
- for (size_t i = 0; i < clients.size(); ++i)
- clients[i]->motionChanged(0, 0, 0, accel.x * kGravity, accel.y * kGravity, accel.z * kGravity, 0, 0, 0);
+ for (auto& client : copyToVector(m_deviceMotionClients))
+ client->motionChanged(0, 0, 0, accel.x * kGravity, accel.y * kGravity, accel.z * kGravity, 0, 0, 0);
});
}
@@ -243,18 +241,12 @@
CMRotationRate rotationRate = newMotion.rotationRate;
- Vector<WebCore::DeviceMotionClientIOS*> motionClients;
- copyToVector(m_deviceMotionClients, motionClients);
- for (size_t i = 0; i < motionClients.size(); ++i) {
- motionClients[i]->motionChanged(userAccel.x * kGravity, userAccel.y * kGravity, userAccel.z * kGravity,
- totalAccel.x * kGravity, totalAccel.y * kGravity, totalAccel.z * kGravity,
- rad2deg(rotationRate.x), rad2deg(rotationRate.y), rad2deg(rotationRate.z));
- }
+ for (auto& client : copyToVector(m_deviceMotionClients))
+ client->motionChanged(userAccel.x * kGravity, userAccel.y * kGravity, userAccel.z * kGravity, totalAccel.x * kGravity, totalAccel.y * kGravity, totalAccel.z * kGravity, rad2deg(rotationRate.x), rad2deg(rotationRate.y), rad2deg(rotationRate.z));
CMAttitude* attitude = newMotion.attitude;
- Vector<WebCore::DeviceOrientationClientIOS*> orientationClients;
- copyToVector(m_deviceOrientationClients, orientationClients);
+ auto orientationClients = copyToVector(m_deviceOrientationClients);
// Compose the raw motion data to an intermediate ZXY-based 3x3 rotation
// matrix (R) where [z=attitude.yaw, x=attitude.pitch, y=attitude.roll]
Modified: trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm (223237 => 223238)
--- trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -129,9 +129,7 @@
domPasteboardTypes.add(String::fromUTF8(domType));
}
- Vector<String> result;
- copyToVector(domPasteboardTypes, result);
- return result;
+ return copyToVector(domPasteboardTypes);
}
long PlatformPasteboard::write(const PasteboardCustomData& data)
Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm (223237 => 223238)
--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -203,7 +203,7 @@
Vector<RetainPtr<WebCoreNSURLSessionDataTask>> tasksCopy;
{
Locker<Lock> locker(_dataTasksLock);
- copyToVector(_dataTasks, tasksCopy);
+ tasksCopy = copyToVector(_dataTasks);
}
for (auto& task : tasksCopy)
Modified: trunk/Source/WebCore/platform/win/PasteboardWin.cpp (223237 => 223238)
--- trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/platform/win/PasteboardWin.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -272,9 +272,7 @@
}
}
- Vector<String> vector;
- copyToVector(results, vector);
- return vector;
+ return copyToVector(results);
}
String Pasteboard::readOrigin()
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (223237 => 223238)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1015,8 +1015,7 @@
// from the transaction stack to ensure that all subsequent calls to RenderBlock::updateScrollInfoAfterLayout()
// are dispatched immediately. That is, to ensure that such subsequent calls aren't added to |transaction|
// while we are processing it.
- Vector<RenderBlock*> blocksToUpdate;
- copyToVector(transaction->blocks, blocksToUpdate);
+ auto blocksToUpdate = copyToVector(transaction->blocks);
updateScrollInfoAfterLayoutTransactionStack()->removeLast();
if (updateScrollInfoAfterLayoutTransactionStack()->isEmpty())
updateScrollInfoAfterLayoutTransactionStack() = nullptr;
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (223237 => 223238)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -531,7 +531,7 @@
ASSERT(run->box()->behavesLikeText());
GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.add(downcast<InlineTextBox>(run->box()), std::make_pair(Vector<const Font*>(), GlyphOverflow())).iterator;
ASSERT(it->value.first.isEmpty());
- copyToVector(fallbackFonts, it->value.first);
+ it->value.first = copyToVector(fallbackFonts);
run->box()->parent()->clearDescendantsHaveSameLineHeightAndBaseline();
}
Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (223237 => 223238)
--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -83,7 +83,7 @@
// Only copy+sort the values once per layout even if the iterator is reset.
if (static_cast<size_t>(m_ordinalValues.size()) != m_sortedOrdinalValues.size()) {
- copyToVector(m_ordinalValues, m_sortedOrdinalValues);
+ m_sortedOrdinalValues = copyToVector(m_ordinalValues);
std::sort(m_sortedOrdinalValues.begin(), m_sortedOrdinalValues.end());
}
m_currentOrdinal = m_forward ? m_sortedOrdinalValues[m_ordinalIteration - 1] : m_sortedOrdinalValues[m_sortedOrdinalValues.size() - m_ordinalIteration];
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (223237 => 223238)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1312,8 +1312,7 @@
#endif
// To make sure we properly repaint the section, we repaint all the overflowing cells that we collected.
- Vector<RenderTableCell*> cells;
- copyToVector(m_overflowingCells, cells);
+ auto cells = copyToVector(m_overflowingCells);
HashSet<RenderTableCell*> spanningCells;
Modified: trunk/Source/WebKit/ChangeLog (223237 => 223238)
--- trunk/Source/WebKit/ChangeLog 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/ChangeLog 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1,3 +1,34 @@
+2017-10-11 Sam Weinig <s...@webkit.org>
+
+ Remove out-parameter variants of copyToVector
+ https://bugs.webkit.org/show_bug.cgi?id=178155
+
+ Reviewed by Tim Horton.
+
+ * 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.
+
2017-10-11 Jaehun Lim <ljaehun....@samsung.com>
Fix debug build
Modified: trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm (223237 => 223238)
--- trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectInterface.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -213,9 +213,7 @@
auto descriptionForArgument = [](auto& allowedArgumentClasses) {
auto result = adoptNS([[NSMutableString alloc] initWithString:@"{"]);
- Vector<Class> orderedArgumentClasses;
- copyToVector(allowedArgumentClasses, orderedArgumentClasses);
-
+ auto orderedArgumentClasses = copyToVector(allowedArgumentClasses);
std::sort(orderedArgumentClasses.begin(), orderedArgumentClasses.end(), [](Class a, Class b) {
return CString(class_getName(a)) < CString(class_getName(b));
});
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp (223237 => 223238)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -599,11 +599,8 @@
if (stateTree.rootStateNode())
recursiveDumpNodes(ts, *stateTree.rootStateNode(), changedPropertiesOnly);
- if (!stateTree.removedNodes().isEmpty()) {
- Vector<ScrollingNodeID> removedNodes;
- copyToVector(stateTree.removedNodes(), removedNodes);
- ts.dumpProperty<Vector<ScrollingNodeID>>("removed-nodes", removedNodes);
- }
+ if (!stateTree.removedNodes().isEmpty())
+ ts.dumpProperty<Vector<ScrollingNodeID>>("removed-nodes", copyToVector(stateTree.removedNodes()));
}
WTF::CString RemoteScrollingCoordinatorTransaction::description() const
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (223237 => 223238)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -5614,12 +5614,12 @@
m_callbacks.invalidate(error);
m_loadDependentStringCallbackIDs.clear();
- Vector<WebEditCommandProxy*> editCommandVector;
- copyToVector(m_editCommandSet, editCommandVector);
+ auto editCommandVector = copyToVector(m_editCommandSet);
m_editCommandSet.clear();
- for (size_t i = 0, size = editCommandVector.size(); i < size; ++i)
- editCommandVector[i]->invalidate();
+ for (auto& editCommand : editCommandVector)
+ editCommand->invalidate();
+
m_activePopupMenu = nullptr;
m_mediaState = MediaProducer::IsNotPlaying;
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (223237 => 223238)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -733,16 +733,16 @@
parameters.cacheModel = cacheModel();
parameters.languages = userPreferredLanguages();
- copyToVector(m_schemesToRegisterAsEmptyDocument, parameters.urlSchemesRegisteredAsEmptyDocument);
- copyToVector(m_schemesToRegisterAsSecure, parameters.urlSchemesRegisteredAsSecure);
- copyToVector(m_schemesToRegisterAsBypassingContentSecurityPolicy, parameters.urlSchemesRegisteredAsBypassingContentSecurityPolicy);
- copyToVector(m_schemesToSetDomainRelaxationForbiddenFor, parameters.urlSchemesForWhichDomainRelaxationIsForbidden);
- copyToVector(m_schemesToRegisterAsLocal, parameters.urlSchemesRegisteredAsLocal);
- copyToVector(m_schemesToRegisterAsNoAccess, parameters.urlSchemesRegisteredAsNoAccess);
- copyToVector(m_schemesToRegisterAsDisplayIsolated, parameters.urlSchemesRegisteredAsDisplayIsolated);
- copyToVector(m_schemesToRegisterAsCORSEnabled, parameters.urlSchemesRegisteredAsCORSEnabled);
- copyToVector(m_schemesToRegisterAsAlwaysRevalidated, parameters.urlSchemesRegisteredAsAlwaysRevalidated);
- copyToVector(m_schemesToRegisterAsCachePartitioned, parameters.urlSchemesRegisteredAsCachePartitioned);
+ parameters.urlSchemesRegisteredAsEmptyDocument = copyToVector(m_schemesToRegisterAsEmptyDocument);
+ parameters.urlSchemesRegisteredAsSecure = copyToVector(m_schemesToRegisterAsSecure);
+ parameters.urlSchemesRegisteredAsBypassingContentSecurityPolicy = copyToVector(m_schemesToRegisterAsBypassingContentSecurityPolicy);
+ parameters.urlSchemesForWhichDomainRelaxationIsForbidden = copyToVector(m_schemesToSetDomainRelaxationForbiddenFor);
+ parameters.urlSchemesRegisteredAsLocal = copyToVector(m_schemesToRegisterAsLocal);
+ parameters.urlSchemesRegisteredAsNoAccess = copyToVector(m_schemesToRegisterAsNoAccess);
+ parameters.urlSchemesRegisteredAsDisplayIsolated = copyToVector(m_schemesToRegisterAsDisplayIsolated);
+ parameters.urlSchemesRegisteredAsCORSEnabled = copyToVector(m_schemesToRegisterAsCORSEnabled);
+ parameters.urlSchemesRegisteredAsAlwaysRevalidated = copyToVector(m_schemesToRegisterAsAlwaysRevalidated);
+ parameters.urlSchemesRegisteredAsCachePartitioned = copyToVector(m_schemesToRegisterAsCachePartitioned);
parameters.shouldAlwaysUseComplexTextCodePath = m_alwaysUsesComplexTextCodePath;
parameters.shouldUseFontSmoothing = m_shouldUseFontSmoothing;
@@ -761,7 +761,7 @@
#endif
parameters.plugInAutoStartOriginHashes = m_plugInAutoStartProvider.autoStartOriginHashesCopy();
- copyToVector(m_plugInAutoStartProvider.autoStartOrigins(), parameters.plugInAutoStartOrigins);
+ parameters.plugInAutoStartOrigins = copyToVector(m_plugInAutoStartProvider.autoStartOrigins());
parameters.memoryCacheDisabled = m_memoryCacheDisabled;
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (223237 => 223238)
--- trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -70,7 +70,7 @@
parameters.uiProcessCookieStorageIdentifier = m_uiProcessCookieStorageIdentifier;
#endif
- copyToVector(m_pendingCookies, parameters.pendingCookies);
+ parameters.pendingCookies = copyToVector(m_pendingCookies);
if (!cookieFile.isEmpty())
SandboxExtension::createHandleForReadWriteDirectory(WebCore::directoryName(cookieFile), parameters.cookieStoragePathExtensionHandle);
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (223237 => 223238)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1370,9 +1370,7 @@
Vector<WebCore::Cookie> WebsiteDataStore::pendingCookies() const
{
- Vector<WebCore::Cookie> cookies;
- copyToVector(m_pendingCookies, cookies);
- return cookies;
+ return copyToVector(m_pendingCookies);
}
void WebsiteDataStore::addPendingCookie(const WebCore::Cookie& cookie)
Modified: trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm (223237 => 223238)
--- trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -96,9 +96,8 @@
- (void)_notifyClientsOfImminentSuspension
{
ASSERT(RunLoop::isMain());
- Vector<ProcessAssertionClient*> clientsToNotify;
- copyToVector(_clients, clientsToNotify);
- for (auto* client : clientsToNotify)
+
+ for (auto* client : copyToVector(_clients))
client->assertionWillExpireImminently();
}
Modified: trunk/Source/WebKit/WebProcess/Cookies/WebCookieManager.cpp (223237 => 223238)
--- trunk/Source/WebKit/WebProcess/Cookies/WebCookieManager.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/WebProcess/Cookies/WebCookieManager.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -60,10 +60,7 @@
if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
WebCore::getHostnamesWithCookies(*storageSession, hostnames);
- Vector<String> hostnameList;
- copyToVector(hostnames, hostnameList);
-
- m_process.send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(hostnameList, callbackID), 0);
+ m_process.send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(copyToVector(hostnames), callbackID), 0);
}
void WebCookieManager::deleteCookiesForHostname(PAL::SessionID sessionID, const String& hostname)
Modified: trunk/Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp (223237 => 223238)
--- trunk/Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/WebProcess/Geolocation/WebGeolocationManager.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -94,9 +94,7 @@
void WebGeolocationManager::didChangePosition(const GeolocationPosition& position)
{
#if ENABLE(GEOLOCATION)
- Vector<RefPtr<WebPage>> webPageCopy;
- copyToVector(m_pageSet, webPageCopy);
- for (auto& page : webPageCopy) {
+ for (auto& page : copyToVector(m_pageSet)) {
if (page->corePage())
GeolocationController::from(page->corePage())->positionChanged(position);
}
@@ -111,9 +109,7 @@
// FIXME: Add localized error string.
auto error = GeolocationError::create(GeolocationError::PositionUnavailable, errorMessage);
- Vector<RefPtr<WebPage>> webPageCopy;
- copyToVector(m_pageSet, webPageCopy);
- for (auto& page : webPageCopy) {
+ for (auto& page : copyToVector(m_pageSet)) {
if (page->corePage())
GeolocationController::from(page->corePage())->errorOccurred(error.get());
}
Modified: trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp (223237 => 223238)
--- trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -258,11 +258,8 @@
void WebLoaderStrategy::internallyFailedLoadTimerFired()
{
- Vector<RefPtr<ResourceLoader>> internallyFailedResourceLoaders;
- copyToVector(m_internallyFailedResourceLoaders, internallyFailedResourceLoaders);
-
- for (size_t i = 0; i < internallyFailedResourceLoaders.size(); ++i)
- internallyFailedResourceLoaders[i]->didFail(internalError(internallyFailedResourceLoaders[i]->url()));
+ for (auto& resourceLoader : copyToVector(m_internallyFailedResourceLoaders))
+ resourceLoader->didFail(internalError(resourceLoader->url()));
}
void WebLoaderStrategy::startLocalLoad(WebCore::ResourceLoader& resourceLoader)
Modified: trunk/Source/WebKitLegacy/ios/ChangeLog (223237 => 223238)
--- trunk/Source/WebKitLegacy/ios/ChangeLog 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKitLegacy/ios/ChangeLog 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1,3 +1,18 @@
+2017-10-11 Sam Weinig <s...@webkit.org>
+
+ Remove out-parameter variants of copyToVector
+ https://bugs.webkit.org/show_bug.cgi?id=178155
+
+ Reviewed by Tim Horton.
+
+ * Misc/WebGeolocationProviderIOS.mm:
+ (-[WebGeolocationProviderIOS _handlePendingInitialPosition:]):
+ (-[WebGeolocationProviderIOS positionChanged:]):
+ (-[WebGeolocationProviderIOS errorOccurred:]):
+ (-[WebGeolocationProviderIOS resetGeolocation]):
+
+ Replace out-parameter based copyToVector, with one that returns a Vector.
+
2017-10-11 Chris Dumez <cdu...@apple.com>
Modernize Geolocation code
Modified: trunk/Source/WebKitLegacy/ios/Misc/WebGeolocationProviderIOS.mm (223237 => 223238)
--- trunk/Source/WebKitLegacy/ios/Misc/WebGeolocationProviderIOS.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKitLegacy/ios/Misc/WebGeolocationProviderIOS.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -160,10 +160,8 @@
ASSERT(WebThreadIsCurrent());
if (_lastPosition) {
- Vector<WebView*> webViewsCopy;
- copyToVector(_pendingInitialPositionWebView, webViewsCopy);
- for (size_t i = 0; i < webViewsCopy.size(); ++i)
- [webViewsCopy[i] _geolocationDidChangePosition:_lastPosition.get()];
+ for (auto& webView : copyToVector(_pendingInitialPositionWebView))
+ [webView _geolocationDidChangePosition:_lastPosition.get()];
}
abortSendLastPosition(self);
}
@@ -295,10 +293,8 @@
abortSendLastPosition(self);
_lastPosition = position;
- Vector<WebView*> webViewsCopy;
- copyToVector(_registeredWebViews, webViewsCopy);
- for (size_t i = 0; i < webViewsCopy.size(); ++i)
- [webViewsCopy.at(i) _geolocationDidChangePosition:_lastPosition.get()];
+ for (auto& webView : copyToVector(_registeredWebViews))
+ [webView _geolocationDidChangePosition:_lastPosition.get()];
}
- (void)errorOccurred:(NSString *)errorMessage
@@ -307,10 +303,8 @@
_lastPosition.clear();
- Vector<WebView*> webViewsCopy;
- copyToVector(_registeredWebViews, webViewsCopy);
- for (size_t i = 0; i < webViewsCopy.size(); ++i)
- [webViewsCopy.at(i) _geolocationDidFailWithMessage:errorMessage];
+ for (auto& webView : copyToVector(_registeredWebViews))
+ [webView _geolocationDidFailWithMessage:errorMessage];
}
- (void)resetGeolocation
@@ -327,10 +321,8 @@
abortSendLastPosition(self);
// 2) Reset the views, each frame will register back if needed.
- Vector<WebView*> webViewsCopy;
- copyToVector(_trackedWebViews, webViewsCopy);
- for (size_t i = 0; i < webViewsCopy.size(); ++i)
- [webViewsCopy.at(i) _resetAllGeolocationPermission];
+ for (auto& webView : copyToVector(_trackedWebViews))
+ [webView _resetAllGeolocationPermission];
}
@end
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (223237 => 223238)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1,3 +1,17 @@
+2017-10-11 Sam Weinig <s...@webkit.org>
+
+ Remove out-parameter variants of copyToVector
+ https://bugs.webkit.org/show_bug.cgi?id=178155
+
+ Reviewed by Tim Horton.
+
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView destroyPlugin]):
+ * WebView/WebHTMLRepresentation.mm:
+ (newArrayWithStrings):
+
+ Replace out-parameter based copyToVector, with one that returns a Vector.
+
2017-10-11 Ryosuke Niwa <rn...@webkit.org>
Sanitize URL in pasteboard for other applications and cross origin content
Modified: trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm (223237 => 223238)
--- trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1173,9 +1173,7 @@
// To stop active streams it's necessary to invoke stop() on a copy
// of streams. This is because calling WebNetscapePluginStream::stop() also has the side effect
// of removing a stream from this hash set.
- Vector<RefPtr<WebNetscapePluginStream>> streamsCopy;
- copyToVector(streams, streamsCopy);
- for (auto& stream: streamsCopy)
+ for (auto& stream : copyToVector(streams))
stream->stop();
for (WebFrame *frame in [_pendingFrameLoads keyEnumerator])
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLRepresentation.mm (223237 => 223238)
--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLRepresentation.mm 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLRepresentation.mm 2017-10-12 15:38:42 UTC (rev 223238)
@@ -89,8 +89,7 @@
static RetainPtr<NSArray> newArrayWithStrings(const HashSet<String, ASCIICaseInsensitiveHash>& set)
{
- Vector<NSString *> vector;
- copyToVector(set, vector);
+ auto vector = copyToVectorOf<NSString *>(set);
return adoptNS([[NSArray alloc] initWithObjects:vector.data() count:vector.size()]);
}
Modified: trunk/Tools/ChangeLog (223237 => 223238)
--- trunk/Tools/ChangeLog 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Tools/ChangeLog 2017-10-12 15:38:42 UTC (rev 223238)
@@ -1,3 +1,13 @@
+2017-10-11 Sam Weinig <s...@webkit.org>
+
+ Remove out-parameter variants of copyToVector
+ https://bugs.webkit.org/show_bug.cgi?id=178155
+
+ Reviewed by Tim Horton.
+
+ * DumpRenderTree/_javascript_Threading.cpp:
+ (stopJavaScriptThreads):
+
2017-10-12 Sam Weinig <s...@webkit.org>
It should be possible to iterate just the values (and not the counts) of a HashCountedSet
Modified: trunk/Tools/DumpRenderTree/_javascript_Threading.cpp (223237 => 223238)
--- trunk/Tools/DumpRenderTree/_javascript_Threading.cpp 2017-10-12 13:12:48 UTC (rev 223237)
+++ trunk/Tools/DumpRenderTree/_javascript_Threading.cpp 2017-10-12 15:38:42 UTC (rev 223238)
@@ -142,7 +142,7 @@
Vector<RefPtr<Thread>, _javascript_ThreadsCount> threads;
{
LockHolder locker(_javascript_ThreadsMutex());
- copyToVector(_javascript_Threads(), threads);
+ threads = copyToVector(_javascript_Threads());
ASSERT(threads.size() == _javascript_ThreadsCount);
}