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

Side by Side Diff: Source/core/dom/MutationObserver.cpp

Issue 1039523003: MutationObserver: add a check that iterating registration still exists in original set (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 records.swap(m_records); 149 records.swap(m_records);
150 InspectorInstrumentation::didClearAllMutationRecords(m_callback->executionCo ntext(), this); 150 InspectorInstrumentation::didClearAllMutationRecords(m_callback->executionCo ntext(), this);
151 return records; 151 return records;
152 } 152 }
153 153
154 void MutationObserver::disconnect() 154 void MutationObserver::disconnect()
155 { 155 {
156 m_records.clear(); 156 m_records.clear();
157 InspectorInstrumentation::didClearAllMutationRecords(m_callback->executionCo ntext(), this); 157 InspectorInstrumentation::didClearAllMutationRecords(m_callback->executionCo ntext(), this);
158 MutationObserverRegistrationSet registrations(m_registrations); 158 MutationObserverRegistrationSet registrations(m_registrations);
159 for (auto& registration : registrations) 159 for (auto& registration : registrations) {
160 registration->unregister(); 160 if (m_registrations.contains(registration))
haraken 2015/03/27 02:40:10 Would you add a comment on this (i.e., the registr
161 registration->unregister();
162 }
161 ASSERT(m_registrations.isEmpty()); 163 ASSERT(m_registrations.isEmpty());
162 } 164 }
163 165
164 void MutationObserver::observationStarted(MutationObserverRegistration* registra tion) 166 void MutationObserver::observationStarted(MutationObserverRegistration* registra tion)
165 { 167 {
166 ASSERT(!m_registrations.contains(registration)); 168 ASSERT(!m_registrations.contains(registration));
167 m_registrations.add(registration); 169 m_registrations.add(registration);
168 } 170 }
169 171
170 void MutationObserver::observationEnded(MutationObserverRegistration* registrati on) 172 void MutationObserver::observationEnded(MutationObserverRegistration* registrati on)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 { 282 {
281 #if ENABLE(OILPAN) 283 #if ENABLE(OILPAN)
282 visitor->trace(m_callback); 284 visitor->trace(m_callback);
283 visitor->trace(m_records); 285 visitor->trace(m_records);
284 visitor->trace(m_registrations); 286 visitor->trace(m_registrations);
285 visitor->trace(m_callback); 287 visitor->trace(m_callback);
286 #endif 288 #endif
287 } 289 }
288 290
289 } // namespace blink 291 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698