本文整理汇总了C++中EventTarget::getExecutionContext方法的典型用法代码示例。如果您正苦于以下问题:C++ EventTarget::getExecutionContext方法的具体用法?C++ EventTarget::getExecutionContext怎么用?C++ EventTarget::getExecutionContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventTarget
的用法示例。
在下文中一共展示了EventTarget::getExecutionContext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dispatchEvent
void DOMWindowEventQueue::dispatchEvent(Event* event) {
EventTarget* eventTarget = event->target();
InspectorInstrumentation::AsyncTask asyncTask(
eventTarget->getExecutionContext(), event);
if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow())
window->dispatchEvent(event, nullptr);
else
eventTarget->dispatchEvent(event);
}
示例2: cancelAllEvents
void GenericEventQueue::cancelAllEvents()
{
m_timer.stop();
for (const auto& pendingEvent : m_pendingEvents) {
Event* event = pendingEvent.get();
TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii(), "status", "cancelled");
EventTarget* target = event->target() ? event->target() : m_owner.get();
InspectorInstrumentation::asyncTaskCanceled(target->getExecutionContext(), event);
}
m_pendingEvents.clear();
}
示例3: cancelEvent
bool GenericEventQueue::cancelEvent(Event* event)
{
bool found = m_pendingEvents.contains(event);
if (found) {
EventTarget* target = event->target() ? event->target() : m_owner.get();
InspectorInstrumentation::asyncTaskCanceled(target->getExecutionContext(), event);
m_pendingEvents.remove(m_pendingEvents.find(event));
TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii(), "status", "cancelled");
}
if (m_pendingEvents.isEmpty())
m_timer.stop();
return found;
}
示例4: timerFired
void GenericEventQueue::timerFired(Timer<GenericEventQueue>*)
{
ASSERT(!m_timer.isActive());
ASSERT(!m_pendingEvents.isEmpty());
HeapVector<Member<Event>> pendingEvents;
m_pendingEvents.swap(pendingEvents);
for (const auto& pendingEvent : pendingEvents) {
Event* event = pendingEvent.get();
EventTarget* target = event->target() ? event->target() : m_owner.get();
CString type(event->type().ascii());
InspectorInstrumentation::AsyncTask asyncTask(target->getExecutionContext(), event);
TRACE_EVENT_ASYNC_STEP_INTO1("event", "GenericEventQueue:enqueueEvent", event, "dispatch", "type", type);
target->dispatchEvent(pendingEvent);
TRACE_EVENT_ASYNC_END1("event", "GenericEventQueue:enqueueEvent", event, "type", type);
}
}
示例5: enqueueEvent
bool GenericEventQueue::enqueueEvent(Event* event)
{
if (m_isClosed)
return false;
if (event->target() == m_owner)
event->setTarget(nullptr);
TRACE_EVENT_ASYNC_BEGIN1("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii());
EventTarget* target = event->target() ? event->target() : m_owner.get();
InspectorInstrumentation::asyncTaskScheduled(target->getExecutionContext(), event->type(), event);
m_pendingEvents.append(event);
if (!m_timer.isActive())
m_timer.startOneShot(0, BLINK_FROM_HERE);
return true;
}