Bug 1428951 - add a getter for MediaCacheStream::GetDebugInfo() to take the cache monitor on the main thread. r=bechen,gerald

MozReview-Commit-ID: 8qkZg0MJsGQ

--HG--
extra : rebase_source : 0ff2f6ebe8908bd5dade301f6c2c52e718a23c47
This commit is contained in:
JW Wang 2018-01-09 10:29:10 +08:00
Родитель b7359b79da
Коммит 45984a084a
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -472,6 +472,16 @@ protected:
// True if we've tried to init sThread. Note we try once only so it is safe
// to access sThread on all threads.
static bool sThreadInit;
private:
// Used by MediaCacheStream::GetDebugInfo() only for debugging.
// Don't add new callers to this function.
friend nsCString MediaCacheStream::GetDebugInfo();
mozilla::Monitor& GetMonitorOnTheMainThread()
{
MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread());
return mMonitor;
}
};
// Initialized to nullptr by non-local static initialization.
@ -2984,7 +2994,7 @@ MediaCacheStream::GetDownloadRate(bool* aIsReliable)
nsCString
MediaCacheStream::GetDebugInfo()
{
AutoLock lock(mMediaCache->Monitor());
AutoLock lock(mMediaCache->GetMonitorOnTheMainThread());
return nsPrintfCString("mStreamLength=%" PRId64 " mChannelOffset=%" PRId64
" mCacheSuspended=%d mChannelEnded=%d mLoadID=%u",
mStreamLength,