Bug 1404997 - P14. Rename members to clarify the finish meaning. r=padenot

We have different concept of "finish" between the base class and its hierarchy.
Attempt to clear the sitatuation by renaming the members and related methods.

MozReview-Commit-ID: vFsXhMK5GY

--HG--
extra : rebase_source : 65eda9257e447584161da51af7c240e31027c501
This commit is contained in:
Jean-Yves Avenard 2017-12-06 19:00:22 +01:00
Родитель 55065b688d
Коммит a21ef82be7
5 изменённых файлов: 23 добавлений и 22 удалений

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

@ -974,7 +974,7 @@ DOMMediaStream::InitOwnedStreamCommon(MediaStreamGraph* aGraph)
MOZ_ASSERT(!mPlaybackStream, "Owned stream must be initialized before playback stream");
mOwnedStream = aGraph->CreateTrackUnionStream();
mOwnedStream->SetAutofinish(true);
mOwnedStream->QueueSetAutofinish(true);
mOwnedStream->RegisterUser();
if (mInputStream) {
mOwnedPort = mOwnedStream->AllocateInputPort(mInputStream);
@ -989,7 +989,7 @@ void
DOMMediaStream::InitPlaybackStreamCommon(MediaStreamGraph* aGraph)
{
mPlaybackStream = aGraph->CreateTrackUnionStream();
mPlaybackStream->SetAutofinish(true);
mPlaybackStream->QueueSetAutofinish(true);
mPlaybackStream->RegisterUser();
if (mOwnedStream) {
mPlaybackPort = mPlaybackStream->AllocateInputPort(mOwnedStream);

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

@ -1494,7 +1494,7 @@ public:
// so they can clean up any gfx resources.
if (SourceMediaStream* source = stream->AsSourceStream()) {
// Finishing a SourceStream prevents new data from being appended.
source->Finish();
source->FinishPending();
}
stream->GetStreamTracks().Clear();
stream->RemoveAllListenersImpl();
@ -2656,7 +2656,7 @@ SourceMediaStream::SourceMediaStream()
, mMutex("mozilla::media::SourceMediaStream")
, mUpdateKnownTracksTime(0)
, mPullEnabled(false)
, mUpdateFinished(false)
, mFinishPending(false)
, mNeedsMixing(false)
{
}
@ -2748,7 +2748,7 @@ SourceMediaStream::ExtractPendingInput(StreamTime aDesiredUpToTime,
}
}
bool finished = mUpdateFinished;
bool finished = mFinishPending;
bool shouldNotifyTrackCreated = false;
for (int32_t i = mUpdateTracks.Length() - 1; i >= 0; --i) {
@ -3162,10 +3162,10 @@ SourceMediaStream::AdvanceKnownTracksTime(StreamTime aKnownTime)
}
void
SourceMediaStream::FinishWithLockHeld()
SourceMediaStream::FinishPendingWithLockHeld()
{
mMutex.AssertCurrentThreadOwns();
mUpdateFinished = true;
mFinishPending = true;
if (auto graph = GraphImpl()) {
graph->EnsureNextIteration();
}
@ -3211,7 +3211,7 @@ SourceMediaStream::EndAllTrackAndFinish()
data->mCommands |= TrackEventCommand::TRACK_EVENT_ENDED;
}
mPendingTracks.Clear();
FinishWithLockHeld();
FinishPendingWithLockHeld();
// we will call NotifyEvent() to let GetUserMedia know
}
@ -3479,7 +3479,7 @@ ProcessedMediaStream::AllocateInputPort(MediaStream* aStream, TrackID aTrackID,
}
void
ProcessedMediaStream::Finish()
ProcessedMediaStream::QueueFinish()
{
class Message : public ControlMessage {
public:
@ -3494,7 +3494,7 @@ ProcessedMediaStream::Finish()
}
void
ProcessedMediaStream::SetAutofinish(bool aAutofinish)
ProcessedMediaStream::QueueSetAutofinish(bool aAutofinish)
{
class Message : public ControlMessage {
public:

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

@ -769,11 +769,11 @@ public:
* must have been ended via EndTrack. The finish time of the stream is
* when all tracks have ended.
*/
void FinishWithLockHeld();
void Finish()
void FinishPendingWithLockHeld();
void FinishPending()
{
MutexAutoLock lock(mMutex);
FinishWithLockHeld();
FinishPendingWithLockHeld();
}
// Overriding allows us to hold the mMutex lock while changing the track enable status
@ -908,7 +908,7 @@ protected:
nsTArray<TrackData> mPendingTracks;
nsTArray<TrackBound<DirectMediaStreamTrackListener>> mDirectTrackListeners;
bool mPullEnabled;
bool mUpdateFinished;
bool mFinishPending;
bool mNeedsMixing;
};
@ -1165,15 +1165,16 @@ public:
uint16_t aOutputNumber = 0,
nsTArray<TrackID>* aBlockedTracks = nullptr);
/**
* Force this stream into the finished state.
* Queue a message to force this stream into the finished state.
*/
void Finish();
void QueueFinish();
/**
* Set the autofinish flag on this stream (defaults to false). When this flag
* is set, and all input streams are in the finished state (including if there
* are no input streams), this stream automatically enters the finished state.
* Queue a message to set the autofinish flag on this stream (defaults to
* false). When this flag is set, and all input streams are in the finished
* state (including if there are no input streams), this stream automatically
* enters the finished state.
*/
void SetAutofinish(bool aAutofinish);
void QueueSetAutofinish(bool aAutofinish);
ProcessedMediaStream* AsProcessedStream() override { return this; }

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

@ -712,7 +712,7 @@ DecodedStream::SendData()
if (finished && !mData->mHaveSentFinish) {
mData->mHaveSentFinish = true;
mData->mStream->Finish();
mData->mStream->FinishPending();
}
}

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

@ -80,7 +80,7 @@ OutputStreamManager::Add(ProcessedMediaStream* aStream, bool aFinishWhenEnded)
// Ensure that aStream finishes the moment mDecodedStream does.
if (aFinishWhenEnded) {
aStream->SetAutofinish(true);
aStream->QueueSetAutofinish(true);
}
OutputStreamData* p = mStreams.AppendElement();