本文整理汇总了C++中EventTarget::GetListenerManager方法的典型用法代码示例。如果您正苦于以下问题:C++ EventTarget::GetListenerManager方法的具体用法?C++ EventTarget::GetListenerManager怎么用?C++ EventTarget::GetListenerManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventTarget
的用法示例。
在下文中一共展示了EventTarget::GetListenerManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
DocManager::RemoveListeners(nsIDocument* aDocument)
{
nsPIDOMWindow* window = aDocument->GetWindow();
if (!window)
return;
EventTarget* target = window->GetChromeEventHandler();
nsEventListenerManager* elm = target->GetListenerManager(true);
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("pagehide"),
dom::TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("DOMContentLoaded"),
dom::TrustedEventsAtCapture());
}
示例2: GetChildAt
static void
MarkMessageManagers()
{
nsCOMPtr<nsIMessageBroadcaster> strongGlobalMM =
do_GetService("@mozilla.org/globalmessagemanager;1");
if (!strongGlobalMM) {
return;
}
nsIMessageBroadcaster* globalMM = strongGlobalMM;
strongGlobalMM = nullptr;
globalMM->MarkForCC();
uint32_t childCount = 0;
globalMM->GetChildCount(&childCount);
for (uint32_t i = 0; i < childCount; ++i) {
nsCOMPtr<nsIMessageListenerManager> childMM;
globalMM->GetChildAt(i, getter_AddRefs(childMM));
if (!childMM) {
continue;
}
nsCOMPtr<nsIMessageBroadcaster> strongWindowMM = do_QueryInterface(childMM);
nsIMessageBroadcaster* windowMM = strongWindowMM;
childMM = nullptr;
strongWindowMM = nullptr;
windowMM->MarkForCC();
uint32_t tabChildCount = 0;
windowMM->GetChildCount(&tabChildCount);
for (uint32_t j = 0; j < tabChildCount; ++j) {
nsCOMPtr<nsIMessageListenerManager> childMM;
windowMM->GetChildAt(j, getter_AddRefs(childMM));
if (!childMM) {
continue;
}
nsCOMPtr<nsIMessageSender> strongTabMM = do_QueryInterface(childMM);
nsIMessageSender* tabMM = strongTabMM;
childMM = nullptr;
strongTabMM = nullptr;
tabMM->MarkForCC();
//XXX hack warning, but works, since we know that
// callback is frameloader.
mozilla::dom::ipc::MessageManagerCallback* cb =
static_cast<nsFrameMessageManager*>(tabMM)->GetCallback();
if (cb) {
nsFrameLoader* fl = static_cast<nsFrameLoader*>(cb);
EventTarget* et = fl->GetTabChildGlobalAsEventTarget();
if (!et) {
continue;
}
static_cast<nsInProcessTabChildGlobal*>(et)->MarkForCC();
nsEventListenerManager* elm = et->GetListenerManager(false);
if (elm) {
elm->MarkForCC();
}
}
}
}
if (nsFrameMessageManager::sParentProcessManager) {
nsFrameMessageManager::sParentProcessManager->MarkForCC();
uint32_t childCount = 0;
nsFrameMessageManager::sParentProcessManager->GetChildCount(&childCount);
for (uint32_t i = 0; i < childCount; ++i) {
nsCOMPtr<nsIMessageListenerManager> childMM;
nsFrameMessageManager::sParentProcessManager->
GetChildAt(i, getter_AddRefs(childMM));
if (!childMM) {
continue;
}
nsIMessageListenerManager* child = childMM;
childMM = nullptr;
child->MarkForCC();
}
}
if (nsFrameMessageManager::sSameProcessParentManager) {
nsFrameMessageManager::sSameProcessParentManager->MarkForCC();
}
if (nsFrameMessageManager::sChildProcessManager) {
nsFrameMessageManager::sChildProcessManager->MarkForCC();
}
}