OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/dom/EventHandlerRegistry.h" | 6 #include "core/dom/EventHandlerRegistry.h" |
7 | 7 |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/events/ThreadLocalEventNames.h" | 9 #include "core/events/ThreadLocalEventNames.h" |
10 #include "core/events/WheelEvent.h" | 10 #include "core/events/WheelEvent.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 case ScrollEvent: | 192 case ScrollEvent: |
193 if (scrollingCoordinator) | 193 if (scrollingCoordinator) |
194 scrollingCoordinator->updateHaveScrollEventHandlers(); | 194 scrollingCoordinator->updateHaveScrollEventHandlers(); |
195 break; | 195 break; |
196 default: | 196 default: |
197 ASSERT_NOT_REACHED(); | 197 ASSERT_NOT_REACHED(); |
198 break; | 198 break; |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
| 202 void EventHandlerRegistry::clearWeakMembers(Visitor* visitor) |
| 203 { |
| 204 Vector<EventTarget*> deadNodeTargets; |
| 205 for (size_t i = 0; i < EventHandlerClassCount; ++i) { |
| 206 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i); |
| 207 const EventTargetSet* targets = eventHandlerTargets(handlerClass); |
| 208 if (!targets) |
| 209 continue; |
| 210 for (EventTargetSet::const_iterator it = targets->begin(); it != targets
->end(); ++it) { |
| 211 Node* node = it->key->toNode(); |
| 212 if (node && !visitor->isAlive(node)) |
| 213 deadNodeTargets.append(node); |
| 214 } |
| 215 } |
| 216 for (size_t i = 0; i < deadNodeTargets.size(); ++i) |
| 217 didRemoveAllEventHandlers(*deadNodeTargets[i]); |
| 218 } |
| 219 |
202 } // namespace WebCore | 220 } // namespace WebCore |
OLD | NEW |