diff --git a/xpcom/glue/BlockingResourceBase.cpp b/xpcom/glue/BlockingResourceBase.cpp index 0a5c81dd9680..15012381d094 100644 --- a/xpcom/glue/BlockingResourceBase.cpp +++ b/xpcom/glue/BlockingResourceBase.cpp @@ -39,7 +39,7 @@ BlockingResourceBase::DDT* BlockingResourceBase::sDeadlockDetector; bool BlockingResourceBase::DeadlockDetectorEntry::Print( - const DDT::ResourceAcquisition& aFirstSeen, + const DeadlockDetectorEntry* aFirstSeen, nsACString& aOut) const { fprintf(stderr, "--- %s : %s", @@ -193,22 +193,22 @@ BlockingResourceBase::PrintCycle(const DDT::ResourceAcquisitionArray* aCycle, fputs("=== Cyclical dependency starts at\n", stderr); aOut += "Cyclical dependency starts at\n"; - const DDT::ResourceAcquisition res = aCycle->ElementAt(0); - maybeImminent &= res.mResource->Print(res, aOut); + const DeadlockDetectorEntry* res = aCycle->ElementAt(0); + maybeImminent &= res->Print(res, aOut); DDT::ResourceAcquisitionArray::index_type i; DDT::ResourceAcquisitionArray::size_type len = aCycle->Length(); - const DDT::ResourceAcquisition* it = 1 + aCycle->Elements(); + const DDT::ResourceAcquisitionArray::elem_type* it = 1 + aCycle->Elements(); for (i = 1; i < len - 1; ++i, ++it) { fputs("\n--- Next dependency:\n", stderr); aOut += "\nNext dependency:\n"; - maybeImminent &= it->mResource->Print(*it, aOut); + maybeImminent &= (*it)->Print(*it, aOut); } fputs("\n=== Cycle completed at\n", stderr); aOut += "Cycle completed at\n"; - it->mResource->Print(*it, aOut); + (*it)->Print(*it, aOut); return maybeImminent; } diff --git a/xpcom/glue/BlockingResourceBase.h b/xpcom/glue/BlockingResourceBase.h index 4217f5f984bf..e5c08e0acaa5 100644 --- a/xpcom/glue/BlockingResourceBase.h +++ b/xpcom/glue/BlockingResourceBase.h @@ -113,7 +113,7 @@ private: * contexts into strings, all info is written to stderr, but * only some info is written into |aOut| */ - bool Print(const DDT::ResourceAcquisition& aFirstSeen, + bool Print(const DeadlockDetectorEntry* aFirstSeen, nsACString& aOut) const; /** diff --git a/xpcom/glue/DeadlockDetector.h b/xpcom/glue/DeadlockDetector.h index 355f535eff4d..1bbd8e6d91ab 100644 --- a/xpcom/glue/DeadlockDetector.h +++ b/xpcom/glue/DeadlockDetector.h @@ -65,32 +65,7 @@ template class DeadlockDetector { public: - /** - * ResourceAcquisition - * Consists simply of a resource and the calling context from - * which it was acquired. We pack this information together so - * that it can be returned back to the caller when a potential - * deadlock has been found. - */ - struct ResourceAcquisition - { - const T* mResource; - - explicit ResourceAcquisition(const T* aResource) - : mResource(aResource) - { - } - ResourceAcquisition(const ResourceAcquisition& aFrom) - : mResource(aFrom.mResource) - { - } - ResourceAcquisition& operator=(const ResourceAcquisition& aFrom) - { - mResource = aFrom.mResource; - return *this; - } - }; - typedef nsTArray ResourceAcquisitionArray; + typedef nsTArray ResourceAcquisitionArray; private: struct OrderingEntry; @@ -278,8 +253,8 @@ public: if (!cycle) { NS_RUNTIMEABORT("can't allocate dep. cycle array"); } - cycle->AppendElement(ResourceAcquisition(current->mResource)); - cycle->AppendElement(ResourceAcquisition(aProposed)); + cycle->AppendElement(current->mResource); + cycle->AppendElement(aProposed); return cycle; } if (InTransitiveClosure(current, proposed)) { @@ -294,7 +269,7 @@ public: // right conditions. ResourceAcquisitionArray* cycle = GetDeductionChain(proposed, current); // show how acquiring |aProposed| would complete the cycle - cycle->AppendElement(ResourceAcquisition(aProposed)); + cycle->AppendElement(aProposed); return cycle; } // |aLast|, |aProposed| are unordered according to our @@ -354,7 +329,7 @@ public: if (!chain) { NS_RUNTIMEABORT("can't allocate dep. cycle array"); } - chain->AppendElement(ResourceAcquisition(aStart->mResource)); + chain->AppendElement(aStart->mResource); NS_ASSERTION(GetDeductionChain_Helper(aStart, aTarget, chain), "GetDeductionChain called when there's no deadlock"); @@ -368,14 +343,14 @@ public: ResourceAcquisitionArray* aChain) { if (aStart->mOrderedLT.BinaryIndexOf(aTarget) != NoIndex) { - aChain->AppendElement(ResourceAcquisition(aTarget->mResource)); + aChain->AppendElement(aTarget->mResource); return true; } index_type i = 0; size_type len = aStart->mOrderedLT.Length(); for (const OrderingEntry* const* it = aStart->mOrderedLT.Elements(); i < len; ++i, ++it) { - aChain->AppendElement(ResourceAcquisition((*it)->mResource)); + aChain->AppendElement((*it)->mResource); if (GetDeductionChain_Helper(*it, aTarget, aChain)) { return true; }