| 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 18 matching lines...) Expand all Loading... |
| 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 RawPtr<MutationObserverInterestGroup> MutationObserverInterestGroup::createIfNee
ded(Node& target, MutationObserver::MutationType type, MutationRecordDeliveryOpt
ions 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 DCHECK((type == MutationObserver::Attributes && attributeName) || !attribute
Name); |
| 40 HeapHashMap<Member<MutationObserver>, MutationRecordDeliveryOptions> observe
rs; | 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 new MutationObserverInterestGroup(observers, oldValueFlag); | 45 return new MutationObserverInterestGroup(observers, oldValueFlag); |
| 46 } | 46 } |
| 47 | 47 |
| 48 MutationObserverInterestGroup::MutationObserverInterestGroup(HeapHashMap<Member<
MutationObserver>, MutationRecordDeliveryOptions>& observers, MutationRecordDeli
veryOptions 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 DCHECK(!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; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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 visitor->trace(m_observers); | 86 visitor->trace(m_observers); |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |