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

Side by Side Diff: Source/core/frame/EventHandlerRegistry.cpp

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed config.gni. Minor cleanups. Created 6 years, 5 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
OLDNEW
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/frame/EventHandlerRegistry.h" 6 #include "core/frame/EventHandlerRegistry.h"
7 7
8 #include "core/events/ThreadLocalEventNames.h" 8 #include "core/events/ThreadLocalEventNames.h"
9 #include "core/frame/LocalDOMWindow.h" 9 #include "core/frame/LocalDOMWindow.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 12 matching lines...) Expand all
23 { 23 {
24 checkConsistency(); 24 checkConsistency();
25 } 25 }
26 26
27 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event HandlerClass* result) 27 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event HandlerClass* result)
28 { 28 {
29 if (eventType == EventTypeNames::scroll) { 29 if (eventType == EventTypeNames::scroll) {
30 *result = ScrollEvent; 30 *result = ScrollEvent;
31 } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames ::mousewheel) { 31 } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames ::mousewheel) {
32 *result = WheelEvent; 32 *result = WheelEvent;
33 #if ASSERT_ENABLED 33 #if ENABLE(ASSERT)
34 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames: :mousemove || eventType == EventTypeNames::touchstart) { 34 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames: :mousemove || eventType == EventTypeNames::touchstart) {
35 *result = EventsForTesting; 35 *result = EventsForTesting;
36 #endif 36 #endif
37 } else { 37 } else {
38 return false; 38 return false;
39 } 39 }
40 return true; 40 return true;
41 } 41 }
42 42
43 const EventTargetSet* EventHandlerRegistry::eventHandlerTargets(EventHandlerClas s handlerClass) const 43 const EventTargetSet* EventHandlerRegistry::eventHandlerTargets(EventHandlerClas s handlerClass) const
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 switch (handlerClass) { 161 switch (handlerClass) {
162 case ScrollEvent: 162 case ScrollEvent:
163 if (scrollingCoordinator) 163 if (scrollingCoordinator)
164 scrollingCoordinator->updateHaveScrollEventHandlers(); 164 scrollingCoordinator->updateHaveScrollEventHandlers();
165 break; 165 break;
166 case WheelEvent: 166 case WheelEvent:
167 if (scrollingCoordinator) 167 if (scrollingCoordinator)
168 scrollingCoordinator->updateHaveWheelEventHandlers(); 168 scrollingCoordinator->updateHaveWheelEventHandlers();
169 break; 169 break;
170 #if ASSERT_ENABLED 170 #if ENABLE(ASSERT)
171 case EventsForTesting: 171 case EventsForTesting:
172 break; 172 break;
173 #endif 173 #endif
174 default: 174 default:
175 ASSERT_NOT_REACHED(); 175 ASSERT_NOT_REACHED();
176 break; 176 break;
177 } 177 }
178 } 178 }
179 179
180 void EventHandlerRegistry::trace(Visitor* visitor) 180 void EventHandlerRegistry::trace(Visitor* visitor)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 ASSERT_NOT_REACHED(); 224 ASSERT_NOT_REACHED();
225 } 225 }
226 } 226 }
227 for (size_t i = 0; i < targetsToRemove.size(); ++i) 227 for (size_t i = 0; i < targetsToRemove.size(); ++i)
228 updateEventHandlerInternal(RemoveAll, handlerClass, targetsToRemove[ i]); 228 updateEventHandlerInternal(RemoveAll, handlerClass, targetsToRemove[ i]);
229 } 229 }
230 } 230 }
231 231
232 void EventHandlerRegistry::checkConsistency() const 232 void EventHandlerRegistry::checkConsistency() const
233 { 233 {
234 #if ASSERT_ENABLED 234 #if ENABLE(ASSERT)
235 for (size_t i = 0; i < EventHandlerClassCount; ++i) { 235 for (size_t i = 0; i < EventHandlerClassCount; ++i) {
236 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i); 236 EventHandlerClass handlerClass = static_cast<EventHandlerClass>(i);
237 const EventTargetSet* targets = &m_targets[handlerClass]; 237 const EventTargetSet* targets = &m_targets[handlerClass];
238 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter) { 238 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter) {
239 if (Node* node = iter->key->toNode()) { 239 if (Node* node = iter->key->toNode()) {
240 // See the comment for |documentDetached| if either of these ass ertions fails. 240 // See the comment for |documentDetached| if either of these ass ertions fails.
241 ASSERT(node->document().frameHost()); 241 ASSERT(node->document().frameHost());
242 ASSERT(node->document().frameHost() == &m_frameHost); 242 ASSERT(node->document().frameHost() == &m_frameHost);
243 } else if (LocalDOMWindow* window = iter->key->toDOMWindow()) { 243 } else if (LocalDOMWindow* window = iter->key->toDOMWindow()) {
244 // If any of these assertions fail, LocalDOMWindow failed to unr egister its handlers 244 // If any of these assertions fail, LocalDOMWindow failed to unr egister its handlers
245 // properly. 245 // properly.
246 ASSERT(window->frame()); 246 ASSERT(window->frame());
247 ASSERT(window->frame()->host()); 247 ASSERT(window->frame()->host());
248 ASSERT(window->frame()->host() == &m_frameHost); 248 ASSERT(window->frame()->host() == &m_frameHost);
249 } 249 }
250 } 250 }
251 } 251 }
252 #endif // ASSERT_ENABLED 252 #endif // ENABLE(ASSERT)
253 } 253 }
254 254
255 } // namespace WebCore 255 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698