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

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

Issue 2727633006: DevTools: Rename InspectorInstrumentation:: namespace into probe:: (Closed)
Patch Set: Created 3 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
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 if (m_isClosed) 85 if (m_isClosed)
86 return false; 86 return false;
87 87
88 DCHECK(event->target()); 88 DCHECK(event->target());
89 InspectorInstrumentation::asyncTaskScheduled( 89 probe::asyncTaskScheduled(event->target()->getExecutionContext(),
90 event->target()->getExecutionContext(), event->type(), event); 90 event->type(), event);
91 91
92 bool wasAdded = m_queuedEvents.insert(event).isNewEntry; 92 bool wasAdded = m_queuedEvents.insert(event).isNewEntry;
93 DCHECK(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 HeapListHashSet<Member<Event>, 16>::iterator it = m_queuedEvents.find(event); 102 HeapListHashSet<Member<Event>, 16>::iterator it = m_queuedEvents.find(event);
103 bool found = it != m_queuedEvents.end(); 103 bool found = it != m_queuedEvents.end();
104 if (found) { 104 if (found) {
105 InspectorInstrumentation::asyncTaskCanceled( 105 probe::asyncTaskCanceled(event->target()->getExecutionContext(), event);
106 event->target()->getExecutionContext(), event);
107 m_queuedEvents.remove(it); 106 m_queuedEvents.remove(it);
108 } 107 }
109 if (m_queuedEvents.isEmpty()) 108 if (m_queuedEvents.isEmpty())
110 m_pendingEventTimer->stop(); 109 m_pendingEventTimer->stop();
111 return found; 110 return found;
112 } 111 }
113 112
114 void DOMWindowEventQueue::close() { 113 void DOMWindowEventQueue::close() {
115 m_isClosed = true; 114 m_isClosed = true;
116 m_pendingEventTimer->stop(); 115 m_pendingEventTimer->stop();
117 for (const auto& queuedEvent : m_queuedEvents) { 116 for (const auto& queuedEvent : m_queuedEvents) {
118 if (queuedEvent) 117 if (queuedEvent) {
119 InspectorInstrumentation::asyncTaskCanceled( 118 probe::asyncTaskCanceled(queuedEvent->target()->getExecutionContext(),
120 queuedEvent->target()->getExecutionContext(), queuedEvent); 119 queuedEvent);
120 }
121 } 121 }
122 m_queuedEvents.clear(); 122 m_queuedEvents.clear();
123 } 123 }
124 124
125 void DOMWindowEventQueue::pendingEventTimerFired() { 125 void DOMWindowEventQueue::pendingEventTimerFired() {
126 DCHECK(!m_pendingEventTimer->isActive()); 126 DCHECK(!m_pendingEventTimer->isActive());
127 DCHECK(!m_queuedEvents.isEmpty()); 127 DCHECK(!m_queuedEvents.isEmpty());
128 128
129 // Insert a marker for where we should stop. 129 // Insert a marker for where we should stop.
130 DCHECK(!m_queuedEvents.contains(nullptr)); 130 DCHECK(!m_queuedEvents.contains(nullptr));
131 bool wasAdded = m_queuedEvents.insert(nullptr).isNewEntry; 131 bool wasAdded = m_queuedEvents.insert(nullptr).isNewEntry;
132 DCHECK(wasAdded); // It should not have already been in the list. 132 DCHECK(wasAdded); // It should not have already been in the list.
133 133
134 while (!m_queuedEvents.isEmpty()) { 134 while (!m_queuedEvents.isEmpty()) {
135 HeapListHashSet<Member<Event>, 16>::iterator iter = m_queuedEvents.begin(); 135 HeapListHashSet<Member<Event>, 16>::iterator iter = m_queuedEvents.begin();
136 Event* event = *iter; 136 Event* event = *iter;
137 m_queuedEvents.remove(iter); 137 m_queuedEvents.remove(iter);
138 if (!event) 138 if (!event)
139 break; 139 break;
140 dispatchEvent(event); 140 dispatchEvent(event);
141 } 141 }
142 } 142 }
143 143
144 void DOMWindowEventQueue::dispatchEvent(Event* event) { 144 void DOMWindowEventQueue::dispatchEvent(Event* event) {
145 EventTarget* eventTarget = event->target(); 145 EventTarget* eventTarget = event->target();
146 InspectorInstrumentation::AsyncTask asyncTask( 146 probe::AsyncTask asyncTask(eventTarget->getExecutionContext(), event);
147 eventTarget->getExecutionContext(), event);
148 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow()) 147 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow())
149 window->dispatchEvent(event, nullptr); 148 window->dispatchEvent(event, nullptr);
150 else 149 else
151 eventTarget->dispatchEvent(event); 150 eventTarget->dispatchEvent(event);
152 } 151 }
153 152
154 } // namespace blink 153 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/ElementShadowV0.cpp ('k') | third_party/WebKit/Source/core/events/EventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698