| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 void MutationObserver::observationStarted( | 157 void MutationObserver::observationStarted( |
| 158 MutationObserverRegistration* registration) { | 158 MutationObserverRegistration* registration) { |
| 159 DCHECK(!m_registrations.contains(registration)); | 159 DCHECK(!m_registrations.contains(registration)); |
| 160 m_registrations.insert(registration); | 160 m_registrations.insert(registration); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void MutationObserver::observationEnded( | 163 void MutationObserver::observationEnded( |
| 164 MutationObserverRegistration* registration) { | 164 MutationObserverRegistration* registration) { |
| 165 DCHECK(m_registrations.contains(registration)); | 165 DCHECK(m_registrations.contains(registration)); |
| 166 m_registrations.remove(registration); | 166 m_registrations.erase(registration); |
| 167 } | 167 } |
| 168 | 168 |
| 169 static MutationObserverSet& activeMutationObservers() { | 169 static MutationObserverSet& activeMutationObservers() { |
| 170 DEFINE_STATIC_LOCAL(MutationObserverSet, activeObservers, | 170 DEFINE_STATIC_LOCAL(MutationObserverSet, activeObservers, |
| 171 (new MutationObserverSet)); | 171 (new MutationObserverSet)); |
| 172 return activeObservers; | 172 return activeObservers; |
| 173 } | 173 } |
| 174 | 174 |
| 175 using SlotChangeList = HeapVector<Member<HTMLSlotElement>>; | 175 using SlotChangeList = HeapVector<Member<HTMLSlotElement>>; |
| 176 | 176 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 void MutationObserver::resumeSuspendedObservers() { | 274 void MutationObserver::resumeSuspendedObservers() { |
| 275 DCHECK(isMainThread()); | 275 DCHECK(isMainThread()); |
| 276 if (suspendedMutationObservers().isEmpty()) | 276 if (suspendedMutationObservers().isEmpty()) |
| 277 return; | 277 return; |
| 278 | 278 |
| 279 MutationObserverVector suspended; | 279 MutationObserverVector suspended; |
| 280 copyToVector(suspendedMutationObservers(), suspended); | 280 copyToVector(suspendedMutationObservers(), suspended); |
| 281 for (const auto& observer : suspended) { | 281 for (const auto& observer : suspended) { |
| 282 if (!observer->shouldBeSuspended()) { | 282 if (!observer->shouldBeSuspended()) { |
| 283 suspendedMutationObservers().remove(observer); | 283 suspendedMutationObservers().erase(observer); |
| 284 activateObserver(observer); | 284 activateObserver(observer); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 void MutationObserver::deliverMutations() { | 289 void MutationObserver::deliverMutations() { |
| 290 // These steps are defined in DOM Standard's "notify mutation observers". | 290 // These steps are defined in DOM Standard's "notify mutation observers". |
| 291 // https://dom.spec.whatwg.org/#notify-mutation-observers | 291 // https://dom.spec.whatwg.org/#notify-mutation-observers |
| 292 DCHECK(isMainThread()); | 292 DCHECK(isMainThread()); |
| 293 | 293 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 312 } | 312 } |
| 313 | 313 |
| 314 DEFINE_TRACE(MutationObserver) { | 314 DEFINE_TRACE(MutationObserver) { |
| 315 visitor->trace(m_callback); | 315 visitor->trace(m_callback); |
| 316 visitor->trace(m_records); | 316 visitor->trace(m_records); |
| 317 visitor->trace(m_registrations); | 317 visitor->trace(m_registrations); |
| 318 visitor->trace(m_callback); | 318 visitor->trace(m_callback); |
| 319 } | 319 } |
| 320 | 320 |
| 321 } // namespace blink | 321 } // namespace blink |
| OLD | NEW |