mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1193245 - Use Atomic in the suspend count of the media resource. r=jwwang
In present codebase, the |mSuspendCount| would be accessed in main thread and state machine thread, and we use the lock mechanism to avoid the race condition. However, we can use another more easier way to achieve it, that is using Atomic for the |mSuspendCount|. --HG-- extra : transplant_source : %E7%80%93h%25%5D%24%CA%0C%19%1BDQ%60%08%BD%CB%9D%90%FC
This commit is contained in:
parent
a740b87b77
commit
3157f0bcb7
@ -1114,7 +1114,6 @@ ChannelMediaResource::IsSuspendedByCache()
|
||||
bool
|
||||
ChannelMediaResource::IsSuspended()
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
return mSuspendCount > 0;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "MediaCache.h"
|
||||
#include "MediaData.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nsThreadUtils.h"
|
||||
@ -778,7 +779,7 @@ protected:
|
||||
// A data received event for the decoder that has been dispatched but has
|
||||
// not yet been processed.
|
||||
nsRevocableEventPtr<nsRunnableMethod<ChannelMediaResource, void, false> > mDataReceivedEvent;
|
||||
uint32_t mSuspendCount;
|
||||
Atomic<uint32_t> mSuspendCount;
|
||||
// When this flag is set, if we get a network error we should silently
|
||||
// reopen the stream.
|
||||
bool mReopenOnError;
|
||||
|
Loading…
Reference in New Issue
Block a user