Title: [239160] trunk/Source/WebCore
Revision
239160
Author
ddkil...@apple.com
Date
2018-12-13 06:44:29 -0800 (Thu, 13 Dec 2018)

Log Message

clang-tidy: loop variable is copied but only used as const reference in Document.cpp, Element.cpp
<https://webkit.org/b/192661>
<rdar://problem/46694035>

Reviewed by Daniel Bates.

* dom/Document.cpp:
(WebCore::Document::updateIntersectionObservations):
(WebCore::Document::notifyIntersectionObserversTimerFired):
* dom/Element.cpp:
(WebCore::Element::didMoveToNewDocument):
(WebCore::Element::disconnectFromIntersectionObservers):
- Change loop variables from `auto` to `const auto&` to prevent
  unnecessary copies of WeakPtr<IntersectionObserver> or
  struct IntersectionObserverRegistration objects.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239159 => 239160)


--- trunk/Source/WebCore/ChangeLog	2018-12-13 12:35:17 UTC (rev 239159)
+++ trunk/Source/WebCore/ChangeLog	2018-12-13 14:44:29 UTC (rev 239160)
@@ -1,3 +1,21 @@
+2018-12-13  David Kilzer  <ddkil...@apple.com>
+
+        clang-tidy: loop variable is copied but only used as const reference in Document.cpp, Element.cpp
+        <https://webkit.org/b/192661>
+        <rdar://problem/46694035>
+
+        Reviewed by Daniel Bates.
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateIntersectionObservations):
+        (WebCore::Document::notifyIntersectionObserversTimerFired):
+        * dom/Element.cpp:
+        (WebCore::Element::didMoveToNewDocument):
+        (WebCore::Element::disconnectFromIntersectionObservers):
+        - Change loop variables from `auto` to `const auto&` to prevent
+          unnecessary copies of WeakPtr<IntersectionObserver> or
+          struct IntersectionObserverRegistration objects.
+
 2018-12-13  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [FreeType] Remove HarfBuzzFace

Modified: trunk/Source/WebCore/dom/Document.cpp (239159 => 239160)


--- trunk/Source/WebCore/dom/Document.cpp	2018-12-13 12:35:17 UTC (rev 239159)
+++ trunk/Source/WebCore/dom/Document.cpp	2018-12-13 14:44:29 UTC (rev 239160)
@@ -7815,7 +7815,7 @@
 
     m_needsForcedIntersectionObservationUpdate = false;
 
-    for (auto observer : m_intersectionObservers) {
+    for (const auto& observer : m_intersectionObservers) {
         bool needNotify = false;
         DOMHighResTimeStamp timestamp;
         if (!observer->createTimestamp(timestamp))
@@ -7904,7 +7904,7 @@
 
 void Document::notifyIntersectionObserversTimerFired()
 {
-    for (auto observer : m_intersectionObserversWithPendingNotifications) {
+    for (const auto& observer : m_intersectionObserversWithPendingNotifications) {
         if (observer)
             observer->notify();
     }

Modified: trunk/Source/WebCore/dom/Element.cpp (239159 => 239160)


--- trunk/Source/WebCore/dom/Element.cpp	2018-12-13 12:35:17 UTC (rev 239159)
+++ trunk/Source/WebCore/dom/Element.cpp	2018-12-13 14:44:29 UTC (rev 239160)
@@ -1774,7 +1774,7 @@
 
 #if ENABLE(INTERSECTION_OBSERVER)
     if (auto* observerData = intersectionObserverData()) {
-        for (auto observer : observerData->observers) {
+        for (const auto& observer : observerData->observers) {
             if (observer->hasObservationTargets()) {
                 oldDocument.removeIntersectionObserver(*observer);
                 newDocument.addIntersectionObserver(*observer);
@@ -3392,11 +3392,11 @@
     if (!observerData)
         return;
 
-    for (auto& registration : observerData->registrations)
+    for (const auto& registration : observerData->registrations)
         registration.observer->targetDestroyed(*this);
     observerData->registrations.clear();
 
-    for (auto observer : observerData->observers)
+    for (const auto& observer : observerData->observers)
         observer->rootDestroyed();
     observerData->observers.clear();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to