зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1393379. P1 - make MediaDecoder::AddSizeOfResources pure virtual. r=gerald
We will move the implementation to sub-classes which have more details about how to calculate the resource size. MozReview-Commit-ID: 7lfiz5GNtPE --HG-- extra : rebase_source : bf14ef91a6de456d65bee7cb1f53f8e542f55247 extra : source : 22640df9dd3a1491594a82b3d0bd175e46073fa3
This commit is contained in:
Родитель
7e2ea48a18
Коммит
2c37ac8f7c
|
@ -487,6 +487,15 @@ ChannelMediaDecoder::ShouldThrottleDownload()
|
|||
return stats.mDownloadRate > factor * stats.mPlaybackRate;
|
||||
}
|
||||
|
||||
void
|
||||
ChannelMediaDecoder::AddSizeOfResources(ResourceSizes* aSizes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mResource) {
|
||||
aSizes->mByteSize += mResource->SizeOfIncludingThis(aSizes->mMallocSizeOf);
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIPrincipal>
|
||||
ChannelMediaDecoder::GetCurrentPrincipal()
|
||||
{
|
||||
|
|
|
@ -78,6 +78,7 @@ public:
|
|||
bool aIsPrivateBrowsing,
|
||||
nsIStreamListener** aStreamListener);
|
||||
|
||||
void AddSizeOfResources(ResourceSizes* aSizes) override;
|
||||
already_AddRefed<nsIPrincipal> GetCurrentPrincipal() override;
|
||||
bool IsTransportSeekable() override;
|
||||
void SetLoadInBackground(bool aLoadInBackground) override;
|
||||
|
|
|
@ -1336,15 +1336,6 @@ MediaDecoder::SizeOfAudioQueue()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void MediaDecoder::AddSizeOfResources(ResourceSizes* aSizes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (GetResource()) {
|
||||
aSizes->mByteSize +=
|
||||
GetResource()->SizeOfIncludingThis(aSizes->mMallocSizeOf);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::NotifyDataArrivedInternal()
|
||||
{
|
||||
|
|
|
@ -275,7 +275,7 @@ private:
|
|||
MozPromiseHolder<SizeOfPromise> mCallback;
|
||||
};
|
||||
|
||||
virtual void AddSizeOfResources(ResourceSizes* aSizes);
|
||||
virtual void AddSizeOfResources(ResourceSizes* aSizes) = 0;
|
||||
|
||||
VideoFrameContainer* GetVideoFrameContainer()
|
||||
{
|
||||
|
|
|
@ -92,6 +92,15 @@ HLSDecoder::Load(nsIChannel* aChannel)
|
|||
return InitializeStateMachine();
|
||||
}
|
||||
|
||||
void
|
||||
HLSDecoder::AddSizeOfResources(ResourceSizes* aSizes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mResource) {
|
||||
aSizes->mByteSize += mResource->SizeOfIncludingThis(aSizes->mMallocSizeOf);
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIPrincipal>
|
||||
HLSDecoder::GetCurrentPrincipal()
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
|
||||
void Pause() override;
|
||||
|
||||
void AddSizeOfResources(ResourceSizes* aSizes) override;
|
||||
already_AddRefed<nsIPrincipal> GetCurrentPrincipal() override;
|
||||
bool IsTransportSeekable() override { return true; }
|
||||
void Suspend() override;
|
||||
|
|
|
@ -83,12 +83,6 @@ public:
|
|||
|
||||
void Detach() { mDecoder = nullptr; }
|
||||
|
||||
private:
|
||||
friend class HLSResourceCallbacksSupport;
|
||||
|
||||
void onDataAvailable();
|
||||
void onError(int aErrorCode);
|
||||
|
||||
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
|
||||
{
|
||||
size_t size = MediaResource::SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
@ -100,6 +94,12 @@ private:
|
|||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
private:
|
||||
friend class HLSResourceCallbacksSupport;
|
||||
|
||||
void onDataAvailable();
|
||||
void onError(int aErrorCode);
|
||||
|
||||
HLSDecoder* mDecoder;
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
|
Загрузка…
Ссылка в новой задаче