From 542fd87d539e1488b7e98864621255461e0e9183 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 11 Jun 2015 15:55:20 +1000 Subject: [PATCH] Bug 1171330: P9. Remove "Diamond Problem" with MediaDecoder inheritance. r=cpearce --- dom/media/AbstractMediaDecoder.h | 7 ++++++- dom/media/MediaDecoder.h | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dom/media/AbstractMediaDecoder.h b/dom/media/AbstractMediaDecoder.h index 36c0e10ded0..ed2debd12f0 100644 --- a/dom/media/AbstractMediaDecoder.h +++ b/dom/media/AbstractMediaDecoder.h @@ -43,7 +43,7 @@ enum class MediaDecoderEventVisibility : int8_t { * The AbstractMediaDecoder class describes the public interface for a media decoder * and is used by the MediaReader classes. */ -class AbstractMediaDecoder : public nsISupports +class AbstractMediaDecoder : public nsIObserver { public: // Returns the monitor for other threads to synchronise access to @@ -146,6 +146,11 @@ public: AbstractMediaDecoder* mDecoder; }; + // Classes directly inheriting from AbstractMediaDecoder do not support + // Observe and it should never be called directly. + NS_IMETHOD Observe(nsISupports *aSubject, const char * aTopic, const char16_t * aData) override + { MOZ_CRASH("Forbidden method"); return NS_OK; } + #ifdef MOZ_EME virtual nsresult SetCDMProxy(CDMProxy* aProxy) { return NS_ERROR_NOT_IMPLEMENTED; } virtual CDMProxy* GetCDMProxy() { return nullptr; } diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index 9e9a9498371..93ac3a237cd 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -264,8 +264,7 @@ struct SeekTarget { MediaDecoderEventVisibility mEventVisibility; }; -class MediaDecoder : public nsIObserver, - public AbstractMediaDecoder +class MediaDecoder : public AbstractMediaDecoder { public: struct SeekResolveValue {