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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 void MutationObserver::cancelInspectorAsyncTasks() { | 213 void MutationObserver::cancelInspectorAsyncTasks() { |
214 for (auto& record : m_records) | 214 for (auto& record : m_records) |
215 InspectorInstrumentation::asyncTaskCanceled( | 215 InspectorInstrumentation::asyncTaskCanceled( |
216 m_callback->getExecutionContext(), record); | 216 m_callback->getExecutionContext(), record); |
217 } | 217 } |
218 | 218 |
219 void MutationObserver::deliver() { | 219 void MutationObserver::deliver() { |
220 DCHECK(!shouldBeSuspended()); | 220 DCHECK(!shouldBeSuspended()); |
221 | 221 |
222 // Calling clearTransientRegistrations() can modify m_registrations, so it's n
ecessary | 222 // Calling clearTransientRegistrations() can modify m_registrations, so it's |
223 // to make a copy of the transient registrations before operating on them. | 223 // necessary to make a copy of the transient registrations before operating on |
| 224 // them. |
224 HeapVector<Member<MutationObserverRegistration>, 1> transientRegistrations; | 225 HeapVector<Member<MutationObserverRegistration>, 1> transientRegistrations; |
225 for (auto& registration : m_registrations) { | 226 for (auto& registration : m_registrations) { |
226 if (registration->hasTransientRegistrations()) | 227 if (registration->hasTransientRegistrations()) |
227 transientRegistrations.append(registration); | 228 transientRegistrations.append(registration); |
228 } | 229 } |
229 for (size_t i = 0; i < transientRegistrations.size(); ++i) | 230 for (size_t i = 0; i < transientRegistrations.size(); ++i) |
230 transientRegistrations[i]->clearTransientRegistrations(); | 231 transientRegistrations[i]->clearTransientRegistrations(); |
231 | 232 |
232 if (m_records.isEmpty()) | 233 if (m_records.isEmpty()) |
233 return; | 234 return; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 272 } |
272 | 273 |
273 DEFINE_TRACE(MutationObserver) { | 274 DEFINE_TRACE(MutationObserver) { |
274 visitor->trace(m_callback); | 275 visitor->trace(m_callback); |
275 visitor->trace(m_records); | 276 visitor->trace(m_records); |
276 visitor->trace(m_registrations); | 277 visitor->trace(m_registrations); |
277 visitor->trace(m_callback); | 278 visitor->trace(m_callback); |
278 } | 279 } |
279 | 280 |
280 } // namespace blink | 281 } // namespace blink |
OLD | NEW |