Bug 1347402 part 3 - get owner document via polymorphism; r?jwwang
MozReview-Commit-ID: GCr2xQyST4X
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -584,21 +584,17 @@ MediaDecoder::OnPlaybackErrorEvent(const
}
void
MediaDecoder::OnDecoderDoctorEvent(DecoderDoctorEvent aEvent)
{
MOZ_ASSERT(NS_IsMainThread());
// OnDecoderDoctorEvent is disconnected at shutdown time.
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
- HTMLMediaElement* element = GetOwner()->GetMediaElement();
- if (!element) {
- return;
- }
- nsIDocument* doc = element->OwnerDoc();
+ nsIDocument* doc = GetOwner()->GetDocument();
if (!doc) {
return;
}
DecoderDoctorDiagnostics diags;
diags.StoreEvent(doc, aEvent, __func__);
}
void
@@ -1292,21 +1288,21 @@ MediaDecoder::DurationChanged()
}
void
MediaDecoder::NotifyCompositor()
{
MediaDecoderOwner* owner = GetOwner();
NS_ENSURE_TRUE_VOID(owner);
- dom::HTMLMediaElement* element = owner->GetMediaElement();
- NS_ENSURE_TRUE_VOID(element);
+ nsIDocument* ownerDoc = owner->GetDocument();
+ NS_ENSURE_TRUE_VOID(ownerDoc);
RefPtr<LayerManager> layerManager =
- nsContentUtils::LayerManagerForDocument(element->OwnerDoc());
+ nsContentUtils::LayerManagerForDocument(ownerDoc);
if (layerManager) {
RefPtr<KnowsCompositor> knowsCompositor = layerManager->AsShadowForwarder();
mCompositorUpdatedEvent.Notify(knowsCompositor);
}
}
void
MediaDecoder::SetElementVisibility(bool aIsDocumentVisible,