Bug 1346498 part 1 - extract the MediaDecoder::NotifyCompositor() method; r=jwwang

MozReview-Commit-ID: Hfw3FJUSVVe

--HG--
extra : rebase_source : 738cb2e341ab03d0dc189facc950314c29a3721b
extra : source : 63f67483e45c8a73eda772f264d2424a1049320f
This commit is contained in:
Kaku Kuo 2017-03-10 16:29:59 +08:00
Родитель c5e545347a
Коммит 64305205ed
2 изменённых файлов: 21 добавлений и 12 удалений

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

@ -303,18 +303,7 @@ MediaDecoder::NotifyOwnerActivityChanged(bool aIsVisible)
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
SetElementVisibility(aIsVisible);
MediaDecoderOwner* owner = GetOwner();
NS_ENSURE_TRUE_VOID(owner);
dom::HTMLMediaElement* element = owner->GetMediaElement();
NS_ENSURE_TRUE_VOID(element);
RefPtr<LayerManager> layerManager =
nsContentUtils::LayerManagerForDocument(element->OwnerDoc());
if (layerManager) {
RefPtr<KnowsCompositor> knowsCompositor = layerManager->AsShadowForwarder();
mCompositorUpdatedEvent.Notify(knowsCompositor);
}
NotifyCompositor();
}
void
@ -1299,6 +1288,23 @@ MediaDecoder::DurationChanged()
}
}
void
MediaDecoder::NotifyCompositor()
{
MediaDecoderOwner* owner = GetOwner();
NS_ENSURE_TRUE_VOID(owner);
dom::HTMLMediaElement* element = owner->GetMediaElement();
NS_ENSURE_TRUE_VOID(element);
RefPtr<LayerManager> layerManager =
nsContentUtils::LayerManagerForDocument(element->OwnerDoc());
if (layerManager) {
RefPtr<KnowsCompositor> knowsCompositor = layerManager->AsShadowForwarder();
mCompositorUpdatedEvent.Notify(knowsCompositor);
}
}
void
MediaDecoder::SetElementVisibility(bool aIsVisible)
{

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

@ -590,6 +590,9 @@ private:
MediaEventSource<void>*
DataArrivedEvent() override { return &mDataArrivedEvent; }
// Called when the owner's activity changed.
void NotifyCompositor();
MediaEventSource<RefPtr<layers::KnowsCompositor>>*
CompositorUpdatedEvent() override { return &mCompositorUpdatedEvent; }