WebKit Bugzilla
Attachment 357226 Details for
Bug 192661
: clang-tidy: loop variable is copied but only used as const reference in Document.cpp, Element.cpp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v1
bug-192661-20181213053302.patch (text/plain), 3.35 KB, created by
David Kilzer (:ddkilzer)
on 2018-12-13 05:33:03 PST
(
hide
)
Description:
Patch v1
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2018-12-13 05:33:03 PST
Size:
3.35 KB
patch
obsolete
>Subversion Revision: 239112 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c0ae4ec3cd36a93400445791c559a829babf673d..88f7eddc26957c3e5de8628c2edf1fd0742d0379 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-12-13 David Kilzer <ddkilzer@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 NOBODY (OOPS!). >+ >+ * 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-12 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] A few API tests are failing after r239086 >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 226bff2a8a285883785c245023121c685dac7bc3..d6be912b123ab17970e88b482146091383aabdda 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -7815,7 +7815,7 @@ void Document::updateIntersectionObservations() > > 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::scheduleForcedIntersectionObservationUpdate() > > void Document::notifyIntersectionObserversTimerFired() > { >- for (auto observer : m_intersectionObserversWithPendingNotifications) { >+ for (const auto& observer : m_intersectionObserversWithPendingNotifications) { > if (observer) > observer->notify(); > } >diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp >index 93be7bb2cac6c590b55008b9845f8faa3e4c1e45..6468eabf340002285c4c542984ef77d9cda55894 100644 >--- a/Source/WebCore/dom/Element.cpp >+++ b/Source/WebCore/dom/Element.cpp >@@ -1774,7 +1774,7 @@ void Element::didMoveToNewDocument(Document& oldDocument, Document& newDocument) > > #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 @@ void Element::disconnectFromIntersectionObservers() > 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(); > }
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 192661
: 357226