Bug 1319992: P4. Use Mutex in place of Monitor. r=jwwang

MozReview-Commit-ID: 79z6EtZQhYu

--HG--
extra : rebase_source : c0b7bc861641178539cab15da843d0b4d6ae416e
This commit is contained in:
Jean-Yves Avenard 2016-11-30 01:50:08 +11:00
Родитель 20853d0607
Коммит c1797cf144
2 изменённых файлов: 8 добавлений и 9 удалений

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

@ -19,7 +19,6 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Mutex.h"
#include "mozilla/SharedThreadPool.h"
#include "mozilla/SyncRunnable.h"
#include "nsContentUtils.h"
@ -415,7 +414,7 @@ MediaFormatReader::DecoderFactory::DoInitDecoder(TrackType aTrack)
[this, &data, &ownerData] (TrackType aTrack) {
data.mInitPromise.Complete();
data.mStage = Stage::None;
MonitorAutoLock mon(ownerData.mMonitor);
MutexAutoLock lock(ownerData.mMutex);
ownerData.mDecoder = data.mDecoder.forget();
ownerData.mDescription = ownerData.mDecoder->GetDescriptionName();
mOwner->SetVideoDecodeThreshold();
@ -2656,11 +2655,11 @@ MediaFormatReader::GetMozDebugReaderData(nsAString& aString)
const char* videoName = audioName;
if (HasAudio()) {
MonitorAutoLock mon(mAudio.mMonitor);
MutexAutoLock lock(mAudio.mMutex);
audioName = mAudio.mDescription;
}
if (HasVideo()) {
MonitorAutoLock mon(mVideo.mMonitor);
MutexAutoLock mon(mVideo.mMutex);
videoName = mVideo.mDescription;
}

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

@ -10,7 +10,7 @@
#include "mozilla/Atomics.h"
#include "mozilla/Maybe.h"
#include "mozilla/TaskQueue.h"
#include "mozilla/Monitor.h"
#include "mozilla/Mutex.h"
#include "MediaEventSource.h"
#include "MediaDataDemuxer.h"
@ -209,7 +209,7 @@ private:
uint32_t aNumOfMaxError)
: mOwner(aOwner)
, mType(aType)
, mMonitor("DecoderData")
, mMutex("DecoderData")
, mDescription("shutdown")
, mUpdateScheduled(false)
, mDemuxEOS(false)
@ -243,14 +243,14 @@ private:
// Callback that receives output and error notifications from the decoder.
nsAutoPtr<DecoderCallback> mCallback;
// Monitor protecting mDescription and mDecoder.
Monitor mMonitor;
// Mutex protecting mDescription and mDecoder.
Mutex mMutex;
// The platform decoder.
RefPtr<MediaDataDecoder> mDecoder;
const char* mDescription;
void ShutdownDecoder()
{
MonitorAutoLock mon(mMonitor);
MutexAutoLock lock(mMutex);
if (mDecoder) {
mDecoder->Shutdown();
}