当前位置: 首页>>代码示例>>C++>>正文


C++ EventTarget::GetListenerManager方法代码示例

本文整理汇总了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());
}
开发者ID:BitVapor,项目名称:Pale-Moon,代码行数:15,代码来源:DocManager.cpp

示例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();
  }
}
开发者ID:EverythingMe,项目名称:mozilla-central,代码行数:79,代码来源:nsCCUncollectableMarker.cpp


注:本文中的EventTarget::GetListenerManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。