Bug 1423241 - Remove a rawptr in HTMLMediaElement. r=jya

Differential Revision: https://phabricator.services.mozilla.com/D9099

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2018-11-23 15:00:55 +00:00
Родитель 5d81eeb138
Коммит 2561e93cdb
2 изменённых файлов: 19 добавлений и 7 удалений

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

@ -5272,31 +5272,43 @@ public:
void NotifyTrackAdded(const RefPtr<MediaStreamTrack>& aTrack) override
{
if (!mElement) {
return;
}
mElement->NotifyMediaStreamTrackAdded(aTrack);
}
void NotifyTrackRemoved(const RefPtr<MediaStreamTrack>& aTrack) override
{
if (!mElement) {
return;
}
mElement->NotifyMediaStreamTrackRemoved(aTrack);
}
void NotifyActive() override
{
if (!mElement) {
return;
}
LOG(LogLevel::Debug,
("%p, mSrcStream %p became active",
mElement,
mElement.get(),
mElement->mSrcStream.get()));
mElement->CheckAutoplayDataReady();
}
void NotifyInactive() override
{
if (!mElement) {
return;
}
if (mElement->IsPlaybackEnded()) {
return;
}
LOG(LogLevel::Debug,
("%p, mSrcStream %p became inactive",
mElement,
mElement.get(),
mElement->mSrcStream.get()));
MOZ_ASSERT(!mElement->mSrcStream->Active());
if (mElement->mMediaStreamListener) {
@ -5307,7 +5319,7 @@ public:
}
protected:
HTMLMediaElement* const mElement;
const WeakPtr<HTMLMediaElement> mElement;
};
void
@ -5404,8 +5416,8 @@ HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream)
}
mSrcStream->OnTracksAvailable(new MediaStreamTracksAvailableCallback(this));
mMediaStreamTrackListener = new MediaStreamTrackListener(this);
mSrcStream->RegisterTrackListener(mMediaStreamTrackListener);
mMediaStreamTrackListener = MakeUnique<MediaStreamTrackListener>(this);
mSrcStream->RegisterTrackListener(mMediaStreamTrackListener.get());
mSrcStream->AddPrincipalChangeObserver(this);
mSrcStreamVideoPrincipal = mSrcStream->GetVideoPrincipal();
@ -5434,7 +5446,7 @@ HTMLMediaElement::EndSrcMediaStreamPlayback()
mSelectedVideoStreamTrack = nullptr;
mVideoFrameListener = nullptr;
mSrcStream->UnregisterTrackListener(mMediaStreamTrackListener);
mSrcStream->UnregisterTrackListener(mMediaStreamTrackListener.get());
mMediaStreamTrackListener = nullptr;
mSrcStreamTracksAvailable = false;

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

@ -1764,7 +1764,7 @@ protected:
RefPtr<VideoTrackList> mVideoTrackList;
nsAutoPtr<MediaStreamTrackListener> mMediaStreamTrackListener;
UniquePtr<MediaStreamTrackListener> mMediaStreamTrackListener;
// The principal guarding mVideoFrameContainer access when playing a
// MediaStream.