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

Side by Side Diff: third_party/WebKit/Source/core/events/DOMWindowEventQueue.cpp

Issue 2270293002: Replace ASSERT*() with DCHECK*() in core/events/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: isUnreachableNode -> checkReachableNode Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All Rights Reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 visitor->trace(m_pendingEventTimer); 79 visitor->trace(m_pendingEventTimer);
80 visitor->trace(m_queuedEvents); 80 visitor->trace(m_queuedEvents);
81 EventQueue::trace(visitor); 81 EventQueue::trace(visitor);
82 } 82 }
83 83
84 bool DOMWindowEventQueue::enqueueEvent(Event* event) 84 bool DOMWindowEventQueue::enqueueEvent(Event* event)
85 { 85 {
86 if (m_isClosed) 86 if (m_isClosed)
87 return false; 87 return false;
88 88
89 ASSERT(event->target()); 89 DCHECK(event->target());
90 InspectorInstrumentation::asyncTaskScheduled(event->target()->getExecutionCo ntext(), event->type(), event); 90 InspectorInstrumentation::asyncTaskScheduled(event->target()->getExecutionCo ntext(), event->type(), event);
91 91
92 bool wasAdded = m_queuedEvents.add(event).isNewEntry; 92 bool wasAdded = m_queuedEvents.add(event).isNewEntry;
93 ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list. 93 DCHECK(wasAdded); // It should not have already been in the list.
94 94
95 if (!m_pendingEventTimer->isActive()) 95 if (!m_pendingEventTimer->isActive())
96 m_pendingEventTimer->startOneShot(0, BLINK_FROM_HERE); 96 m_pendingEventTimer->startOneShot(0, BLINK_FROM_HERE);
97 97
98 return true; 98 return true;
99 } 99 }
100 100
101 bool DOMWindowEventQueue::cancelEvent(Event* event) 101 bool DOMWindowEventQueue::cancelEvent(Event* event)
102 { 102 {
103 HeapListHashSet<Member<Event>, 16>::iterator it = m_queuedEvents.find(event) ; 103 HeapListHashSet<Member<Event>, 16>::iterator it = m_queuedEvents.find(event) ;
(...skipping 13 matching lines...) Expand all
117 m_pendingEventTimer->stop(); 117 m_pendingEventTimer->stop();
118 for (const auto& queuedEvent : m_queuedEvents) { 118 for (const auto& queuedEvent : m_queuedEvents) {
119 if (queuedEvent) 119 if (queuedEvent)
120 InspectorInstrumentation::asyncTaskCanceled(queuedEvent->target()->g etExecutionContext(), queuedEvent); 120 InspectorInstrumentation::asyncTaskCanceled(queuedEvent->target()->g etExecutionContext(), queuedEvent);
121 } 121 }
122 m_queuedEvents.clear(); 122 m_queuedEvents.clear();
123 } 123 }
124 124
125 void DOMWindowEventQueue::pendingEventTimerFired() 125 void DOMWindowEventQueue::pendingEventTimerFired()
126 { 126 {
127 ASSERT(!m_pendingEventTimer->isActive()); 127 DCHECK(!m_pendingEventTimer->isActive());
128 ASSERT(!m_queuedEvents.isEmpty()); 128 DCHECK(!m_queuedEvents.isEmpty());
129 129
130 // Insert a marker for where we should stop. 130 // Insert a marker for where we should stop.
131 ASSERT(!m_queuedEvents.contains(nullptr)); 131 DCHECK(!m_queuedEvents.contains(nullptr));
132 bool wasAdded = m_queuedEvents.add(nullptr).isNewEntry; 132 bool wasAdded = m_queuedEvents.add(nullptr).isNewEntry;
133 ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list. 133 DCHECK(wasAdded); // It should not have already been in the list.
134 134
135 while (!m_queuedEvents.isEmpty()) { 135 while (!m_queuedEvents.isEmpty()) {
136 HeapListHashSet<Member<Event>, 16>::iterator iter = m_queuedEvents.begin (); 136 HeapListHashSet<Member<Event>, 16>::iterator iter = m_queuedEvents.begin ();
137 Event* event = *iter; 137 Event* event = *iter;
138 m_queuedEvents.remove(iter); 138 m_queuedEvents.remove(iter);
139 if (!event) 139 if (!event)
140 break; 140 break;
141 dispatchEvent(event); 141 dispatchEvent(event);
142 } 142 }
143 } 143 }
144 144
145 void DOMWindowEventQueue::dispatchEvent(Event* event) 145 void DOMWindowEventQueue::dispatchEvent(Event* event)
146 { 146 {
147 EventTarget* eventTarget = event->target(); 147 EventTarget* eventTarget = event->target();
148 InspectorInstrumentation::AsyncTask asyncTask(eventTarget->getExecutionConte xt(), event); 148 InspectorInstrumentation::AsyncTask asyncTask(eventTarget->getExecutionConte xt(), event);
149 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow()) 149 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow())
150 window->dispatchEvent(event, nullptr); 150 window->dispatchEvent(event, nullptr);
151 else 151 else
152 eventTarget->dispatchEvent(event); 152 eventTarget->dispatchEvent(event);
153 } 153 }
154 154
155 } // namespace blink 155 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698