本文整理汇总了C++中nsCycleCollectionTraversalCallback类的典型用法代码示例。如果您正苦于以下问题:C++ nsCycleCollectionTraversalCallback类的具体用法?C++ nsCycleCollectionTraversalCallback怎么用?C++ nsCycleCollectionTraversalCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了nsCycleCollectionTraversalCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImplCycleCollectionTraverse
inline void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
mozilla::WebGLFramebuffer::Attachment& aField,
const char* aName,
uint32_t aFlags = 0)
{
CycleCollectionNoteEdgeName(aCallback, aName, aFlags);
aCallback.NoteXPCOMChild(aField.mTexturePtr);
aCallback.NoteXPCOMChild(aField.mRenderbufferPtr);
}
示例2: ImplCycleCollectionTraverse
void
nsXBLPrototypeBinding::Traverse(nsCycleCollectionTraversalCallback &cb) const
{
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "proto mBinding");
cb.NoteXPCOMChild(mBinding);
if (mResources) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "proto mResources mLoader");
cb.NoteXPCOMChild(mResources->mLoader);
}
ImplCycleCollectionTraverse(cb, mInterfaceTable, "proto mInterfaceTable");
}
示例3:
void
nsSelectionState::DoTraverse(nsCycleCollectionTraversalCallback &cb)
{
for (uint32_t i = 0, iEnd = mArray.Length(); i < iEnd; ++i)
{
nsRangeStore* item = mArray[i];
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb,
"selection state mArray[i].startNode");
cb.NoteXPCOMChild(item->startNode);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb,
"selection state mArray[i].endNode");
cb.NoteXPCOMChild(item->endNode);
}
}
示例4: CycleCollectionNoteChild
void
EffectSet::Traverse(nsCycleCollectionTraversalCallback& aCallback)
{
for (auto iter = mEffects.Iter(); !iter.Done(); iter.Next()) {
CycleCollectionNoteChild(aCallback, iter.Get()->GetKey(),
"EffectSet::mEffects[]", aCallback.Flags());
}
}
示例5: SuspectDOMExpandos
static void
SuspectDOMExpandos(JSObject *obj, nsCycleCollectionTraversalCallback &cb)
{
const dom::DOMClass* clasp = dom::GetDOMClass(obj);
MOZ_ASSERT(clasp && clasp->mDOMObjectIsISupports);
nsISupports* native = dom::UnwrapDOMObject<nsISupports>(obj);
cb.NoteXPCOMRoot(native);
}
示例6: CycleCollectionNoteChild
void
nsXBLPrototypeResources::Traverse(nsCycleCollectionTraversalCallback &cb)
{
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "proto mResources mLoader");
cb.NoteXPCOMChild(mLoader);
CycleCollectionNoteChild(cb, mRuleProcessor.get(), "mRuleProcessor");
ImplCycleCollectionTraverse(cb, mStyleSheetList, "mStyleSheetList");
}
示例7: TraverseElements
static void
TraverseElements(nsCycleCollectionTraversalCallback& cb,
const nsTArray<T>& array,
const char* name)
{
for (uint32_t i = 0, length = array.Length(); i < length; ++i) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, name);
AudioNode* node = array[i].get();
cb.NoteXPCOMChild(node);
}
}
示例8: TraverseImpl
static NS_METHOD TraverseImpl(JSContextParticipant *that, void *n,
nsCycleCollectionTraversalCallback &cb)
{
JSContext *cx = static_cast<JSContext*>(n);
// JSContexts do not have an internal refcount and always have a single
// owner (e.g., nsJSContext). Thus, the default refcount is 1. However,
// in the (abnormal) case of synchronous cycle-collection, the context
// may be actively executing code in which case we want to treat it as
// rooted by adding an extra refcount.
unsigned refCount = js::ContextHasOutstandingRequests(cx) ? 2 : 1;
cb.DescribeRefCountedNode(refCount, "JSContext");
if (JSObject *global = js::GetDefaultGlobalForContext(cx)) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "[global object]");
cb.NoteJSChild(global);
}
return NS_OK;
}
示例9: CycleCollectionNoteEdgeNameImpl
void
CycleCollectionNoteEdgeNameImpl(nsCycleCollectionTraversalCallback& aCallback,
const char* aName,
uint32_t aFlags)
{
nsAutoCString arrayEdgeName(aName);
if (aFlags & CycleCollectionEdgeNameArrayFlag) {
arrayEdgeName.AppendLiteral("[i]");
}
aCallback.NoteNextEdgeName(arrayEdgeName.get());
}
示例10:
void
nsTransactionStack::DoTraverse(nsCycleCollectionTraversalCallback &cb)
{
for (PRInt32 i = 0, qcount = mQue.GetSize(); i < qcount; ++i) {
nsTransactionItem *item =
static_cast<nsTransactionItem*>(mQue.ObjectAt(i));
if (item) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "transaction stack mQue[i]");
cb.NoteNativeChild(item, &NS_CYCLE_COLLECTION_NAME(nsTransactionItem));
}
}
}
示例11: GetSize
void
nsTransactionStack::DoTraverse(nsCycleCollectionTraversalCallback &cb)
{
int32_t size = GetSize();
for (int32_t i = 0; i < size; ++i) {
nsTransactionItem* item = static_cast<nsTransactionItem*>(nsDeque::ObjectAt(i));
if (item) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "transaction stack mDeque[i]");
cb.NoteNativeChild(item, NS_CYCLE_COLLECTION_PARTICIPANT(nsTransactionItem));
}
}
}
示例12: AddXPConnectRoots
void XPCJSRuntime::AddXPConnectRoots(JSContext* cx,
nsCycleCollectionTraversalCallback &cb)
{
// For all JS objects that are held by native objects but aren't held
// through rooting or locking, we need to add all the native objects that
// hold them so that the JS objects are colored correctly in the cycle
// collector. This includes JSContexts that don't have outstanding requests,
// because their global object wasn't marked by the JS GC. All other JS
// roots were marked by the JS GC and will be colored correctly in the cycle
// collector.
JSContext *iter = nsnull, *acx;
while((acx = JS_ContextIterator(GetJSRuntime(), &iter)))
{
#ifndef DEBUG_CC
// Only skip JSContexts with outstanding requests if DEBUG_CC is not
// defined, else we do want to know about all JSContexts to get better
// graphs and explanations.
if(nsXPConnect::GetXPConnect()->GetRequestDepth(acx) != 0)
continue;
#endif
cb.NoteRoot(nsIProgrammingLanguage::CPLUSPLUS, acx,
nsXPConnect::JSContextParticipant());
}
XPCWrappedNativeScope::SuspectAllWrappers(this, cx, cb);
for(XPCRootSetElem *e = mVariantRoots; e ; e = e->GetNextRoot())
cb.NoteXPCOMRoot(static_cast<XPCTraceableVariant*>(e));
for(XPCRootSetElem *e = mWrappedJSRoots; e ; e = e->GetNextRoot())
{
nsIXPConnectWrappedJS *wrappedJS = static_cast<nsXPCWrappedJS*>(e);
cb.NoteXPCOMRoot(wrappedJS);
}
if(mJSHolders.ops)
JS_DHashTableEnumerate(&mJSHolders, NoteJSHolder, &cb);
}
示例13:
void
nsHostObjectProtocolHandler::Traverse(const nsACString& aUri,
nsCycleCollectionTraversalCallback& aCallback)
{
if (!gDataTable) {
return;
}
DataInfo* res;
gDataTable->Get(aUri, &res);
if (!res) {
return;
}
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCallback, "HostObjectProtocolHandler DataInfo.mBlobImpl");
aCallback.NoteXPCOMChild(res->mBlobImpl);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCallback, "HostObjectProtocolHandler DataInfo.mMediaSource");
aCallback.NoteXPCOMChild(res->mMediaSource);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCallback, "HostObjectProtocolHandler DataInfo.mMediaStream");
aCallback.NoteXPCOMChild(res->mMediaStream);
}
示例14:
void
CustomElementData::Traverse(nsCycleCollectionTraversalCallback& aCb) const
{
for (uint32_t i = 0; i < mReactionQueue.Length(); i++) {
if (mReactionQueue[i]) {
mReactionQueue[i]->Traverse(aCb);
}
}
if (mCustomElementDefinition) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mCustomElementDefinition");
aCb.NoteNativeChild(mCustomElementDefinition,
NS_CYCLE_COLLECTION_PARTICIPANT(CustomElementDefinition));
}
}
示例15: NS_CYCLE_COLLECTION_CLASSNAME
NS_CYCLE_COLLECTION_CLASSNAME(nsXPCWrappedJS)::Traverse
(void *p, nsCycleCollectionTraversalCallback &cb)
{
nsISupports *s = static_cast<nsISupports*>(p);
NS_ASSERTION(CheckForRightISupports(s),
"not the nsISupports pointer we expect");
nsXPCWrappedJS *tmp = Downcast(s);
nsrefcnt refcnt = tmp->mRefCnt.get();
if (cb.WantDebugInfo()) {
char name[72];
if (tmp->GetClass())
JS_snprintf(name, sizeof(name), "nsXPCWrappedJS (%s)",
tmp->GetClass()->GetInterfaceName());
else
JS_snprintf(name, sizeof(name), "nsXPCWrappedJS");
cb.DescribeNode(RefCounted, refcnt, sizeof(nsXPCWrappedJS), name);
} else {
cb.DescribeNode(RefCounted, refcnt, sizeof(nsXPCWrappedJS),
"nsXPCWrappedJS");
}
// nsXPCWrappedJS keeps its own refcount artificially at or above 1, see the
// comment above nsXPCWrappedJS::AddRef.
cb.NoteXPCOMChild(s);
if(refcnt > 1)
// nsXPCWrappedJS roots its mJSObj when its refcount is > 1, see
// the comment above nsXPCWrappedJS::AddRef.
cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT,
tmp->GetJSObject());
nsXPCWrappedJS* root = tmp->GetRootWrapper();
if(root == tmp)
// The root wrapper keeps the aggregated native object alive.
cb.NoteXPCOMChild(tmp->GetAggregatedNativeObject());
else
// Non-root wrappers keep their root alive.
cb.NoteXPCOMChild(static_cast<nsIXPConnectWrappedJS*>(root));
return NS_OK;
}