本文整理汇总了C++中XPCJSRuntime::TraceXPConnectRoots方法的典型用法代码示例。如果您正苦于以下问题:C++ XPCJSRuntime::TraceXPConnectRoots方法的具体用法?C++ XPCJSRuntime::TraceXPConnectRoots怎么用?C++ XPCJSRuntime::TraceXPConnectRoots使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XPCJSRuntime
的用法示例。
在下文中一共展示了XPCJSRuntime::TraceXPConnectRoots方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TraceJS
// static
void XPCJSRuntime::TraceJS(JSTracer* trc, void* data)
{
XPCJSRuntime* self = (XPCJSRuntime*)data;
// Skip this part if XPConnect is shutting down. We get into
// bad locking problems with the thread iteration otherwise.
if(!self->GetXPConnect()->IsShuttingDown())
{
PRLock* threadLock = XPCPerThreadData::GetLock();
if(threadLock)
{ // scoped lock
nsAutoLock lock(threadLock);
XPCPerThreadData* iterp = nsnull;
XPCPerThreadData* thread;
while(nsnull != (thread =
XPCPerThreadData::IterateThreads(&iterp)))
{
// Trace those AutoMarkingPtr lists!
thread->TraceJS(trc);
}
}
}
// XPCJSObjectHolders don't participate in cycle collection, so always trace
// them here.
for(XPCRootSetElem *e = self->mObjectHolderRoots; e ; e = e->GetNextRoot())
static_cast<XPCJSObjectHolder*>(e)->TraceJS(trc);
// Mark these roots as gray so the CC can walk them later.
js::GCMarker *gcmarker = NULL;
if (IS_GC_MARKING_TRACER(trc)) {
gcmarker = static_cast<js::GCMarker *>(trc);
JS_ASSERT(gcmarker->getMarkColor() == XPC_GC_COLOR_BLACK);
gcmarker->setMarkColor(XPC_GC_COLOR_GRAY);
}
self->TraceXPConnectRoots(trc);
if (gcmarker)
gcmarker->setMarkColor(XPC_GC_COLOR_BLACK);
}
示例2: TraceJS
// static
void XPCJSRuntime::TraceJS(JSTracer* trc, void* data)
{
XPCJSRuntime* self = (XPCJSRuntime*)data;
// Skip this part if XPConnect is shutting down. We get into
// bad locking problems with the thread iteration otherwise.
if(!self->GetXPConnect()->IsShuttingDown())
{
PRLock* threadLock = XPCPerThreadData::GetLock();
if(threadLock)
{ // scoped lock
nsAutoLock lock(threadLock);
XPCPerThreadData* iterp = nsnull;
XPCPerThreadData* thread;
while(nsnull != (thread =
XPCPerThreadData::IterateThreads(&iterp)))
{
// Trace those AutoMarkingPtr lists!
thread->TraceJS(trc);
}
}
}
// XPCJSObjectHolders don't participate in cycle collection, so always trace
// them here.
for(XPCRootSetElem *e = self->mObjectHolderRoots; e ; e = e->GetNextRoot())
static_cast<XPCJSObjectHolder*>(e)->TraceJS(trc);
if(self->GetXPConnect()->ShouldTraceRoots())
{
// Only trace these if we're not cycle-collecting, the cycle collector
// will do that if we are.
self->TraceXPConnectRoots(trc);
}
}