OLD | NEW |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 MutationObserverInterestGroup::MutationObserverInterestGroup(WillBeHeapHashMap<R
awPtrWillBeMember<MutationObserver>, MutationRecordDeliveryOptions>& observers,
MutationRecordDeliveryOptions oldValueFlag) | 50 MutationObserverInterestGroup::MutationObserverInterestGroup(WillBeHeapHashMap<R
awPtrWillBeMember<MutationObserver>, MutationRecordDeliveryOptions>& observers,
MutationRecordDeliveryOptions oldValueFlag) |
51 : m_oldValueFlag(oldValueFlag) | 51 : m_oldValueFlag(oldValueFlag) |
52 { | 52 { |
53 ASSERT(!observers.isEmpty()); | 53 ASSERT(!observers.isEmpty()); |
54 m_observers.swap(observers); | 54 m_observers.swap(observers); |
55 } | 55 } |
56 | 56 |
57 bool MutationObserverInterestGroup::isOldValueRequested() | 57 bool MutationObserverInterestGroup::isOldValueRequested() |
58 { | 58 { |
59 for (WillBeHeapHashMap<RawPtrWillBeMember<MutationObserver>, MutationRecordD
eliveryOptions>::iterator iter = m_observers.begin(); iter != m_observers.end();
++iter) { | 59 for (auto& observer : m_observers) { |
60 if (hasOldValue(iter->value)) | 60 if (hasOldValue(observer.value)) |
61 return true; | 61 return true; |
62 } | 62 } |
63 return false; | 63 return false; |
64 } | 64 } |
65 | 65 |
66 void MutationObserverInterestGroup::enqueueMutationRecord(PassRefPtrWillBeRawPtr
<MutationRecord> prpMutation) | 66 void MutationObserverInterestGroup::enqueueMutationRecord(PassRefPtrWillBeRawPtr
<MutationRecord> prpMutation) |
67 { | 67 { |
68 RefPtrWillBeRawPtr<MutationRecord> mutation = prpMutation; | 68 RefPtrWillBeRawPtr<MutationRecord> mutation = prpMutation; |
69 RefPtrWillBeRawPtr<MutationRecord> mutationWithNullOldValue = nullptr; | 69 RefPtrWillBeRawPtr<MutationRecord> mutationWithNullOldValue = nullptr; |
70 for (WillBeHeapHashMap<RawPtrWillBeMember<MutationObserver>, MutationRecordD
eliveryOptions>::iterator iter = m_observers.begin(); iter != m_observers.end();
++iter) { | 70 for (auto& iter : m_observers) { |
71 MutationObserver* observer = iter->key; | 71 MutationObserver* observer = iter.key; |
72 if (hasOldValue(iter->value)) { | 72 if (hasOldValue(iter.value)) { |
73 observer->enqueueMutationRecord(mutation); | 73 observer->enqueueMutationRecord(mutation); |
74 continue; | 74 continue; |
75 } | 75 } |
76 if (!mutationWithNullOldValue) { | 76 if (!mutationWithNullOldValue) { |
77 if (mutation->oldValue().isNull()) | 77 if (mutation->oldValue().isNull()) |
78 mutationWithNullOldValue = mutation; | 78 mutationWithNullOldValue = mutation; |
79 else | 79 else |
80 mutationWithNullOldValue = MutationRecord::createWithNullOldValu
e(mutation).get(); | 80 mutationWithNullOldValue = MutationRecord::createWithNullOldValu
e(mutation).get(); |
81 } | 81 } |
82 observer->enqueueMutationRecord(mutationWithNullOldValue); | 82 observer->enqueueMutationRecord(mutationWithNullOldValue); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 void MutationObserverInterestGroup::trace(Visitor* visitor) | 86 void MutationObserverInterestGroup::trace(Visitor* visitor) |
87 { | 87 { |
88 #if ENABLE(OILPAN) | 88 #if ENABLE(OILPAN) |
89 visitor->trace(m_observers); | 89 visitor->trace(m_observers); |
90 #endif | 90 #endif |
91 } | 91 } |
92 | 92 |
93 } // namespace blink | 93 } // namespace blink |
OLD | NEW |