bug 1242268 don't try to wake up an empty MSG that is shutting down to report memory r?padenot
MozReview-Commit-ID: IWNUjWijukk
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -3442,37 +3442,37 @@ struct ArrayClearer
~ArrayClearer() { mArray.Clear(); }
nsTArray<AudioNodeSizes>& mArray;
};
NS_IMETHODIMP
MediaStreamGraphImpl::CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData, bool aAnonymize)
{
+ if (mLifecycleState >= LIFECYCLE_WAITING_FOR_THREAD_SHUTDOWN) {
+ // Shutting down, nothing to report.
+ return NS_OK;
+ }
+
// Clears out the report array after we're done with it.
ArrayClearer reportCleanup(mAudioStreamSizes);
{
MonitorAutoLock memoryReportLock(mMemoryReportMonitor);
mNeedsMemoryReport = true;
{
// Wake up the MSG thread if it's real time (Offline graphs can't be
// sleeping).
MonitorAutoLock monitorLock(mMonitor);
if (!CurrentDriver()->AsOfflineClockDriver()) {
CurrentDriver()->WakeUp();
}
}
- if (mLifecycleState >= LIFECYCLE_WAITING_FOR_THREAD_SHUTDOWN) {
- // Shutting down, nothing to report.
- return NS_OK;
- }
-
// Wait for up to one second for the report to complete.
nsresult rv;
const PRIntervalTime kMaxWait = PR_SecondsToInterval(1);
while ((rv = memoryReportLock.Wait(kMaxWait)) != NS_OK) {
if (PR_GetError() != PR_PENDING_INTERRUPT_ERROR) {
return rv;
}
}