Title: [239266] trunk
Revision
239266
Author
ddkil...@apple.com
Date
2018-12-17 06:22:41 -0800 (Mon, 17 Dec 2018)

Log Message

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 Daniel Bates.

Change loop variables to const references to avoid unnecessary
copies.

Source/WebCore:

* 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):

Source/WebKit:

* 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):

Tools:

* DumpRenderTree/mac/DumpRenderTreePasteboard.mm:
(-[LocalPasteboard pasteboardItems]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239265 => 239266)


--- trunk/Source/WebCore/ChangeLog	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/ChangeLog	2018-12-17 14:22:41 UTC (rev 239266)
@@ -1,3 +1,65 @@
+2018-12-17  David Kilzer  <ddkil...@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 Daniel Bates.
+
+        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-17  Ms2ger  <ms2...@igalia.com>
 
         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI

Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp (239265 => 239266)


--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -213,15 +213,15 @@
 
     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 @@
         if (!keyValueMap)
             continue;
 
-        for (auto entry : *keyValueMap) {
+        for (const auto& entry : *keyValueMap) {
             objectStore->deleteRecord(entry.key);
             objectStore->addRecord(*this, entry.key, { entry.value });
         }

Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp (239265 => 239266)


--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -338,7 +338,7 @@
 
     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 { };

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (239265 => 239266)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -531,7 +531,7 @@
     // 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;
 

Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (239265 => 239266)


--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -421,7 +421,7 @@
         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)

Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp (239265 => 239266)


--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -47,7 +47,7 @@
     , 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 @@
     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');
     }

Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (239265 => 239266)


--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -739,13 +739,13 @@
 #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.

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (239265 => 239266)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -2523,7 +2523,7 @@
 {
     AccessibilityObject::AccessibilityChildrenVector elements;
     ariaElementsFromAttribute(elements, attributeName);
-    for (auto element : elements) {
+    for (const auto& element : elements) {
         if (activeDescendant->isDescendantOfObject(element.get()))
             return element->renderer();
     }

Modified: trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp (239265 => 239266)


--- trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/accessibility/AccessibilityTableRow.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -135,7 +135,7 @@
     // 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;

Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (239265 => 239266)


--- trunk/Source/WebCore/animation/KeyframeEffect.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -954,7 +954,7 @@
         }
         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()) {

Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp (239265 => 239266)


--- trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -92,7 +92,7 @@
     }
 
     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 @@
         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);

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (239265 => 239266)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -1145,7 +1145,7 @@
         return;
 
     auto& cssValuePool = CSSValuePool::singleton();
-    for (auto lineName : iter->value)
+    for (const auto& lineName : iter->value)
         lineNamesValue.append(cssValuePool.createValue(lineName, CSSPrimitiveValue::CSS_STRING));
 }
 

Modified: trunk/Source/WebCore/dom/DataTransfer.cpp (239265 => 239266)


--- trunk/Source/WebCore/dom/DataTransfer.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/dom/DataTransfer.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -146,7 +146,7 @@
 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())

Modified: trunk/Source/WebCore/dom/TreeScope.cpp (239265 => 239266)


--- trunk/Source/WebCore/dom/TreeScope.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/dom/TreeScope.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -406,7 +406,7 @@
     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)) {

Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (239265 => 239266)


--- trunk/Source/WebCore/html/track/WebVTTParser.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -338,7 +338,7 @@
     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;

Modified: trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp (239265 => 239266)


--- trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -134,7 +134,7 @@
     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;

Modified: trunk/Source/WebCore/page/Page.cpp (239265 => 239266)


--- trunk/Source/WebCore/page/Page.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/page/Page.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -1263,7 +1263,7 @@
 void Page::updateIntersectionObservations()
 {
     m_intersectionObservationUpdateTimer.stop();
-    for (auto document : m_documentsNeedingIntersectionObservationUpdate) {
+    for (const auto& document : m_documentsNeedingIntersectionObservationUpdate) {
         if (document)
             document->updateIntersectionObservations();
     }

Modified: trunk/Source/WebCore/page/TextIndicator.cpp (239265 => 239266)


--- trunk/Source/WebCore/page/TextIndicator.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/page/TextIndicator.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -252,7 +252,7 @@
             parentRendererBackgroundColors.append(visitedDependentBackgroundColor);
     }
     parentRendererBackgroundColors.reverse();
-    for (auto backgroundColor : parentRendererBackgroundColors)
+    for (const auto& backgroundColor : parentRendererBackgroundColors)
         estimatedBackgroundColor = estimatedBackgroundColor.blend(backgroundColor);
 
     return estimatedBackgroundColor;

Modified: trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp (239265 => 239266)


--- trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -95,7 +95,7 @@
         }
         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()) {

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp (239265 => 239266)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -127,7 +127,7 @@
 
 void DisplayRefreshMonitorManager::displayWasUpdated(PlatformDisplayID displayID)
 {
-    for (auto monitor : m_monitors) {
+    for (const auto& monitor : m_monitors) {
         if (displayID == monitor->displayID() && monitor->hasRequestedRefreshCallback())
             monitor->displayLinkFired();
     }

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (239265 => 239266)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -688,7 +688,7 @@
         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 @@
     }
 
     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 @@
     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) {

Modified: trunk/Source/WebCore/platform/graphics/mac/ImageMac.mm (239265 => 239266)


--- trunk/Source/WebCore/platform/graphics/mac/ImageMac.mm	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/platform/graphics/mac/ImageMac.mm	2018-12-17 14:22:41 UTC (rev 239266)
@@ -88,7 +88,7 @@
     if (!destination)
         return nullptr;
 
-    for (auto nativeImage : nativeImages)
+    for (const auto& nativeImage : nativeImages)
         CGImageDestinationAddImage(destination.get(), nativeImage.get(), 0);
 
     CGImageDestinationFinalize(destination.get());

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (239265 => 239266)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -682,7 +682,7 @@
 
     if (other.m_listBasedTestResult) {
         NodeSet& set = mutableListBasedTestResult();
-        for (auto node : *other.m_listBasedTestResult)
+        for (const auto& node : *other.m_listBasedTestResult)
             set.add(node.get());
     }
 }

Modified: trunk/Source/WebCore/testing/Internals.cpp (239265 => 239266)


--- trunk/Source/WebCore/testing/Internals.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebCore/testing/Internals.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -1071,7 +1071,7 @@
         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;
 }

Modified: trunk/Source/WebKit/ChangeLog (239265 => 239266)


--- trunk/Source/WebKit/ChangeLog	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/ChangeLog	2018-12-17 14:22:41 UTC (rev 239266)
@@ -1,3 +1,40 @@
+2018-12-17  David Kilzer  <ddkil...@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 Daniel Bates.
+
+        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-17  Ms2ger  <ms2...@igalia.com>
 
         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI

Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp (239265 => 239266)


--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -71,7 +71,7 @@
 WebSWServerConnection::~WebSWServerConnection()
 {
     NetworkProcess::singleton().unregisterSWServerConnection(*this);
-    for (auto keyValue : m_clientOrigins)
+    for (const auto& keyValue : m_clientOrigins)
         server().unregisterServiceWorkerClient(keyValue.value, keyValue.key);
 }
 

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm (239265 => 239266)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm	2018-12-17 14:22:41 UTC (rev 239266)
@@ -517,7 +517,7 @@
 
     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();
     }

Modified: trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (239265 => 239266)


--- trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2018-12-17 14:22:41 UTC (rev 239266)
@@ -636,7 +636,7 @@
 {
     auto result = adoptNS([[NSMutableArray alloc] init]);
 
-    for (auto error : errors) {
+    for (const auto& error : errors) {
         if (auto nsError = toNSError(error))
             [result addObject:nsError.get()];
     }

Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (239265 => 239266)


--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -1198,7 +1198,7 @@
     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 @@
     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 @@
     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 @@
     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 @@
         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.");

Modified: trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp (239265 => 239266)


--- trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/UIProcess/Plugins/PluginProcessManager.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -123,7 +123,7 @@
 
 PluginProcessProxy* PluginProcessManager::getPluginProcess(uint64_t pluginProcessToken)
 {
-    for (auto pluginProcess : m_pluginProcesses) {
+    for (const auto& pluginProcess : m_pluginProcesses) {
         if (pluginProcess->pluginProcessToken() == pluginProcessToken)
             return pluginProcess.get();
     }

Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp (239265 => 239266)


--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -228,7 +228,7 @@
 
 #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 @@
         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;
     }

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (239265 => 239266)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -8164,7 +8164,7 @@
 
 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;

Modified: trunk/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp (239265 => 239266)


--- trunk/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -85,7 +85,7 @@
 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> 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 @@
     auto databaseOrigins = origins();
     result.reserveInitialCapacity(databaseOrigins.size());
 
-    for (auto origin : databaseOrigins) {
+    for (const auto& origin : databaseOrigins) {
         String path = databasePath(origin);
 
         OriginDetails details;

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (239265 => 239266)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-12-17 14:22:41 UTC (rev 239266)
@@ -616,7 +616,7 @@
 #endif
 #endif
 
-    for (auto iterator : parameters.urlSchemeHandlers)
+    for (const auto& iterator : parameters.urlSchemeHandlers)
         registerURLSchemeHandler(iterator.value, iterator.key);
 
     m_userContentController->addUserContentWorlds(parameters.userContentWorlds);

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (239265 => 239266)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2018-12-17 14:22:41 UTC (rev 239266)
@@ -529,7 +529,7 @@
     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();

Modified: trunk/Tools/ChangeLog (239265 => 239266)


--- trunk/Tools/ChangeLog	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Tools/ChangeLog	2018-12-17 14:22:41 UTC (rev 239266)
@@ -1,3 +1,17 @@
+2018-12-17  David Kilzer  <ddkil...@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 Daniel Bates.
+
+        Change loop variables to const references to avoid unnecessary
+        copies.
+
+        * DumpRenderTree/mac/DumpRenderTreePasteboard.mm:
+        (-[LocalPasteboard pasteboardItems]):
+
 2018-12-17  Ms2ger  <ms2...@igalia.com>
 
         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm (239265 => 239266)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm	2018-12-17 14:08:46 UTC (rev 239265)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.mm	2018-12-17 14:22:41 UTC (rev 239266)
@@ -240,7 +240,7 @@
 - (NSArray<NSPasteboardItem *> *)pasteboardItems
 {
     auto item = adoptNS([[NSPasteboardItem alloc] init]);
-    for (auto typeAndData : _data) {
+    for (const auto& typeAndData : _data) {
         NSData *data = "" NSData *)typeAndData.value.get();
         NSString *type = (__bridge NSString *)typeAndData.key.get();
         [item setData:data forType:type];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to