nsSystemPrincipal::AddRef() { NS_PRECONDITION(PRInt32(refcount) >= 0, "illegal refcnt"); nsrefcnt count = PR_ATOMIC_INCREMENT(&refcount); NS_LOG_ADDREF(this, count, "nsSystemPrincipal", sizeof(*this)); return count; }
nsSystemPrincipal::AddRef() { NS_PRECONDITION(int32_t(refcount) >= 0, "illegal refcnt"); nsrefcnt count = ++refcount; NS_LOG_ADDREF(this, count, "nsSystemPrincipal", sizeof(*this)); return count; }
nsrefcnt xptiInterfaceInfo::AddRef(void) { nsrefcnt cnt = NS_AtomicIncrementRefcnt(mRefCnt); NS_LOG_ADDREF(this, cnt, "xptiInterfaceInfo", sizeof(*this)); return cnt; }
nsStringBuffer* nsStringBuffer::Realloc(nsStringBuffer* hdr, size_t size) { STRING_STAT_INCREMENT(Realloc); NS_ASSERTION(size != 0, "zero capacity allocation not allowed"); NS_ASSERTION(sizeof(nsStringBuffer) + size <= size_t(uint32_t(-1)) && sizeof(nsStringBuffer) + size > size, "mStorageSize will truncate"); // no point in trying to save ourselves if we hit this assertion NS_ASSERTION(!hdr->IsReadonly(), "|Realloc| attempted on readonly string"); // Treat this as a release and addref for refcounting purposes, since we // just asserted that the refcount is 1. If we don't do that, refcount // logging will claim we've leaked all sorts of stuff. NS_LOG_RELEASE(hdr, 0, "nsStringBuffer"); hdr = (nsStringBuffer*) realloc(hdr, sizeof(nsStringBuffer) + size); if (hdr) { NS_LOG_ADDREF(hdr, 1, "nsStringBuffer", sizeof(*hdr)); hdr->mStorageSize = size; } return hdr; }
void nsStringBuffer::AddRef() { PR_ATOMIC_INCREMENT(&mRefCount); STRING_STAT_INCREMENT(Share); NS_LOG_ADDREF(this, mRefCount, "nsStringBuffer", sizeof(*this)); }
nsSystemPrincipal::AddRef() { NS_PRECONDITION(PRInt32(mJSPrincipals.refcount) >= 0, "illegal refcnt"); nsrefcnt count = PR_AtomicIncrement((PRInt32 *)&mJSPrincipals.refcount); NS_LOG_ADDREF(this, count, "nsSystemPrincipal", sizeof(*this)); return count; }
nsrefcnt nsTransactionItem::AddRef() { ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "nsTransactionItem", sizeof(nsTransactionItem)); return mRefCnt; }
NS_IMETHODIMP_(nsrefcnt) xpctestNoisy::AddRef(void) { NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "xpctestNoisy", sizeof(*this)); printf("Noisy %d - incremented refcount to %d\n", mID, mRefCnt.get()); return mRefCnt; }
//NS_IMPL_ISUPPORTS(npAPInsIInputStreamShim, NS_GET_IID(nsIInputStream)) NS_IMETHODIMP_(nsrefcnt) npAPInsIInputStreamShim::AddRef(void) { NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); // Note that we intentionally don't check for owning thread safety. ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "npAPInsIInputStreamShim", sizeof(*this)); return mRefCnt; }
nsrefcnt nsHtml5OwningUTF16Buffer::AddRef() { NS_PRECONDITION(int32_t(mRefCnt) >= 0, "Illegal refcount."); ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "nsHtml5OwningUTF16Buffer", sizeof(*this)); return mRefCnt; }
NS_IMETHODIMP_(MozExternalRefCountType) SharedThreadPool::AddRef(void) { MOZ_ASSERT(sMonitor); ReentrantMonitorAutoEnter mon(*sMonitor); MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt"); nsrefcnt count = ++mRefCnt; NS_LOG_ADDREF(this, count, "SharedThreadPool", sizeof(*this)); return count; }
STDMETHODIMP_(ULONG) CEnumFormatEtc::AddRef(void) { ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "CEnumFormatEtc",sizeof(*this)); #ifdef DEBUG //printf("CEnumFormatEtc::AddRef >>>>>>>>>>>>>>>>>> %d on %p\n", mRefCnt, this); #endif return mRefCnt; }
void nsLayoutStatics::AddRef() { NS_ASSERTION(sLayoutStaticRefcnt, "nsLayoutStatics already dropped to zero!"); ++sLayoutStaticRefcnt; NS_LOG_ADDREF(&sLayoutStaticRefcnt, sLayoutStaticRefcnt, "nsLayoutStatics", 1); }
nsrefcnt nsNodeInfoManager::AddRef() { NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); nsrefcnt count = PR_AtomicIncrement((PRInt32*)&mRefCnt); NS_LOG_ADDREF(this, count, "nsNodeInfoManager", sizeof(*this)); return count; }
nsrefcnt PyG_Base::AddRef(void) { nsrefcnt cnt = (nsrefcnt) PR_AtomicIncrement((PRInt32*)&mRefCnt); #ifdef NS_BUILD_REFCNT_LOGGING // If we have no pBaseObject, then we need to ignore them if (m_pBaseObject == NULL) NS_LOG_ADDREF(this, cnt, refcntLogRepr, sizeof(*this)); #endif return cnt; }
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; }
/** * Alloc returns a pointer to a new string header with set capacity. */ already_AddRefed<nsStringBuffer> nsStringBuffer::Alloc(size_t size) { NS_ASSERTION(size != 0, "zero capacity allocation not allowed"); NS_ASSERTION(sizeof(nsStringBuffer) + size <= size_t(uint32_t(-1)) && sizeof(nsStringBuffer) + size > size, "mStorageSize will truncate"); nsStringBuffer *hdr = (nsStringBuffer *) malloc(sizeof(nsStringBuffer) + size); if (hdr) { STRING_STAT_INCREMENT(Alloc); hdr->mRefCount = 1; hdr->mStorageSize = size; NS_LOG_ADDREF(hdr, 1, "nsStringBuffer", sizeof(*hdr)); } return dont_AddRef(hdr); }
nsJavaXPTCStub::AddRefInternal() { // If this is the first AddRef call, we create a strong global ref to the // Java object to keep it from being garbage collected. if (mRefCnt == 0) { JNIEnv* env = GetJNIEnv(); jobject referent = env->CallObjectMethod(mJavaWeakRef, getReferentMID); if (!env->IsSameObject(referent, NULL)) { mJavaStrongRef = env->NewGlobalRef(referent); } NS_ASSERTION(mJavaStrongRef != nsnull, "Failed to acquire strong ref"); } // if this is the master interface NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); NS_ASSERT_OWNINGTHREAD(nsJavaXPTCStub); ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "nsJavaXPTCStub", sizeof(*this)); return mRefCnt; }
CEnumFormatEtc::AddRef() { ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "CEnumFormatEtc",sizeof(*this)); return mRefCnt; }
nsresult nsLayoutStatics::Initialize() { NS_ASSERTION(sLayoutStaticRefcnt == 0, "nsLayoutStatics isn't zero!"); sLayoutStaticRefcnt = 1; NS_LOG_ADDREF(&sLayoutStaticRefcnt, sLayoutStaticRefcnt, "nsLayoutStatics", 1); nsresult rv; nsJSEnvironment::Startup(); rv = nsContentUtils::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsContentUtils"); Shutdown(); return rv; } rv = nsAttrValue::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsAttrValue"); Shutdown(); return rv; } // Register all of our atoms once nsCSSAnonBoxes::AddRefAtoms(); nsCSSPseudoClasses::AddRefAtoms(); nsCSSPseudoElements::AddRefAtoms(); nsCSSKeywords::AddRefTable(); nsCSSProps::AddRefTable(); nsColorNames::AddRefTable(); nsHTMLAtoms::AddRefAtoms(); nsXBLAtoms::AddRefAtoms(); nsLayoutAtoms::AddRefAtoms(); nsXULAtoms::AddRefAtoms(); #ifndef MOZ_NO_INSPECTOR_APIS inDOMView::InitAtoms(); #endif #ifdef MOZ_XUL rv = nsXULContentUtils::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsXULContentUtils"); Shutdown(); return rv; } #endif #ifdef MOZ_MATHML nsMathMLOperators::AddRefTable(); nsMathMLAtoms::AddRefAtoms(); #endif #ifdef MOZ_SVG if (nsSVGUtils::SVGEnabled()) nsContentDLF::RegisterSVG(); nsSVGAtoms::AddRefAtoms(); #ifdef MOZ_SVG_RENDERER_LIBART NS_InitSVGRendererLibartGlobals(); #endif #ifdef MOZ_SVG_RENDERER_GDIPLUS NS_InitSVGRendererGDIPlusGlobals(); #endif #endif #ifdef DEBUG nsFrame::DisplayReflowStartup(); #endif rv = nsTextTransformer::Initialize(); NS_ENSURE_SUCCESS(rv, rv); nsDOMAttribute::Initialize(); rv = nsDOMStorageManager::Initialize(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsDOMStorageManager"); return rv; } return NS_OK; }
void CachedFileHolder::AddRef() { ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "CachedFileHolder", sizeof(*this)); }
nsresult nsLayoutStatics::Initialize() { NS_ASSERTION(sLayoutStaticRefcnt == 0, "nsLayoutStatics isn't zero!"); sLayoutStaticRefcnt = 1; NS_LOG_ADDREF(&sLayoutStaticRefcnt, sLayoutStaticRefcnt, "nsLayoutStatics", 1); nsresult rv; // Register all of our atoms once nsCSSAnonBoxes::AddRefAtoms(); nsCSSPseudoClasses::AddRefAtoms(); nsCSSPseudoElements::AddRefAtoms(); nsCSSKeywords::AddRefTable(); nsCSSProps::AddRefTable(); nsColorNames::AddRefTable(); nsGkAtoms::AddRefAtoms(); nsDOMScriptObjectFactory::Startup(); rv = nsContentUtils::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsContentUtils"); return rv; } rv = nsAttrValue::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsAttrValue"); return rv; } rv = nsTextFragment::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsTextFragment"); return rv; } rv = nsCellMap::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsCellMap"); return rv; } rv = nsCSSRendering::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsCSSRendering"); return rv; } rv = nsTextFrameTextRunCache::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize textframe textrun cache"); return rv; } #ifdef MOZ_XUL rv = nsXULContentUtils::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsXULContentUtils"); return rv; } #ifndef MOZ_NO_INSPECTOR_APIS inDOMView::InitAtoms(); #endif #endif #ifdef MOZ_MATHML nsMathMLOperators::AddRefTable(); #endif #ifdef MOZ_SVG if (NS_SVGEnabled()) nsContentDLF::RegisterSVG(); #endif #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY nsEditProperty::RegisterAtoms(); nsTextServicesDocument::RegisterAtoms(); #endif #ifdef DEBUG nsFrame::DisplayReflowStartup(); #endif nsDOMAttribute::Initialize(); rv = txMozillaXSLTProcessor::Startup(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize txMozillaXSLTProcessor"); return rv; } rv = nsDOMStorageManager::Initialize(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsDOMStorageManager"); return rv; } #ifndef DEBUG_CC rv = nsCCUncollectableMarker::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsCCUncollectableMarker"); return rv; } #endif #ifdef MOZ_XUL rv = nsXULPopupManager::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsXULPopupManager"); return rv; } #endif return NS_OK; }
nsNativeDragTarget::AddRef(void) { ++m_cRef; NS_LOG_ADDREF(this, m_cRef, "nsNativeDragTarget", sizeof(*this)); return m_cRef; }
nsNativeDragSource::AddRef(void) { ++m_cRef; NS_LOG_ADDREF(this, m_cRef, "nsNativeDragSource", sizeof(*this)); return m_cRef; }
nsresult nsLayoutStatics::Initialize() { NS_ASSERTION(sLayoutStaticRefcnt == 0, "nsLayoutStatics isn't zero!"); sLayoutStaticRefcnt = 1; NS_LOG_ADDREF(&sLayoutStaticRefcnt, sLayoutStaticRefcnt, "nsLayoutStatics", 1); nsresult rv; // Register all of our atoms once nsCSSAnonBoxes::AddRefAtoms(); nsCSSPseudoClasses::AddRefAtoms(); nsCSSPseudoElements::AddRefAtoms(); nsCSSKeywords::AddRefTable(); nsCSSProps::AddRefTable(); nsColorNames::AddRefTable(); nsGkAtoms::AddRefAtoms(); nsJSRuntime::Startup(); rv = nsRegion::InitStatic(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsRegion"); return rv; } rv = nsContentUtils::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsContentUtils"); return rv; } rv = nsAttrValue::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsAttrValue"); return rv; } rv = nsTextFragment::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsTextFragment"); return rv; } rv = nsCellMap::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsCellMap"); return rv; } rv = nsCSSRendering::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsCSSRendering"); return rv; } rv = nsTextFrameTextRunCache::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize textframe textrun cache"); return rv; } rv = nsHTMLDNSPrefetch::Initialize(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize HTML DNS prefetch"); return rv; } #ifdef MOZ_XUL rv = nsXULContentUtils::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsXULContentUtils"); return rv; } inDOMView::InitAtoms(); #endif #ifdef MOZ_MATHML nsMathMLOperators::AddRefTable(); #endif #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY nsEditProperty::RegisterAtoms(); nsTextServicesDocument::RegisterAtoms(); #endif #ifdef DEBUG nsFrame::DisplayReflowStartup(); #endif nsDOMAttribute::Initialize(); rv = txMozillaXSLTProcessor::Startup(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize txMozillaXSLTProcessor"); return rv; } rv = nsDOMStorageManager::Initialize(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsDOMStorageManager"); return rv; } rv = nsCCUncollectableMarker::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsCCUncollectableMarker"); return rv; } rv = nsCSSRuleProcessor::Startup(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsCSSRuleProcessor"); return rv; } #ifdef MOZ_XUL rv = nsXULPopupManager::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsXULPopupManager"); return rv; } #endif rv = nsFocusManager::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsFocusManager"); return rv; } #ifdef MOZ_SYDNEYAUDIO nsAudioStream::InitLibrary(); #endif nsContentSink::InitializeStatics(); nsHtml5Module::InitializeStatics(); nsIPresShell::InitializeStatics(); nsCrossSiteListenerProxy::Startup(); rv = nsFrameList::Init(); if (NS_FAILED(rv)) { NS_ERROR("Could not initialize nsFrameList"); return rv; } NS_SealStaticAtomTable(); return NS_OK; }