From d7cc3b6681548cb06cea9e09f93d9f85d11ea578 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Tue, 6 Oct 2015 11:23:34 -0700 Subject: [PATCH] Bug 1194555 - Part 4: Rename GetReportsState PendingProcessesState. r=njn --- xpcom/base/nsMemoryReporterManager.cpp | 58 +++++++++++++------------- xpcom/base/nsMemoryReporterManager.h | 26 ++++++------ 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index 7614aea1fcc..243c12055e3 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -1356,7 +1356,7 @@ nsMemoryReporterManager::nsMemoryReporterManager() , mSavedStrongReporters(nullptr) , mSavedWeakReporters(nullptr) , mNextGeneration(1) - , mGetReportsState(nullptr) + , mPendingProcessesState(nullptr) { } @@ -1414,11 +1414,11 @@ nsMemoryReporterManager::GetReportsExtended( uint32_t generation = mNextGeneration++; - if (mGetReportsState) { + if (mPendingProcessesState) { // A request is in flight. Don't start another one. And don't report // an error; just ignore it, and let the in-flight request finish. MEMORY_REPORTING_LOG("GetReports (gen=%u, s->gen=%u): abort\n", - generation, mGetReportsState->mGeneration); + generation, mPendingProcessesState->mGeneration); return NS_OK; } @@ -1429,15 +1429,15 @@ nsMemoryReporterManager::GetReportsExtended( if (concurrency < 1) { concurrency = 1; } - mGetReportsState = new GetReportsState(generation, - aAnonymize, - aMinimize, - concurrency, - aHandleReport, - aHandleReportData, - aFinishReporting, - aFinishReportingData, - aDMDDumpIdent); + mPendingProcessesState = new PendingProcessesState(generation, + aAnonymize, + aMinimize, + concurrency, + aHandleReport, + aHandleReportData, + aFinishReporting, + aFinishReportingData, + aDMDDumpIdent); if (aMinimize) { rv = MinimizeMemoryUsage(NS_NewRunnableMethod( @@ -1451,7 +1451,7 @@ nsMemoryReporterManager::GetReportsExtended( nsresult nsMemoryReporterManager::StartGettingReports() { - GetReportsState* s = mGetReportsState; + PendingProcessesState* s = mPendingProcessesState; nsresult rv; // Get reports for this process. @@ -1552,13 +1552,13 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended( return NS_OK; } -nsMemoryReporterManager::GetReportsState* +nsMemoryReporterManager::PendingProcessesState* nsMemoryReporterManager::GetStateForGeneration(uint32_t aGeneration) { // Memory reporting only happens on the main thread. MOZ_RELEASE_ASSERT(NS_IsMainThread()); - GetReportsState* s = mGetReportsState; + PendingProcessesState* s = mPendingProcessesState; if (!s) { // If we reach here, then: @@ -1595,7 +1595,7 @@ nsMemoryReporterManager::HandleChildReport( uint32_t aGeneration, const dom::MemoryReport& aChildReport) { - GetReportsState* s = GetStateForGeneration(aGeneration); + PendingProcessesState* s = GetStateForGeneration(aGeneration); if (!s) { return; } @@ -1615,7 +1615,7 @@ nsMemoryReporterManager::HandleChildReport( /* static */ bool nsMemoryReporterManager::StartChildReport(mozilla::dom::ContentParent* aChild, - const GetReportsState* aState) + const PendingProcessesState* aState) { #ifdef MOZ_NUWA_PROCESS if (aChild->IsNuwaProcess()) { @@ -1653,7 +1653,7 @@ nsMemoryReporterManager::StartChildReport(mozilla::dom::ContentParent* aChild, void nsMemoryReporterManager::EndProcessReport(uint32_t aGeneration, bool aSuccess) { - GetReportsState* s = GetStateForGeneration(aGeneration); + PendingProcessesState* s = GetStateForGeneration(aGeneration); if (!s) { return; } @@ -1700,12 +1700,12 @@ nsMemoryReporterManager::EndProcessReport(uint32_t aGeneration, bool aSuccess) nsMemoryReporterManager::TimeoutCallback(nsITimer* aTimer, void* aData) { nsMemoryReporterManager* mgr = static_cast(aData); - GetReportsState* s = mgr->mGetReportsState; + PendingProcessesState* s = mgr->mPendingProcessesState; // Release assert because: if the pointer is null we're about to // crash regardless of DEBUG, and this way the compiler doesn't // complain about unused variables. - MOZ_RELEASE_ASSERT(s, "mgr->mGetReportsState"); + MOZ_RELEASE_ASSERT(s, "mgr->mPendingProcessesState"); MEMORY_REPORTING_LOG("TimeoutCallback (s->gen=%u; %u running, %u pending)\n", s->mGeneration, s->mNumProcessesRunning, static_cast(s->mChildrenPending.Length())); @@ -1723,23 +1723,23 @@ nsMemoryReporterManager::FinishReporting() MOZ_CRASH(); } - MOZ_ASSERT(mGetReportsState); + MOZ_ASSERT(mPendingProcessesState); MEMORY_REPORTING_LOG("FinishReporting (s->gen=%u; %u processes reported)\n", - mGetReportsState->mGeneration, - mGetReportsState->mNumProcessesCompleted); + mPendingProcessesState->mGeneration, + mPendingProcessesState->mNumProcessesCompleted); - // Call this before deleting |mGetReportsState|. That way, if + // Call this before deleting |mPendingProcessesState|. That way, if // |mFinishReportData| calls GetReports(), it will silently abort, as // required. - nsresult rv = mGetReportsState->mFinishReporting->Callback( - mGetReportsState->mFinishReportingData); + nsresult rv = mPendingProcessesState->mFinishReporting->Callback( + mPendingProcessesState->mFinishReportingData); - delete mGetReportsState; - mGetReportsState = nullptr; + delete mPendingProcessesState; + mPendingProcessesState = nullptr; return rv; } -nsMemoryReporterManager::GetReportsState::GetReportsState( +nsMemoryReporterManager::PendingProcessesState::PendingProcessesState( uint32_t aGeneration, bool aAnonymize, bool aMinimize, uint32_t aConcurrencyLimit, nsIHandleReportCallback* aHandleReport, diff --git a/xpcom/base/nsMemoryReporterManager.h b/xpcom/base/nsMemoryReporterManager.h index 4adfa60b80a..7f17b348a1d 100644 --- a/xpcom/base/nsMemoryReporterManager.h +++ b/xpcom/base/nsMemoryReporterManager.h @@ -48,7 +48,7 @@ public: // // - GetReports() (declared within NS_DECL_NSIMEMORYREPORTERMANAGER) // synchronously gets memory reports for the current process, sets up some - // state (mGetReportsState) for when child processes report back -- + // state (mPendingProcessesState) for when child processes report back -- // including a timer -- and starts telling child processes to get memory // reports. Control then returns to the main event loop. // @@ -108,7 +108,7 @@ public: // is incomplete. // // Now, what what happens if a child process is created/destroyed in the - // middle of a request? Well, GetReportsState is initialized with an array + // middle of a request? Well, PendingProcessesState is initialized with an array // of child process actors as of when the report started. So... // // - If a process is created after reporting starts, it won't be sent a @@ -205,7 +205,7 @@ private: uint32_t mNextGeneration; - struct GetReportsState + struct PendingProcessesState { uint32_t mGeneration; bool mAnonymize; @@ -221,23 +221,23 @@ private: nsCOMPtr mFinishReportingData; nsString mDMDDumpIdent; - GetReportsState(uint32_t aGeneration, bool aAnonymize, bool aMinimize, - uint32_t aConcurrencyLimit, - nsIHandleReportCallback* aHandleReport, - nsISupports* aHandleReportData, - nsIFinishReportingCallback* aFinishReporting, - nsISupports* aFinishReportingData, - const nsAString& aDMDDumpIdent); + PendingProcessesState(uint32_t aGeneration, bool aAnonymize, bool aMinimize, + uint32_t aConcurrencyLimit, + nsIHandleReportCallback* aHandleReport, + nsISupports* aHandleReportData, + nsIFinishReportingCallback* aFinishReporting, + nsISupports* aFinishReportingData, + const nsAString& aDMDDumpIdent); }; // When this is non-null, a request is in flight. Note: We use manual // new/delete for this because its lifetime doesn't match block scope or // anything like that. - GetReportsState* mGetReportsState; + PendingProcessesState* mPendingProcessesState; - GetReportsState* GetStateForGeneration(uint32_t aGeneration); + PendingProcessesState* GetStateForGeneration(uint32_t aGeneration); static bool StartChildReport(mozilla::dom::ContentParent* aChild, - const GetReportsState* aState); + const PendingProcessesState* aState); }; #define NS_MEMORY_REPORTER_MANAGER_CID \