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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/dom/MutationObserverInterestGroup.h" 31 #include "core/dom/MutationObserverInterestGroup.h"
32 32
33 #include "core/dom/MutationRecord.h" 33 #include "core/dom/MutationRecord.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 PassOwnPtrWillBeRawPtr<MutationObserverInterestGroup> MutationObserverInterestGr oup::createIfNeeded(Node& target, MutationObserver::MutationType type, MutationR ecordDeliveryOptions oldValueFlag, const QualifiedName* attributeName) 37 RawPtr<MutationObserverInterestGroup> MutationObserverInterestGroup::createIfNee ded(Node& target, MutationObserver::MutationType type, MutationRecordDeliveryOpt ions oldValueFlag, const QualifiedName* attributeName)
38 { 38 {
39 ASSERT((type == MutationObserver::Attributes && attributeName) || !attribute Name); 39 ASSERT((type == MutationObserver::Attributes && attributeName) || !attribute Name);
40 WillBeHeapHashMap<RefPtrWillBeMember<MutationObserver>, MutationRecordDelive ryOptions> observers; 40 HeapHashMap<Member<MutationObserver>, MutationRecordDeliveryOptions> observe rs;
41 target.getRegisteredMutationObserversOfType(observers, type, attributeName); 41 target.getRegisteredMutationObserversOfType(observers, type, attributeName);
42 if (observers.isEmpty()) 42 if (observers.isEmpty())
43 return nullptr; 43 return nullptr;
44 44
45 return adoptPtrWillBeNoop(new MutationObserverInterestGroup(observers, oldVa lueFlag)); 45 return new MutationObserverInterestGroup(observers, oldValueFlag);
46 } 46 }
47 47
48 MutationObserverInterestGroup::MutationObserverInterestGroup(WillBeHeapHashMap<R efPtrWillBeMember<MutationObserver>, MutationRecordDeliveryOptions>& observers, MutationRecordDeliveryOptions oldValueFlag) 48 MutationObserverInterestGroup::MutationObserverInterestGroup(HeapHashMap<Member< MutationObserver>, MutationRecordDeliveryOptions>& observers, MutationRecordDeli veryOptions oldValueFlag)
49 : m_oldValueFlag(oldValueFlag) 49 : m_oldValueFlag(oldValueFlag)
50 { 50 {
51 ASSERT(!observers.isEmpty()); 51 ASSERT(!observers.isEmpty());
52 m_observers.swap(observers); 52 m_observers.swap(observers);
53 } 53 }
54 54
55 bool MutationObserverInterestGroup::isOldValueRequested() 55 bool MutationObserverInterestGroup::isOldValueRequested()
56 { 56 {
57 for (auto& observer : m_observers) { 57 for (auto& observer : m_observers) {
58 if (hasOldValue(observer.value)) 58 if (hasOldValue(observer.value))
59 return true; 59 return true;
60 } 60 }
61 return false; 61 return false;
62 } 62 }
63 63
64 void MutationObserverInterestGroup::enqueueMutationRecord(PassRefPtrWillBeRawPtr <MutationRecord> prpMutation) 64 void MutationObserverInterestGroup::enqueueMutationRecord(RawPtr<MutationRecord> prpMutation)
65 { 65 {
66 RefPtrWillBeRawPtr<MutationRecord> mutation = prpMutation; 66 RawPtr<MutationRecord> mutation = prpMutation;
67 RefPtrWillBeRawPtr<MutationRecord> mutationWithNullOldValue = nullptr; 67 RawPtr<MutationRecord> mutationWithNullOldValue = nullptr;
68 for (auto& iter : m_observers) { 68 for (auto& iter : m_observers) {
69 MutationObserver* observer = iter.key.get(); 69 MutationObserver* observer = iter.key.get();
70 if (hasOldValue(iter.value)) { 70 if (hasOldValue(iter.value)) {
71 observer->enqueueMutationRecord(mutation); 71 observer->enqueueMutationRecord(mutation);
72 continue; 72 continue;
73 } 73 }
74 if (!mutationWithNullOldValue) { 74 if (!mutationWithNullOldValue) {
75 if (mutation->oldValue().isNull()) 75 if (mutation->oldValue().isNull())
76 mutationWithNullOldValue = mutation; 76 mutationWithNullOldValue = mutation;
77 else 77 else
78 mutationWithNullOldValue = MutationRecord::createWithNullOldValu e(mutation).get(); 78 mutationWithNullOldValue = MutationRecord::createWithNullOldValu e(mutation).get();
79 } 79 }
80 observer->enqueueMutationRecord(mutationWithNullOldValue); 80 observer->enqueueMutationRecord(mutationWithNullOldValue);
81 } 81 }
82 } 82 }
83 83
84 DEFINE_TRACE(MutationObserverInterestGroup) 84 DEFINE_TRACE(MutationObserverInterestGroup)
85 { 85 {
86 #if ENABLE(OILPAN) 86 #if ENABLE(OILPAN)
87 visitor->trace(m_observers); 87 visitor->trace(m_observers);
88 #endif 88 #endif
89 } 89 }
90 90
91 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698