WebKit Bugzilla
Attachment 357431 Details for
Bug 192751
: clang-tidy: loop variable is copied but only used as const reference in WebCore, WebKit, Tools
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v1
bug-192751-20181217015717.patch (text/plain), 38.55 KB, created by
David Kilzer (:ddkilzer)
on 2018-12-17 01:57:18 PST
(
hide
)
Description:
Patch v1
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2018-12-17 01:57:18 PST
Size:
38.55 KB
patch
obsolete
>Subversion Revision: 239112 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0e00ebb6c25a3e0c919fea431cc6fe064b7387b4..7e661e0a324ac755a00eb1acd977d87742817657 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,65 @@ >+2018-12-17 David Kilzer <ddkilzer@apple.com> >+ >+ clang-tidy: loop variable is copied but only used as const reference in WebCore, WebKit, Tools >+ <https://webkit.org/b/192751> >+ <rdar://problem/46771623> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Change loop variables to const references to avoid unnecessary >+ copies. >+ >+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp: >+ (WebCore::IDBServer::MemoryBackingStoreTransaction::abort): >+ * Modules/indexeddb/server/MemoryObjectStore.cpp: >+ (WebCore::IDBServer::MemoryObjectStore::populateIndexWithExistingRecords): >+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp: >+ (WebCore::IDBServer::UniqueIDBDatabase::maybeNotifyConnectionsOfVersionChange): >+ * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: >+ (WebCore::IDBServer::UniqueIDBDatabaseTransaction::objectStoreIdentifiers): >+ * Modules/indexeddb/shared/IDBDatabaseInfo.cpp: >+ (WebCore::IDBDatabaseInfo::IDBDatabaseInfo): >+ (WebCore::IDBDatabaseInfo::loggingString const): >+ * Modules/mediasource/SourceBuffer.cpp: >+ (WebCore::removeSamplesFromTrackBuffer): >+ * accessibility/AccessibilityRenderObject.cpp: >+ (WebCore::AccessibilityRenderObject::targetElementForActiveDescendant const): >+ * accessibility/AccessibilityTableRow.cpp: >+ (WebCore::AccessibilityTableRow::headerObject): >+ * animation/KeyframeEffect.cpp: >+ (WebCore::KeyframeEffect::computedNeedsForcedLayout): >+ * crypto/keys/CryptoKeyRSA.cpp: >+ (WebCore::CryptoKeyRSA::importJwk): >+ (WebCore::CryptoKeyRSA::exportJwk const): >+ * css/CSSComputedStyleDeclaration.cpp: >+ (WebCore::OrderedNamedLinesCollector::appendLines const): >+ * dom/DataTransfer.cpp: >+ (WebCore::readURLsFromPasteboardAsString): >+ * dom/TreeScope.cpp: >+ (WebCore::TreeScope::elementsFromPoint): >+ * html/track/WebVTTParser.cpp: >+ (WebCore::WebVTTParser::checkAndStoreRegion): >+ * inspector/agents/InspectorTimelineAgent.cpp: >+ (WebCore::InspectorTimelineAgent::setInstruments): >+ * page/Page.cpp: >+ (WebCore::Page::updateIntersectionObservations): >+ * page/TextIndicator.cpp: >+ (WebCore::estimatedBackgroundColorForRange): >+ * page/animation/KeyframeAnimation.cpp: >+ (WebCore::KeyframeAnimation::computeLayoutDependency): >+ * platform/graphics/DisplayRefreshMonitorManager.cpp: >+ (WebCore::DisplayRefreshMonitorManager::displayWasUpdated): >+ * platform/graphics/ca/GraphicsLayerCA.cpp: >+ (WebCore::GraphicsLayerCA::moveOrCopyAnimations): >+ (WebCore::GraphicsLayerCA::updateAnimations): >+ (WebCore::GraphicsLayerCA::isRunningTransformAnimation const): >+ * platform/graphics/mac/ImageMac.mm: >+ (WebCore::BitmapImage::tiffRepresentation): >+ * rendering/HitTestResult.cpp: >+ (WebCore::HitTestResult::append): >+ * testing/Internals.cpp: >+ (WebCore::Internals::acceleratedAnimationsForElement): >+ > 2018-12-14 David Kilzer <ddkilzer@apple.com> > > clang-tidy: Fix unnecessary copy of objects for operator==() methods >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index f81a9a8b3f1c711faeb498ce590660aa9ebf0074..69aefd3a9a9d21f199ac88258cd3aed09c229366 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,40 @@ >+2018-12-17 David Kilzer <ddkilzer@apple.com> >+ >+ clang-tidy: loop variable is copied but only used as const reference in WebCore, WebKit, Tools >+ <https://webkit.org/b/192751> >+ <rdar://problem/46771623> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Change loop variables to const references to avoid unnecessary >+ copies. >+ >+ * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: >+ (WebKit::WebSWServerConnection::~WebSWServerConnection): >+ * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: >+ (WebKit::RemoteLayerTreeTransaction::encode const): >+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: >+ (WebKit::toNSErrors): >+ * UIProcess/Automation/WebAutomationSession.cpp: >+ (WebKit::WebAutomationSession::setFilesToSelectForFileUpload): >+ (WebKit::WebAutomationSession::performKeyboardInteractions): >+ (WebKit::WebAutomationSession::performInteractionSequence): >+ * UIProcess/Plugins/PluginProcessManager.cpp: >+ (WebKit::PluginProcessManager::getPluginProcess): >+ * UIProcess/ResourceLoadStatisticsMemoryStore.cpp: >+ (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords): >+ (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const): >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers): >+ * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp: >+ (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases): >+ (WebKit::LocalStorageDatabaseTracker::origins const): >+ (WebKit::LocalStorageDatabaseTracker::originDetails): >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::m_shouldAttachDrawingAreaOnPageTransition): >+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: >+ (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired): >+ > 2018-12-14 David Kilzer <ddkilzer@apple.com> > > clang-tidy: Fix unnecessary object copy in CPUMonitor::setCPULimit() >diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp b/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp >index 1ea5cb183ea0cc2c7f29ffb83650965fdfe06fb5..47cc42fd26d6473c641927e992d4ec6e8d7bf8ee 100644 >--- a/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp >@@ -213,15 +213,15 @@ void MemoryBackingStoreTransaction::abort() > > SetForScope<bool> change(m_isAborting, true); > >- for (auto iterator : m_originalIndexNames) >+ for (const auto& iterator : m_originalIndexNames) > iterator.key->rename(iterator.value); > m_originalIndexNames.clear(); > >- for (auto iterator : m_originalObjectStoreNames) >+ for (const auto& iterator : m_originalObjectStoreNames) > iterator.key->rename(iterator.value); > m_originalObjectStoreNames.clear(); > >- for (auto objectStore : m_versionChangeAddedObjectStores) >+ for (const auto& objectStore : m_versionChangeAddedObjectStores) > m_backingStore.removeObjectStoreForVersionChangeAbort(*objectStore); > m_versionChangeAddedObjectStores.clear(); > >@@ -257,7 +257,7 @@ void MemoryBackingStoreTransaction::abort() > if (!keyValueMap) > continue; > >- for (auto entry : *keyValueMap) { >+ for (const auto& entry : *keyValueMap) { > objectStore->deleteRecord(entry.key); > objectStore->addRecord(*this, entry.key, { entry.value }); > } >diff --git a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp >index 5cded3e58815008c757a8f869172181640754352..559291d10dc15f1f9d42f96ce6f3454e9f4820ea 100644 >--- a/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp >@@ -338,7 +338,7 @@ IDBError MemoryObjectStore::populateIndexWithExistingRecords(MemoryIndex& index) > > JSLockHolder locker(UniqueIDBDatabase::databaseThreadVM()); > >- for (auto iterator : *m_keyValueStore) { >+ for (const auto& iterator : *m_keyValueStore) { > auto jsValue = deserializeIDBValueToJSValue(UniqueIDBDatabase::databaseThreadExecState(), iterator.value); > if (jsValue.isUndefinedOrNull()) > return IDBError { }; >diff --git a/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp b/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp >index fc07ef1451b97e075cd3a56f620093a349c0cbc9..4e2a2df6b7a37777229cc8f2d5a44985b668c673 100644 >--- a/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp >@@ -531,7 +531,7 @@ void UniqueIDBDatabase::maybeNotifyConnectionsOfVersionChange() > // Fire a versionchange event at each connection in m_openDatabaseConnections that is open. > // The event must not be fired on connections which has the closePending flag set. > HashSet<uint64_t> connectionIdentifiers; >- for (auto connection : m_openDatabaseConnections) { >+ for (const auto& connection : m_openDatabaseConnections) { > if (connection->closePending()) > continue; > >diff --git a/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp b/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp >index 79c5d958feda5baf3212e9fd33f6f64ab80b58bc..39a011dd0a7afe5fd95fba68da45ec00487418d9 100644 >--- a/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp >+++ b/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp >@@ -421,7 +421,7 @@ const Vector<uint64_t>& UniqueIDBDatabaseTransaction::objectStoreIdentifiers() > return m_objectStoreIdentifiers; > > auto& info = m_databaseConnection->database()->info(); >- for (auto objectStoreName : info.objectStoreNames()) { >+ for (const auto& objectStoreName : info.objectStoreNames()) { > auto objectStoreInfo = info.infoForExistingObjectStore(objectStoreName); > ASSERT(objectStoreInfo); > if (!objectStoreInfo) >diff --git a/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp b/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp >index e5df15c44abbe2464f4feeefd98dab78d9b3af29..d0a2533168610419a651a894508636595882e559 100644 >--- a/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp >+++ b/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp >@@ -47,7 +47,7 @@ IDBDatabaseInfo::IDBDatabaseInfo(const IDBDatabaseInfo& other, IsolatedCopyTag) > , m_version(other.m_version) > , m_maxObjectStoreID(other.m_maxObjectStoreID) > { >- for (auto entry : other.m_objectStoreMap) >+ for (const auto& entry : other.m_objectStoreMap) > m_objectStoreMap.set(entry.key, entry.value.isolatedCopy()); > } > >@@ -164,7 +164,7 @@ String IDBDatabaseInfo::loggingString() const > builder.appendLiteral(" version "); > builder.appendNumber(m_version); > builder.append('\n'); >- for (auto objectStore : m_objectStoreMap.values()) { >+ for (const auto& objectStore : m_objectStoreMap.values()) { > builder.append(objectStore.loggingString(1)); > builder.append('\n'); > } >diff --git a/Source/WebCore/Modules/mediasource/SourceBuffer.cpp b/Source/WebCore/Modules/mediasource/SourceBuffer.cpp >index 0f82b744b9ceca3e105433a5e15abd8160fdd02a..96686a081360a5aff900ac83d46bd0b879e5923a 100644 >--- a/Source/WebCore/Modules/mediasource/SourceBuffer.cpp >+++ b/Source/WebCore/Modules/mediasource/SourceBuffer.cpp >@@ -739,13 +739,13 @@ static PlatformTimeRanges removeSamplesFromTrackBuffer(const DecodeOrderSampleMa > #endif > > PlatformTimeRanges erasedRanges; >- for (auto sampleIt : samples) { >+ for (const auto& sampleIt : samples) { > const DecodeOrderSampleMap::KeyType& decodeKey = sampleIt.first; > #if !LOG_DISABLED > size_t startBufferSize = trackBuffer.samples.sizeInBytes(); > #endif > >- RefPtr<MediaSample>& sample = sampleIt.second; >+ const RefPtr<MediaSample>& sample = sampleIt.second; > LOG(MediaSource, "SourceBuffer::%s(%p) - removing sample(%s)", logPrefix, buffer, toString(*sampleIt.second).utf8().data()); > > // Remove the erased samples from the TrackBuffer sample map. >diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp >index 1a8b23d7e03d232ae8928f3b96fda8047ed6a92b..78ad959f440acd0163fd6be04ca551c0f6abd76a 100644 >--- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp >+++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp >@@ -2523,7 +2523,7 @@ RenderObject* AccessibilityRenderObject::targetElementForActiveDescendant(const > { > AccessibilityObject::AccessibilityChildrenVector elements; > ariaElementsFromAttribute(elements, attributeName); >- for (auto element : elements) { >+ for (const auto& element : elements) { > if (activeDescendant->isDescendantOfObject(element.get())) > return element->renderer(); > } >diff --git a/Source/WebCore/accessibility/AccessibilityTableRow.cpp b/Source/WebCore/accessibility/AccessibilityTableRow.cpp >index 43b6d80d44142c206cc6d27ffa905c50836fb104..335a89fb816df56e260f7ecf79be9a2d96aef3a7 100644 >--- a/Source/WebCore/accessibility/AccessibilityTableRow.cpp >+++ b/Source/WebCore/accessibility/AccessibilityTableRow.cpp >@@ -135,7 +135,7 @@ AccessibilityObject* AccessibilityTableRow::headerObject() > // Verify that the row header is not part of an entire row of headers. > // In that case, it is unlikely this is a row header. > bool allHeadersInRow = true; >- for (auto cell : rowChildren) { >+ for (const auto& cell : rowChildren) { > if (cell->node() && !cell->node()->hasTagName(thTag)) { > allHeadersInRow = false; > break; >diff --git a/Source/WebCore/animation/KeyframeEffect.cpp b/Source/WebCore/animation/KeyframeEffect.cpp >index 11c878aef6b20127829afb41a772c2c0cb77ec8d..3085182654a93146ebbe250a3ede240b883381e4 100644 >--- a/Source/WebCore/animation/KeyframeEffect.cpp >+++ b/Source/WebCore/animation/KeyframeEffect.cpp >@@ -954,7 +954,7 @@ void KeyframeEffect::computedNeedsForcedLayout() > } > if (keyframeStyle->hasTransform()) { > auto& transformOperations = keyframeStyle->transform(); >- for (auto operation : transformOperations.operations()) { >+ for (const auto& operation : transformOperations.operations()) { > if (operation->isTranslateTransformOperationType()) { > auto translation = downcast<TranslateTransformOperation>(operation.get()); > if (translation->x().isPercent() || translation->y().isPercent()) { >diff --git a/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp b/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp >index 302cf419533c43745c1cd45942f73e814a9fca72..41e021cb3dea73849914f8b7a00070bee8949de9 100644 >--- a/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp >+++ b/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp >@@ -92,7 +92,7 @@ RefPtr<CryptoKeyRSA> CryptoKeyRSA::importJwk(CryptoAlgorithmIdentifier algorithm > } > > Vector<CryptoKeyRSAComponents::PrimeInfo> otherPrimeInfos; >- for (auto value : keyData.oth.value()) { >+ for (const auto& value : keyData.oth.value()) { > CryptoKeyRSAComponents::PrimeInfo info; > if (!WTF::base64URLDecode(value.r, info.primeFactor)) > return nullptr; >@@ -137,7 +137,7 @@ JsonWebKey CryptoKeyRSA::exportJwk() const > return result; > > Vector<RsaOtherPrimesInfo> oth; >- for (auto info : rsaComponents->otherPrimeInfos()) { >+ for (const auto& info : rsaComponents->otherPrimeInfos()) { > RsaOtherPrimesInfo otherInfo; > otherInfo.r = base64URLEncode(info.primeFactor); > otherInfo.d = base64URLEncode(info.factorCRTExponent); >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index 36f0394ba7a96b5f7eac88c672c7c8931d14a35b..677841206fbe1e4e3789a0f802bdd1c1d334b8ea 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -1145,7 +1145,7 @@ void OrderedNamedLinesCollector::appendLines(CSSGridLineNamesValue& lineNamesVal > return; > > auto& cssValuePool = CSSValuePool::singleton(); >- for (auto lineName : iter->value) >+ for (const auto& lineName : iter->value) > lineNamesValue.append(cssValuePool.createValue(lineName, CSSPrimitiveValue::CSS_STRING)); > } > >diff --git a/Source/WebCore/dom/DataTransfer.cpp b/Source/WebCore/dom/DataTransfer.cpp >index 60e3b7ce69bf9808465117c8a6438639b1745134..592c5f91064a8234aac0fb3737924d0593f19773 100644 >--- a/Source/WebCore/dom/DataTransfer.cpp >+++ b/Source/WebCore/dom/DataTransfer.cpp >@@ -146,7 +146,7 @@ void DataTransfer::clearData(const String& type) > static String readURLsFromPasteboardAsString(Pasteboard& pasteboard, Function<bool(const String&)>&& shouldIncludeURL) > { > StringBuilder urlList; >- for (auto urlString : pasteboard.readAllStrings("text/uri-list"_s)) { >+ for (const auto& urlString : pasteboard.readAllStrings("text/uri-list"_s)) { > if (!shouldIncludeURL(urlString)) > continue; > if (!urlList.isEmpty()) >diff --git a/Source/WebCore/dom/TreeScope.cpp b/Source/WebCore/dom/TreeScope.cpp >index b9e9271292a7b2398278ba10bd0485ff773e7df6..828138f662580277200b42ed3b3952ac4ff4a292 100644 >--- a/Source/WebCore/dom/TreeScope.cpp >+++ b/Source/WebCore/dom/TreeScope.cpp >@@ -406,7 +406,7 @@ Vector<RefPtr<Element>> TreeScope::elementsFromPoint(double clientX, double clie > documentScope().renderView()->hitTest(request, result); > > Node* lastNode = nullptr; >- for (auto listBasedNode : result.listBasedTestResult()) { >+ for (const auto& listBasedNode : result.listBasedTestResult()) { > Node* node = listBasedNode.get(); > node = &retargetToScope(*node); > while (!is<Element>(*node)) { >diff --git a/Source/WebCore/html/track/WebVTTParser.cpp b/Source/WebCore/html/track/WebVTTParser.cpp >index 914215c499f01cd6bd123d8c650944294f9f1f44..11227a7ea443ab0dbf92cce11b2c3b617e2090d8 100644 >--- a/Source/WebCore/html/track/WebVTTParser.cpp >+++ b/Source/WebCore/html/track/WebVTTParser.cpp >@@ -338,7 +338,7 @@ bool WebVTTParser::checkAndStoreRegion(const String& line) > if (!m_currentRegion->id().isEmpty()) { > // If the text track list of regions regions contains a region > // with the same region identifier value as region, remove that region. >- for (auto region : m_regionList) { >+ for (const auto& region : m_regionList) { > if (region->id() == m_currentRegion->id()) { > m_regionList.removeFirst(region); > break; >diff --git a/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp b/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp >index 93b8d9625b9a17c55b963f41458a088605598377..9732ec01ace618a24cf86a0d005bf4344c3fe7b3 100644 >--- a/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp >+++ b/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp >@@ -134,7 +134,7 @@ void InspectorTimelineAgent::setInstruments(ErrorString& errorString, const JSON > Vector<Protocol::Timeline::Instrument> newInstruments; > newInstruments.reserveCapacity(instruments.length()); > >- for (auto instrumentValue : instruments) { >+ for (const auto& instrumentValue : instruments) { > String enumValueString; > if (!instrumentValue->asString(enumValueString)) { > errorString = "Unexpected type in instruments list, should be string"_s; >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index e5665b1386623d60b98157ef8c1a05b138eb2f4a..c1f30d2587256b24dae4b9319c18bb8b4ee330e7 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -1263,7 +1263,7 @@ void Page::addDocumentNeedingIntersectionObservationUpdate(Document& document) > void Page::updateIntersectionObservations() > { > m_intersectionObservationUpdateTimer.stop(); >- for (auto document : m_documentsNeedingIntersectionObservationUpdate) { >+ for (const auto& document : m_documentsNeedingIntersectionObservationUpdate) { > if (document) > document->updateIntersectionObservations(); > } >diff --git a/Source/WebCore/page/TextIndicator.cpp b/Source/WebCore/page/TextIndicator.cpp >index 616340302b4195ddf6f578e710cc4e49e2884ece..7900812f0f3e2771f3ad523557b319b0202aee12 100644 >--- a/Source/WebCore/page/TextIndicator.cpp >+++ b/Source/WebCore/page/TextIndicator.cpp >@@ -252,7 +252,7 @@ static Color estimatedBackgroundColorForRange(const Range& range, const Frame& f > parentRendererBackgroundColors.append(visitedDependentBackgroundColor); > } > parentRendererBackgroundColors.reverse(); >- for (auto backgroundColor : parentRendererBackgroundColors) >+ for (const auto& backgroundColor : parentRendererBackgroundColors) > estimatedBackgroundColor = estimatedBackgroundColor.blend(backgroundColor); > > return estimatedBackgroundColor; >diff --git a/Source/WebCore/page/animation/KeyframeAnimation.cpp b/Source/WebCore/page/animation/KeyframeAnimation.cpp >index fefe0101150177b3c16e5db8c83804cb6063967e..f351ee6423600519ef345f56da57ce938f642728 100644 >--- a/Source/WebCore/page/animation/KeyframeAnimation.cpp >+++ b/Source/WebCore/page/animation/KeyframeAnimation.cpp >@@ -95,7 +95,7 @@ void KeyframeAnimation::computeLayoutDependency() > } > if (keyframeStyle->hasTransform()) { > auto& transformOperations = keyframeStyle->transform(); >- for (auto operation : transformOperations.operations()) { >+ for (const auto& operation : transformOperations.operations()) { > if (operation->isTranslateTransformOperationType()) { > auto translation = downcast<TranslateTransformOperation>(operation.get()); > if (translation->x().isPercent() || translation->y().isPercent()) { >diff --git a/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp b/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp >index 1bc9db70762bc7a5c6160d6381f8cc66f64afc5c..8b4b69db0334ffe0143d04fda5f210ac6ef6838f 100644 >--- a/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp >+++ b/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp >@@ -127,7 +127,7 @@ void DisplayRefreshMonitorManager::windowScreenDidChange(PlatformDisplayID displ > > void DisplayRefreshMonitorManager::displayWasUpdated(PlatformDisplayID displayID) > { >- for (auto monitor : m_monitors) { >+ for (const auto& monitor : m_monitors) { > if (displayID == monitor->displayID() && monitor->hasRequestedRefreshCallback()) > monitor->displayLinkFired(); > } >diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >index d351274fd304615d9bee36b249ffc9164be24577..faca1c8fdb29278db5312ecc18df4548f5496eea 100644 >--- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >+++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >@@ -688,7 +688,7 @@ void GraphicsLayerCA::moveOrCopyAnimations(MoveOrCopy operation, PlatformCALayer > return; > > // Look for running animations affecting this property. >- for (auto it : m_animations->runningAnimations) { >+ for (const auto& it : m_animations->runningAnimations) { > const auto& propertyAnimations = it.value; > size_t numAnimations = propertyAnimations.size(); > for (size_t i = 0; i < numAnimations; ++i) { >@@ -2846,7 +2846,7 @@ void GraphicsLayerCA::updateAnimations() > } > > if (m_animations->animationsToProcess.size()) { >- for (auto it : m_animations->animationsToProcess) { >+ for (const auto& it : m_animations->animationsToProcess) { > const String& currentAnimationName = it.key; > auto animationIterator = m_animations->runningAnimations.find(currentAnimationName); > if (animationIterator == m_animations->runningAnimations.end()) >@@ -2882,7 +2882,7 @@ bool GraphicsLayerCA::isRunningTransformAnimation() const > if (!hasAnimations()) > return false; > >- for (auto it : m_animations->runningAnimations) { >+ for (const auto& it : m_animations->runningAnimations) { > const auto& propertyAnimations = it.value; > size_t numAnimations = propertyAnimations.size(); > for (size_t i = 0; i < numAnimations; ++i) { >diff --git a/Source/WebCore/platform/graphics/mac/ImageMac.mm b/Source/WebCore/platform/graphics/mac/ImageMac.mm >index 3e38cdd4368e439b98f10258b178526fd056269d..6908f107632e89018ca90e990f344877b94b6fb9 100644 >--- a/Source/WebCore/platform/graphics/mac/ImageMac.mm >+++ b/Source/WebCore/platform/graphics/mac/ImageMac.mm >@@ -88,7 +88,7 @@ RetainPtr<CFDataRef> BitmapImage::tiffRepresentation(const Vector<NativeImagePtr > if (!destination) > return nullptr; > >- for (auto nativeImage : nativeImages) >+ for (const auto& nativeImage : nativeImages) > CGImageDestinationAddImage(destination.get(), nativeImage.get(), 0); > > CGImageDestinationFinalize(destination.get()); >diff --git a/Source/WebCore/rendering/HitTestResult.cpp b/Source/WebCore/rendering/HitTestResult.cpp >index 85eb798cd09fe2897a15cb4268d9771516bd4511..b8218cade09da2567b97cc65e1c47003ddf275b1 100644 >--- a/Source/WebCore/rendering/HitTestResult.cpp >+++ b/Source/WebCore/rendering/HitTestResult.cpp >@@ -682,7 +682,7 @@ void HitTestResult::append(const HitTestResult& other, const HitTestRequest& req > > if (other.m_listBasedTestResult) { > NodeSet& set = mutableListBasedTestResult(); >- for (auto node : *other.m_listBasedTestResult) >+ for (const auto& node : *other.m_listBasedTestResult) > set.add(node.get()); > } > } >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index b731246c71a3a7cc0cd1c7c5d3b89544da1e5daa..0fe9a4e75bea170f8a800fde90469a20fc9115e3 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -1068,7 +1068,7 @@ Vector<Internals::AcceleratedAnimation> Internals::acceleratedAnimationsForEleme > return { }; > > Vector<Internals::AcceleratedAnimation> animations; >- for (auto animationAsPair : element.document().timeline().acceleratedAnimationsForElement(element)) >+ for (const auto& animationAsPair : element.document().timeline().acceleratedAnimationsForElement(element)) > animations.append({ animationAsPair.first, animationAsPair.second }); > return animations; > } >diff --git a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp >index 0c2802d23429248c57fa28f6c610dcc720d24fa3..0c81dd4c68f4a7dc2ead6c2a79fef7bab2962ae5 100644 >--- a/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp >+++ b/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp >@@ -72,7 +72,7 @@ WebSWServerConnection::WebSWServerConnection(SWServer& server, IPC::Connection& > WebSWServerConnection::~WebSWServerConnection() > { > NetworkProcess::singleton().unregisterSWServerConnection(*this); >- for (auto keyValue : m_clientOrigins) >+ for (const auto& keyValue : m_clientOrigins) > server().unregisterServiceWorkerClient(keyValue.value, keyValue.key); > } > >diff --git a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm >index c1e18c4f21c21e3ad4dc123f219ad989502d4f67..f38e75d1526badb7f52ded2565427edf16b661ce 100644 >--- a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm >+++ b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm >@@ -517,7 +517,7 @@ void RemoteLayerTreeTransaction::encode(IPC::Encoder& encoder) const > > encoder << static_cast<uint64_t>(m_changedLayers.size()); > >- for (RefPtr<PlatformCALayerRemote> layer : m_changedLayers) { >+ for (const auto& layer : m_changedLayers) { > encoder << layer->layerID(); > encoder << layer->properties(); > } >diff --git a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >index 440c10e800781703acc36383218965fa13ba0ab7..a675ebdea975105ed4b9ea2bc50701d6aa1b408d 100644 >--- a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >+++ b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >@@ -636,7 +636,7 @@ static RetainPtr<NSArray> toNSErrors(const Vector<WebCore::PaymentError>& errors > { > auto result = adoptNS([[NSMutableArray alloc] init]); > >- for (auto error : errors) { >+ for (const auto& error : errors) { > if (auto nsError = toNSError(error)) > [result addObject:nsError.get()]; > } >diff --git a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >index dd0cb4427069e074fb580b11c2e9c39b1dbb39d7..f2932c47d02c3d761c888d438dc0c34a53ac32c7 100644 >--- a/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >+++ b/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp >@@ -1198,7 +1198,7 @@ void WebAutomationSession::setFilesToSelectForFileUpload(ErrorString& errorStrin > Vector<String> newFileList; > newFileList.reserveInitialCapacity(filenames.length()); > >- for (auto item : filenames) { >+ for (const auto& item : filenames) { > String filename; > if (!item->asString(filename)) > SYNC_FAIL_WITH_PREDEFINED_ERROR(InternalError); >@@ -1639,7 +1639,7 @@ void WebAutomationSession::performKeyboardInteractions(const String& handle, con > Vector<WTF::Function<void()>> actionsToPerform; > actionsToPerform.reserveCapacity(interactions.length()); > >- for (auto interaction : interactions) { >+ for (const auto& interaction : interactions) { > RefPtr<JSON::Object> interactionObject; > if (!interaction->asObject(interactionObject)) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "An interaction in the 'interactions' parameter was invalid."); >@@ -1746,7 +1746,7 @@ void WebAutomationSession::performInteractionSequence(const String& handle, cons > if (!inputSources.length()) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'inputSources' was not found or empty."); > >- for (auto inputSource : inputSources) { >+ for (const auto& inputSource : inputSources) { > RefPtr<JSON::Object> inputSourceObject; > if (!inputSource->asObject(inputSourceObject)) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "An input source in the 'inputSources' parameter was invalid."); >@@ -1781,7 +1781,7 @@ void WebAutomationSession::performInteractionSequence(const String& handle, cons > if (!steps.length()) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'steps' was not found or empty."); > >- for (auto step : steps) { >+ for (const auto& step : steps) { > RefPtr<JSON::Object> stepObject; > if (!step->asObject(stepObject)) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "A step in the 'steps' parameter was not an object."); >@@ -1793,7 +1793,7 @@ void WebAutomationSession::performInteractionSequence(const String& handle, cons > Vector<SimulatedInputKeyFrame::StateEntry> entries; > entries.reserveCapacity(stepStates->length()); > >- for (auto state : *stepStates) { >+ for (const auto& state : *stepStates) { > RefPtr<JSON::Object> stateObject; > if (!state->asObject(stateObject)) > ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "Encountered a non-object step state."); >diff --git a/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp b/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp >index 57662d99541f0b22bedca4ef6a1456b5d231f53e..3782c84b6779e9d8e2068a6a159906f67a0da430 100644 >--- a/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp >+++ b/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp >@@ -123,7 +123,7 @@ void PluginProcessManager::deleteWebsiteDataForHostNames(const PluginModuleInfo& > > PluginProcessProxy* PluginProcessManager::getPluginProcess(uint64_t pluginProcessToken) > { >- for (auto pluginProcess : m_pluginProcesses) { >+ for (const auto& pluginProcess : m_pluginProcesses) { > if (pluginProcess->pluginProcessToken() == pluginProcessToken) > return pluginProcess.get(); > } >diff --git a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >index c9d22f6763fb7adc6ce912015982207568f600a7..97512dda9cb16f9c0a99c0e771edec27ee3dde17 100644 >--- a/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >+++ b/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp >@@ -228,7 +228,7 @@ void ResourceLoadStatisticsMemoryStore::removeDataRecords(CompletionHandler<void > > #if ENABLE(NETSCAPE_PLUGIN_API) > m_activePluginTokens.clear(); >- for (auto plugin : PluginProcessManager::singleton().pluginProcesses()) >+ for (const auto& plugin : PluginProcessManager::singleton().pluginProcesses()) > m_activePluginTokens.add(plugin->pluginProcessToken()); > #endif > >@@ -877,7 +877,7 @@ bool ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords() const > return false; > > #if ENABLE(NETSCAPE_PLUGIN_API) >- for (auto plugin : PluginProcessManager::singleton().pluginProcesses()) { >+ for (const auto& plugin : PluginProcessManager::singleton().pluginProcesses()) { > if (!m_activePluginTokens.contains(plugin->pluginProcessToken())) > return true; > } >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index c54cde0a1f878dd91ac430851ff376715b5d9067..2079d4cfd5c9bba07c35389fc5a335cfc50b30ea 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -8135,7 +8135,7 @@ void WebPageProxy::invalidateAllAttachments() > > void WebPageProxy::serializedAttachmentDataForIdentifiers(const Vector<String>& identifiers, Vector<WebCore::SerializedAttachmentData>& serializedData) > { >- for (auto identifier : identifiers) { >+ for (const auto& identifier : identifiers) { > auto attachment = attachmentForIdentifier(identifier); > if (!attachment) > continue; >diff --git a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp >index d19404d50617f614513294a6cdb6bdf5888dd6e9..affd7e8acae2decb5c844e873b56f7d153d0ac96 100644 >--- a/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp >+++ b/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp >@@ -85,7 +85,7 @@ void LocalStorageDatabaseTracker::deleteDatabaseWithOrigin(const SecurityOriginD > void LocalStorageDatabaseTracker::deleteAllDatabases() > { > auto paths = FileSystem::listDirectory(m_localStorageDirectory, "*.localstorage"); >- for (auto path : paths) { >+ for (const auto& path : paths) { > SQLiteFileSystem::deleteDatabaseFile(path); > > // FIXME: Call out to the client. >@@ -118,7 +118,7 @@ Vector<SecurityOriginData> LocalStorageDatabaseTracker::origins() const > Vector<SecurityOriginData> databaseOrigins; > auto paths = FileSystem::listDirectory(m_localStorageDirectory, "*.localstorage"); > >- for (auto path : paths) { >+ for (const auto& path : paths) { > auto filename = FileSystem::pathGetFileName(path); > auto originIdentifier = filename.substring(0, filename.length() - strlen(".localstorage")); > auto origin = SecurityOriginData::fromDatabaseIdentifier(originIdentifier); >@@ -137,7 +137,7 @@ Vector<LocalStorageDatabaseTracker::OriginDetails> LocalStorageDatabaseTracker:: > auto databaseOrigins = origins(); > result.reserveInitialCapacity(databaseOrigins.size()); > >- for (auto origin : databaseOrigins) { >+ for (const auto& origin : databaseOrigins) { > String path = databasePath(origin); > > OriginDetails details; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 99a069c55c78fb959ae4535a633a089b9e0de3cf..c4c244ea70e3ffb7f99faa15c94ed5cb5ed9c85f 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -614,7 +614,7 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters) > #endif > #endif > >- for (auto iterator : parameters.urlSchemeHandlers) >+ for (const auto& iterator : parameters.urlSchemeHandlers) > registerURLSchemeHandler(iterator.value, iterator.key); > > m_userContentController->addUserContentWorlds(parameters.userContentWorlds); >diff --git a/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm >index 358f96781ed70bdd67c0935f3892d70c286ead15..d2555c19908aba66a24c1c1bdd156f2d3d290483 100644 >--- a/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm >+++ b/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm >@@ -529,7 +529,7 @@ void TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired() > if (m_activityStateChangeID != ActivityStateChangeAsynchronous) > m_webPage.send(Messages::WebPageProxy::DidUpdateActivityState()); > >- for (auto callbackID : m_nextActivityStateChangeCallbackIDs) >+ for (const auto& callbackID : m_nextActivityStateChangeCallbackIDs) > m_webPage.send(Messages::WebPageProxy::VoidCallback(callbackID)); > > m_nextActivityStateChangeCallbackIDs.clear(); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index b2bfc801513e77db963f766ce53f05929f1ec56a..5ead067840afcc7796bd01b7b4a3ff76d7643b61 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,17 @@ >+2018-12-17 David Kilzer <ddkilzer@apple.com> >+ >+ clang-tidy: loop variable is copied but only used as const reference in WebCore, WebKit, Tools >+ <https://webkit.org/b/192751> >+ <rdar://problem/46771623> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Change loop variables to const references to avoid unnecessary >+ copies. >+ >+ * DumpRenderTree/mac/DumpRenderTreePasteboard.mm: >+ (-[LocalPasteboard pasteboardItems]): >+ > 2018-12-12 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r239103. >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm b/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm >index ae29a94420e72e84144c5061f3b0c731ddcd9459..1d4a64bf7d236617920ec558936b8778464486f4 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm >@@ -240,7 +240,7 @@ - (BOOL)writeObjects:(NSArray<id <NSPasteboardWriting>> *)objects > - (NSArray<NSPasteboardItem *> *)pasteboardItems > { > auto item = adoptNS([[NSPasteboardItem alloc] init]); >- for (auto typeAndData : _data) { >+ for (const auto& typeAndData : _data) { > NSData *data = (__bridge NSData *)typeAndData.value.get(); > NSString *type = (__bridge NSString *)typeAndData.key.get(); > [item setData:data forType:type];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192751
: 357431