Bug 904926. Remove unnecessary lock. r=cpearce

--HG--
extra : rebase_source : 0088907b65ff3ce2e1f15b2bb1b5e0cdb7126f24
This commit is contained in:
Robert O'Callahan 2013-09-04 23:13:06 +12:00
parent b0a8de003d
commit 3dffe95932
2 changed files with 12 additions and 12 deletions

View File

@ -362,7 +362,6 @@ MediaDecoder::MediaDecoder() :
mInitialVolume(0.0),
mInitialPlaybackRate(1.0),
mInitialPreservesPitch(true),
mRequestedSeekTime(-1.0),
mDuration(-1),
mTransportSeekable(true),
mMediaSeekable(true),
@ -372,6 +371,7 @@ MediaDecoder::MediaDecoder() :
mIsExitingDormant(false),
mPlayState(PLAY_STATE_PAUSED),
mNextState(PLAY_STATE_PAUSED),
mRequestedSeekTime(-1.0),
mCalledResourceLoaded(false),
mIgnoreProgressData(false),
mInfiniteStream(false),
@ -708,8 +708,7 @@ bool
MediaDecoder::IsDataCachedToEndOfResource()
{
NS_ASSERTION(!mShuttingDown, "Don't call during shutdown!");
GetReentrantMonitor().AssertCurrentThreadIn();
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
return (mResource &&
mResource->IsDataCachedToEndOfResource(mDecoderPosition));
}
@ -755,7 +754,6 @@ void MediaDecoder::MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool
// Only inform the element of FirstFrameLoaded if not doing a load() in order
// to fulfill a seek, otherwise we'll get multiple loadedfirstframe events.
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
bool notifyResourceIsLoaded = !mCalledResourceLoaded &&
IsDataCachedToEndOfResource();
if (mOwner) {

View File

@ -692,7 +692,7 @@ public:
// Call on the main thread only.
void FirstFrameLoaded();
// Returns true if the resource has been loaded. Must be in monitor.
// Returns true if the resource has been loaded. Acquires the monitor.
// Call from any thread.
virtual bool IsDataCachedToEndOfResource();
@ -946,13 +946,6 @@ public:
double mInitialPlaybackRate;
bool mInitialPreservesPitch;
// Position to seek to when the seek notification is received by the
// decode thread. Written by the main thread and read via the
// decode thread. Synchronised using mReentrantMonitor. If the
// value is negative then no seek has been requested. When a seek is
// started this is reset to negative.
double mRequestedSeekTime;
// Duration of the media resource. Set to -1 if unknown.
// Set when the metadata is loaded. Accessed on the main thread
// only.
@ -1055,6 +1048,15 @@ public:
// This can only be PLAY_STATE_PAUSED or PLAY_STATE_PLAYING.
PlayState mNextState;
// Position to seek to when the seek notification is received by the
// decode thread.
// This can only be changed on the main thread while holding the decoder
// monitor. Thus, it can be safely read while holding the decoder monitor
// OR on the main thread.
// If the value is negative then no seek has been requested. When a seek is
// started this is reset to negative.
double mRequestedSeekTime;
// True when we have fully loaded the resource and reported that
// to the element (i.e. reached NETWORK_LOADED state).
// Accessed on the main thread only.