void BrowsingContext::CacheChildren(bool aFromIPC) { if (mChildren.IsEmpty()) { return; } MOZ_LOG(GetLog(), LogLevel::Debug, ("%s: Caching children of 0x%08" PRIx64 "", XRE_IsParentProcess() ? "Parent" : "Child", Id())); MOZ_ALWAYS_TRUE(sCachedBrowsingContexts->reserve(mChildren.Length())); for (BrowsingContext* child : mChildren) { MOZ_ALWAYS_TRUE(sCachedBrowsingContexts->putNew(child->Id(), child)); } mChildren.Clear(); if (!aFromIPC && XRE_IsContentProcess()) { auto cc = ContentChild::GetSingleton(); MOZ_DIAGNOSTIC_ASSERT(cc); cc->SendDetachBrowsingContext(this, true /* aMoveToBFCache */); } }
static void Register(BrowsingContext* aBrowsingContext) { MOZ_ALWAYS_TRUE( sBrowsingContexts->putNew(aBrowsingContext->Id(), aBrowsingContext)); aBrowsingContext->Group()->Register(aBrowsingContext); }