Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: third_party/WebKit/Source/core/dom/ElementIntersectionObserverData.cpp

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/ElementIntersectionObserverData.h" 5 #include "core/dom/ElementIntersectionObserverData.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/IntersectionObservation.h" 8 #include "core/dom/IntersectionObservation.h"
9 #include "core/dom/IntersectionObserver.h" 9 #include "core/dom/IntersectionObserver.h"
10 #include "core/dom/IntersectionObserverController.h" 10 #include "core/dom/IntersectionObserverController.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 ElementIntersectionObserverData::ElementIntersectionObserverData() {} 14 ElementIntersectionObserverData::ElementIntersectionObserverData() {}
15 15
16 IntersectionObservation* ElementIntersectionObserverData::getObservationFor( 16 IntersectionObservation* ElementIntersectionObserverData::getObservationFor(
17 IntersectionObserver& observer) { 17 IntersectionObserver& observer) {
18 auto i = m_intersectionObservations.find(&observer); 18 auto i = m_intersectionObservations.find(&observer);
19 if (i == m_intersectionObservations.end()) 19 if (i == m_intersectionObservations.end())
20 return nullptr; 20 return nullptr;
21 return i->value; 21 return i->value;
22 } 22 }
23 23
24 void ElementIntersectionObserverData::addObserver( 24 void ElementIntersectionObserverData::addObserver(
25 IntersectionObserver& observer) { 25 IntersectionObserver& observer) {
26 m_intersectionObservers.add(&observer); 26 m_intersectionObservers.insert(&observer);
27 } 27 }
28 28
29 void ElementIntersectionObserverData::removeObserver( 29 void ElementIntersectionObserverData::removeObserver(
30 IntersectionObserver& observer) { 30 IntersectionObserver& observer) {
31 m_intersectionObservers.remove(&observer); 31 m_intersectionObservers.remove(&observer);
32 } 32 }
33 33
34 void ElementIntersectionObserverData::addObservation( 34 void ElementIntersectionObserverData::addObservation(
35 IntersectionObservation& observation) { 35 IntersectionObservation& observation) {
36 DCHECK(observation.observer()); 36 DCHECK(observation.observer());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 visitor->trace(m_intersectionObservations); 70 visitor->trace(m_intersectionObservations);
71 } 71 }
72 72
73 DEFINE_TRACE_WRAPPERS(ElementIntersectionObserverData) { 73 DEFINE_TRACE_WRAPPERS(ElementIntersectionObserverData) {
74 for (auto& entry : m_intersectionObservations) { 74 for (auto& entry : m_intersectionObservations) {
75 visitor->traceWrappers(entry.key); 75 visitor->traceWrappers(entry.key);
76 } 76 }
77 } 77 }
78 78
79 } // namespace blink 79 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698