本文整理汇总了C++中EventListenerManager::MarkForCC方法的典型用法代码示例。如果您正苦于以下问题:C++ EventListenerManager::MarkForCC方法的具体用法?C++ EventListenerManager::MarkForCC怎么用?C++ EventListenerManager::MarkForCC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventListenerManager
的用法示例。
在下文中一共展示了EventListenerManager::MarkForCC方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS,
bool aPrepareForCC)
{
if (!aViewer) {
return;
}
nsIDocument *doc = aViewer->GetDocument();
if (doc &&
doc->GetMarkedCCGeneration() != nsCCUncollectableMarker::sGeneration) {
doc->MarkUncollectableForCCGeneration(nsCCUncollectableMarker::sGeneration);
if (aCleanupJS) {
EventListenerManager* elm = doc->GetExistingListenerManager();
if (elm) {
elm->MarkForCC();
}
nsCOMPtr<EventTarget> win = do_QueryInterface(doc->GetInnerWindow());
if (win) {
elm = win->GetExistingListenerManager();
if (elm) {
elm->MarkForCC();
}
static_cast<nsGlobalWindow*>(win.get())->UnmarkGrayTimers();
}
} else if (aPrepareForCC) {
// Unfortunately we need to still mark user data just before running CC so
// that it has the right generation.
doc->PropertyTable(DOM_USER_DATA)->
EnumerateAll(MarkUserData, &nsCCUncollectableMarker::sGeneration);
}
}
if (doc) {
nsPIDOMWindow* inner = doc->GetInnerWindow();
if (inner) {
inner->MarkUncollectableForCCGeneration(nsCCUncollectableMarker::sGeneration);
}
nsPIDOMWindow* outer = doc->GetWindow();
if (outer) {
outer->MarkUncollectableForCCGeneration(nsCCUncollectableMarker::sGeneration);
}
}
}
示例2: MarkContentViewer
void MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS) {
if (!aViewer) {
return;
}
Document* doc = aViewer->GetDocument();
if (doc &&
doc->GetMarkedCCGeneration() != nsCCUncollectableMarker::sGeneration) {
doc->MarkUncollectableForCCGeneration(nsCCUncollectableMarker::sGeneration);
if (aCleanupJS) {
EventListenerManager* elm = doc->GetExistingListenerManager();
if (elm) {
elm->MarkForCC();
}
nsCOMPtr<EventTarget> win = do_QueryInterface(doc->GetInnerWindow());
if (win) {
elm = win->GetExistingListenerManager();
if (elm) {
elm->MarkForCC();
}
static_cast<nsGlobalWindowInner*>(win.get())
->AsInner()
->TimeoutManager()
.UnmarkGrayTimers();
}
}
}
if (doc) {
if (nsPIDOMWindowInner* inner = doc->GetInnerWindow()) {
inner->MarkUncollectableForCCGeneration(
nsCCUncollectableMarker::sGeneration);
}
if (nsPIDOMWindowOuter* outer = doc->GetWindow()) {
outer->MarkUncollectableForCCGeneration(
nsCCUncollectableMarker::sGeneration);
}
}
}
示例3: 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();
}
}
}
}
示例4: 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();
}
}
}
}