nsrefcnt nsXPCWrappedJS::AddRef(void) { nsrefcnt cnt = NS_AtomicIncrementRefcnt(mRefCnt); NS_LOG_ADDREF(this, cnt, "nsXPCWrappedJS", sizeof(*this)); if (2 == cnt && IsValid()) { XPCJSRuntime* rt = mClass->GetRuntime(); rt->AddWrappedJSRoot(this); } return cnt; }
nsrefcnt nsXPCWrappedJS::AddRef(void) { if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread())) MOZ_CRASH(); nsrefcnt cnt = ++mRefCnt; NS_LOG_ADDREF(this, cnt, "nsXPCWrappedJS", sizeof(*this)); if (2 == cnt && IsValid()) { XPCJSRuntime* rt = mClass->GetRuntime(); rt->AddWrappedJSRoot(this); } return cnt; }