Bug 1747282: dom/media/File* cleanup r=bryce

Differential Revision: https://phabricator.services.mozilla.com/D138509
This commit is contained in:
Randell Jesup 2022-02-15 23:39:11 +00:00
Родитель 6063921e0f
Коммит 1415ca78a7
2 изменённых файлов: 5 добавлений и 3 удалений

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

@ -31,8 +31,7 @@ static void CloseFD(PRFileDesc* aFD) {
}
void FileBlockCache::SetCacheFile(PRFileDesc* aFD) {
LOG("SetFD(aFD=%p) mBackgroundET=%p", aFD, mBackgroundET.get());
LOG("SetCacheFile aFD=%p", aFD);
if (!aFD) {
// Failed to get a temporary file. Shutdown.
Close();
@ -44,6 +43,8 @@ void FileBlockCache::SetCacheFile(PRFileDesc* aFD) {
}
{
MutexAutoLock lock(mDataMutex);
LOG("SetFileCache mBackgroundET=%p, mIsWriteScheduled %d",
mBackgroundET.get(), mIsWriteScheduled);
if (mBackgroundET) {
// Still open, complete the initialization.
mInitialized = true;
@ -317,8 +318,8 @@ nsresult FileBlockCache::MoveBlockInFile(int32_t aSourceBlockIndex,
}
void FileBlockCache::PerformBlockIOs() {
MOZ_ASSERT(mBackgroundET->IsOnCurrentThread());
MutexAutoLock mon(mDataMutex);
MOZ_ASSERT(mBackgroundET->IsOnCurrentThread());
NS_ASSERTION(mIsWriteScheduled, "Should report write running or scheduled.");
LOG("Run() mFD=%p mBackgroundET=%p", mFD, mBackgroundET.get());

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

@ -59,6 +59,7 @@ nsresult FileMediaResource::Open(nsIStreamListener** aStreamListener) {
*aStreamListener = nullptr;
nsresult rv = NS_OK;
MutexAutoLock lock(mLock);
// The channel is already open. We need a synchronous stream that
// implements nsISeekableStream, so we have to find the underlying
// file and reopen it