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

MozReview-Commit-ID: 79z6EtZQhYu

--HG--
extra : rebase_source : 925b627288e6a7237982ea11f76f99c04e782b39
This commit is contained in:
Jean-Yves Avenard 2016-11-30 01:50:08 +11:00
parent 65b1f05d4a
commit 8591c2a530
2 changed files with 8 additions and 9 deletions

View File

@ -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();
@ -2646,11 +2645,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;
}

View File

@ -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();
}