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

Unified Diff: third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp

Issue 2653463003: Fix assertion hit on debug build for EventHandlerRegistry (Closed)
Patch Set: Fix a typo. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/EventHandlerRegistry.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
diff --git a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
index f8cc545bd5c628645289a8bffa163fbba5cbbea7..527414bdb6171d987fbd42922d94f26be512f888 100644
--- a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
+++ b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
@@ -34,7 +34,10 @@ EventHandlerRegistry::EventHandlerRegistry(FrameHost& frameHost)
: m_frameHost(&frameHost) {}
EventHandlerRegistry::~EventHandlerRegistry() {
- checkConsistency();
+ for (size_t i = 0; i < EventHandlerClassCount; ++i) {
+ EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i);
+ checkConsistency(handlerClass);
+ }
}
bool EventHandlerRegistry::eventTypeToClass(
@@ -73,13 +76,13 @@ bool EventHandlerRegistry::eventTypeToClass(
const EventTargetSet* EventHandlerRegistry::eventHandlerTargets(
EventHandlerClass handlerClass) const {
- checkConsistency();
+ checkConsistency(handlerClass);
return &m_targets[handlerClass];
}
bool EventHandlerRegistry::hasEventHandlers(
EventHandlerClass handlerClass) const {
- checkConsistency();
+ checkConsistency(handlerClass);
return m_targets[handlerClass].size();
}
@@ -308,24 +311,22 @@ void EventHandlerRegistry::documentDetached(Document& document) {
}
}
-void EventHandlerRegistry::checkConsistency() const {
+void EventHandlerRegistry::checkConsistency(
+ EventHandlerClass handlerClass) const {
#if DCHECK_IS_ON()
- for (size_t i = 0; i < EventHandlerClassCount; ++i) {
- EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i);
- const EventTargetSet* targets = &m_targets[handlerClass];
- for (const auto& eventTarget : *targets) {
- if (Node* node = eventTarget.key->toNode()) {
- // See the comment for |documentDetached| if either of these assertions
- // fails.
- ASSERT(node->document().frameHost());
- ASSERT(node->document().frameHost() == m_frameHost);
- } else if (LocalDOMWindow* window = eventTarget.key->toLocalDOMWindow()) {
- // If any of these assertions fail, LocalDOMWindow failed to unregister
- // its handlers properly.
- ASSERT(window->frame());
- ASSERT(window->frame()->host());
- ASSERT(window->frame()->host() == m_frameHost);
- }
+ const EventTargetSet* targets = &m_targets[handlerClass];
+ for (const auto& eventTarget : *targets) {
+ if (Node* node = eventTarget.key->toNode()) {
+ // See the comment for |documentDetached| if either of these assertions
+ // fails.
+ DCHECK(node->document().frameHost());
+ DCHECK(node->document().frameHost() == m_frameHost);
+ } else if (LocalDOMWindow* window = eventTarget.key->toLocalDOMWindow()) {
+ // If any of these assertions fail, LocalDOMWindow failed to unregister
+ // its handlers properly.
+ DCHECK(window->frame());
+ DCHECK(window->frame()->host());
+ DCHECK(window->frame()->host() == m_frameHost);
}
}
#endif // DCHECK_IS_ON()
« no previous file with comments | « third_party/WebKit/Source/core/frame/EventHandlerRegistry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698