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


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

本文整理汇总了C++中EventTarget::GetExistingListenerManager方法的典型用法代码示例。如果您正苦于以下问题:C++ EventTarget::GetExistingListenerManager方法的具体用法?C++ EventTarget::GetExistingListenerManager怎么用?C++ EventTarget::GetExistingListenerManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventTarget的用法示例。


在下文中一共展示了EventTarget::GetExistingListenerManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MarkChildMessageManagers

static void
MarkChildMessageManagers(nsIMessageBroadcaster* aMM)
{
  aMM->MarkForCC();

  uint32_t tabChildCount = 0;
  aMM->GetChildCount(&tabChildCount);
  for (uint32_t j = 0; j < tabChildCount; ++j) {
    nsCOMPtr<nsIMessageListenerManager> childMM;
    aMM->GetChildAt(j, getter_AddRefs(childMM));
    if (!childMM) {
      continue;
    }

    nsCOMPtr<nsIMessageBroadcaster> strongNonLeafMM = do_QueryInterface(childMM);
    nsIMessageBroadcaster* nonLeafMM = strongNonLeafMM;

    nsCOMPtr<nsIMessageSender> strongTabMM = do_QueryInterface(childMM);
    nsIMessageSender* tabMM = strongTabMM;

    strongNonLeafMM = nullptr;
    strongTabMM = nullptr;
    childMM = nullptr;

    if (nonLeafMM) {
      MarkChildMessageManagers(nonLeafMM);
      continue;
    }

    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();
      EventListenerManager* elm = et->GetExistingListenerManager();
      if (elm) {
        elm->MarkForCC();
      }
    }
  }
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:49,代码来源:nsCCUncollectableMarker.cpp

示例2: MarkChildMessageManagers

static void
MarkChildMessageManagers(ChromeMessageBroadcaster* aMM)
{
  aMM->MarkForCC();

  uint32_t tabChildCount = aMM->ChildCount();
  for (uint32_t j = 0; j < tabChildCount; ++j) {
    RefPtr<MessageListenerManager> childMM = aMM->GetChildAt(j);
    if (!childMM) {
      continue;
    }

    RefPtr<ChromeMessageBroadcaster> strongNonLeafMM =
      ChromeMessageBroadcaster::From(childMM);
    ChromeMessageBroadcaster* nonLeafMM = strongNonLeafMM;

    MessageListenerManager* tabMM = childMM;

    strongNonLeafMM = nullptr;
    childMM = nullptr;

    if (nonLeafMM) {
      MarkChildMessageManagers(nonLeafMM);
      continue;
    }

    tabMM->MarkForCC();

    //XXX hack warning, but works, since we know that
    //    callback is frameloader.
    mozilla::dom::ipc::MessageManagerCallback* cb = tabMM->GetCallback();
    if (cb) {
      nsFrameLoader* fl = static_cast<nsFrameLoader*>(cb);
      EventTarget* et = fl->GetTabChildGlobalAsEventTarget();
      if (!et) {
        continue;
      }
      static_cast<nsInProcessTabChildGlobal*>(et)->MarkForCC();
      EventListenerManager* elm = et->GetExistingListenerManager();
      if (elm) {
        elm->MarkForCC();
      }
    }
  }
}
开发者ID:heiher,项目名称:gecko-dev,代码行数:45,代码来源:nsCCUncollectableMarker.cpp

示例3: GetChildAt

static void
MarkMessageManagers()
{
  // The global message manager only exists in the root process.
  if (XRE_GetProcessType() != GeckoProcessType_Default) {
    return;
  }
  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->GetExistingListenerManager();
        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:MrKeiKun,项目名称:mozilla-central,代码行数:83,代码来源:nsCCUncollectableMarker.cpp


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