Bug 1394313 - replace use of nsAutoPtr with UniquePtr in MediaDecoderOwner.h. r=cpearce

MozReview-Commit-ID: 49lyvMzg7oY

--HG--
extra : rebase_source : b83cd03b0026c73d0293ef937a3c2544349f464d
This commit is contained in:
JW Wang 2017-08-28 14:10:35 +08:00
parent c259a3a1b5
commit f8f989dd93
5 changed files with 13 additions and 13 deletions

View File

@ -5314,15 +5314,16 @@ void HTMLMediaElement::ProcessMediaFragmentURI()
}
}
void HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
nsAutoPtr<const MetadataTags> aTags)
void
HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
UniquePtr<const MetadataTags> aTags)
{
MOZ_ASSERT(NS_IsMainThread());
SetMediaInfo(*aInfo);
mIsEncrypted = aInfo->IsEncrypted() || mPendingEncryptedInitData.IsEncrypted();
mTags = aTags.forget();
mTags = Move(aTags);
mLoadedDataFired = false;
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_METADATA);
@ -5735,7 +5736,7 @@ HTMLMediaElement::UpdateReadyStateInternal()
if (hasVideoTracks) {
mediaInfo.EnableVideo();
}
MetadataLoaded(&mediaInfo, nsAutoPtr<const MetadataTags>(nullptr));
MetadataLoaded(&mediaInfo, nullptr);
}
if (mMediaSource) {

View File

@ -169,8 +169,9 @@ public:
// Called by the video decoder object, on the main thread,
// when it has read the metadata containing video dimensions,
// etc.
virtual void MetadataLoaded(const MediaInfo* aInfo,
nsAutoPtr<const MetadataTags> aTags) final override;
virtual void MetadataLoaded(
const MediaInfo* aInfo,
UniquePtr<const MetadataTags> aTags) final override;
// Called by the decoder object, on the main thread,
// when it has read the first frame of the video or audio.
@ -1452,7 +1453,7 @@ protected:
// Current audio volume
double mVolume;
nsAutoPtr<const MetadataTags> mTags;
UniquePtr<const MetadataTags> mTags;
// URI of the resource we're attempting to load. This stores the value we
// return in the currentSrc attribute. Use GetCurrentSrc() to access the

View File

@ -735,8 +735,7 @@ MediaDecoder::MetadataLoaded(UniquePtr<MediaInfo> aInfo,
// our new size.
if (aEventVisibility != MediaDecoderEventVisibility::Suppressed) {
mFiredMetadataLoaded = true;
GetOwner()->MetadataLoaded(
mInfo, nsAutoPtr<const MetadataTags>(aTags.release()));
GetOwner()->MetadataLoaded(mInfo, Move(aTags));
}
// Invalidate() will end up calling GetOwner()->UpdateMediaSize with the last
// dimensions retrieved from the video frame container. The video frame

View File

@ -6,8 +6,8 @@
#ifndef MediaDecoderOwner_h_
#define MediaDecoderOwner_h_
#include "mozilla/UniquePtr.h"
#include "MediaInfo.h"
#include "nsAutoPtr.h"
namespace mozilla {
@ -59,7 +59,7 @@ public:
// etc.
// Must take ownership of MetadataTags aTags argument.
virtual void MetadataLoaded(const MediaInfo* aInfo,
nsAutoPtr<const MetadataTags> aTags) = 0;
UniquePtr<const MetadataTags> aTags) = 0;
// Called by the decoder object, on the main thread,
// when it has read the first frame of the video or audio.

View File

@ -7,7 +7,6 @@
#include "MediaDecoderOwner.h"
#include "mozilla/AbstractThread.h"
#include "nsAutoPtr.h"
namespace mozilla
{
@ -22,7 +21,7 @@ public:
void FireTimeUpdate(bool aPeriodic) override {}
bool GetPaused() override { return false; }
void MetadataLoaded(const MediaInfo* aInfo,
nsAutoPtr<const MetadataTags> aTags) override
UniquePtr<const MetadataTags> aTags) override
{
}
void NetworkError() override {}