зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1224973 - Part 2: Set MediaDecoder visibility via NotifyOwnerActivityChanged. r=cpearce,jwwang
Make MediaDecoder::SetElementVisibility private. MozReview-Commit-ID: GjCuSNPalkE
This commit is contained in:
Родитель
d4be2cf480
Коммит
9f98a19f8c
|
@ -2774,7 +2774,7 @@ nsresult HTMLMediaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParen
|
|||
if (mDecoder) {
|
||||
// When the MediaElement is binding to tree, the dormant status is
|
||||
// aligned to document's hidden status.
|
||||
mDecoder->NotifyOwnerActivityChanged();
|
||||
mDecoder->NotifyOwnerActivityChanged(!IsHidden());
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -2872,7 +2872,7 @@ void HTMLMediaElement::UnbindFromTree(bool aDeep,
|
|||
|
||||
if (mDecoder) {
|
||||
MOZ_ASSERT(IsHidden());
|
||||
mDecoder->NotifyOwnerActivityChanged();
|
||||
mDecoder->NotifyOwnerActivityChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4532,10 +4532,8 @@ void HTMLMediaElement::NotifyOwnerDocumentActivityChanged()
|
|||
bool
|
||||
HTMLMediaElement::NotifyOwnerDocumentActivityChangedInternal()
|
||||
{
|
||||
nsIDocument* ownerDoc = OwnerDoc();
|
||||
if (mDecoder && !IsBeingDestroyed()) {
|
||||
mDecoder->SetElementVisibility(!ownerDoc->Hidden());
|
||||
mDecoder->NotifyOwnerActivityChanged();
|
||||
mDecoder->NotifyOwnerActivityChanged(!IsHidden());
|
||||
}
|
||||
|
||||
bool pauseElement = !IsActive();
|
||||
|
|
|
@ -287,7 +287,7 @@ MediaDecoder::ResourceCallback::NotifyBytesConsumed(int64_t aBytes,
|
|||
}
|
||||
|
||||
void
|
||||
MediaDecoder::NotifyOwnerActivityChanged()
|
||||
MediaDecoder::NotifyOwnerActivityChanged(bool aIsVisible)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -295,6 +295,8 @@ MediaDecoder::NotifyOwnerActivityChanged()
|
|||
return;
|
||||
}
|
||||
|
||||
SetElementVisibility(aIsVisible);
|
||||
|
||||
UpdateDormantState(false /* aDormantTimeout */, false /* aActivity */);
|
||||
// Start dormant timer if necessary
|
||||
StartDormantTimer();
|
||||
|
@ -1365,6 +1367,13 @@ MediaDecoder::DurationChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::SetElementVisibility(bool aIsVisible)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mIsVisible = aIsVisible;
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::UpdateEstimatedMediaDuration(int64_t aDuration)
|
||||
{
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
// Dormant state is a state to free all scarce media resources
|
||||
// (like hw video codec), did not decoding and stay dormant.
|
||||
// It is used to share scarece media resources in system.
|
||||
virtual void NotifyOwnerActivityChanged();
|
||||
virtual void NotifyOwnerActivityChanged(bool aIsVisible);
|
||||
|
||||
void UpdateDormantState(bool aDormantTimeout, bool aActivity);
|
||||
|
||||
|
@ -250,9 +250,6 @@ protected:
|
|||
void UpdateEstimatedMediaDuration(int64_t aDuration) override;
|
||||
|
||||
public:
|
||||
// Called from HTMLMediaElement when owner document activity changes
|
||||
virtual void SetElementVisibility(bool aIsVisible) {}
|
||||
|
||||
// Set a flag indicating whether random seeking is supported
|
||||
void SetMediaSeekable(bool aMediaSeekable);
|
||||
// Set a flag indicating whether seeking is supported only in buffered ranges
|
||||
|
@ -368,6 +365,9 @@ private:
|
|||
void SetAudioChannel(dom::AudioChannel aChannel) { mAudioChannel = aChannel; }
|
||||
dom::AudioChannel GetAudioChannel() { return mAudioChannel; }
|
||||
|
||||
// Called from HTMLMediaElement when owner document activity changes
|
||||
virtual void SetElementVisibility(bool aIsVisible);
|
||||
|
||||
/******
|
||||
* The following methods must only be called on the main
|
||||
* thread.
|
||||
|
|
|
@ -252,6 +252,7 @@ void
|
|||
MediaOmxCommonDecoder::SetElementVisibility(bool aIsVisible)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MediaDecoder::SetElementVisibility(aIsVisible);
|
||||
if (mAudioOffloadPlayer) {
|
||||
mAudioOffloadPlayer->SetElementVisibility(aIsVisible);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче