Bug 1365524. P2 - replace use of nsAutoPtr with UniquePtr. r=jya

MozReview-Commit-ID: 8zR7ZRXl1ON

--HG--
extra : rebase_source : 24053b1be0149ffb6e0dc2c1276c487a64787f32
This commit is contained in:
JW Wang 2017-05-18 16:35:49 +08:00
parent dccac51c32
commit a80b2eab10
4 changed files with 15 additions and 15 deletions

View File

@ -777,16 +777,16 @@ MediaDecoder::OnMetadataUpdate(TimedMetadata&& aMetadata)
{
MOZ_ASSERT(NS_IsMainThread());
GetOwner()->RemoveMediaTracks();
MetadataLoaded(nsAutoPtr<MediaInfo>(new MediaInfo(*aMetadata.mInfo)),
Move(aMetadata.mTags),
MetadataLoaded(MakeUnique<MediaInfo>(*aMetadata.mInfo),
UniquePtr<MetadataTags>(aMetadata.mTags.forget()),
MediaDecoderEventVisibility::Observable);
FirstFrameLoaded(Move(aMetadata.mInfo),
MediaDecoderEventVisibility::Observable);
}
void
MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
nsAutoPtr<MetadataTags> aTags,
MediaDecoder::MetadataLoaded(UniquePtr<MediaInfo> aInfo,
UniquePtr<MetadataTags> aTags,
MediaDecoderEventVisibility aEventVisibility)
{
MOZ_ASSERT(NS_IsMainThread());
@ -798,15 +798,15 @@ MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
mMediaSeekable = aInfo->mMediaSeekable;
mMediaSeekableOnlyInBufferedRanges = aInfo->mMediaSeekableOnlyInBufferedRanges;
mInfo = aInfo.forget();
mInfo = aInfo.release();
GetOwner()->ConstructMediaTracks(mInfo);
// Make sure the element and the frame (if any) are told about
// our new size.
if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
mFiredMetadataLoaded = true;
GetOwner()->MetadataLoaded(mInfo,
nsAutoPtr<const MetadataTags>(aTags.forget()));
GetOwner()->MetadataLoaded(
mInfo, nsAutoPtr<const MetadataTags>(aTags.release()));
}
// Invalidate() will end up calling GetOwner()->UpdateMediaSize with the last
// dimensions retrieved from the video frame container. The video frame

View File

@ -572,8 +572,8 @@ private:
// Called when the metadata from the media file has been loaded by the
// state machine. Call on the main thread only.
void MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
nsAutoPtr<MetadataTags> aTags,
void MetadataLoaded(UniquePtr<MediaInfo> aInfo,
UniquePtr<MetadataTags> aTags,
MediaDecoderEventVisibility aEventVisibility);
MediaEventSource<void>*

View File

@ -2166,8 +2166,8 @@ DecodeMetadataState::OnMetadataRead(MetadataHolder&& aMetadata)
MOZ_ASSERT(mMaster->mDuration.Ref().isSome());
mMaster->mMetadataLoadedEvent.Notify(
nsAutoPtr<MediaInfo>(aMetadata.mInfo.release()),
nsAutoPtr<MetadataTags>(aMetadata.mTags.release()),
Move(aMetadata.mInfo),
Move(aMetadata.mTags),
MediaDecoderEventVisibility::Observable);
if (Info().IsEncrypted() && !mMaster->mCDMProxy) {

View File

@ -214,8 +214,8 @@ public:
MediaEventSource<void>& OnMediaNotSeekable() const;
MediaEventSourceExc<nsAutoPtr<MediaInfo>,
nsAutoPtr<MetadataTags>,
MediaEventSourceExc<UniquePtr<MediaInfo>,
UniquePtr<MetadataTags>,
MediaDecoderEventVisibility>&
MetadataLoadedEvent() { return mMetadataLoadedEvent; }
@ -669,8 +669,8 @@ private:
MediaEventListener mAudibleListener;
MediaEventListener mOnMediaNotSeekable;
MediaEventProducerExc<nsAutoPtr<MediaInfo>,
nsAutoPtr<MetadataTags>,
MediaEventProducerExc<UniquePtr<MediaInfo>,
UniquePtr<MetadataTags>,
MediaDecoderEventVisibility> mMetadataLoadedEvent;
MediaEventProducerExc<nsAutoPtr<MediaInfo>,
MediaDecoderEventVisibility> mFirstFrameLoadedEvent;