Remove "Diamond Problem" with MediaDecoder inheritance

MediaDecoder inherited from nsIObserver which inherits from nsISupport while also inheriting from AbstractMediaDecoder which itself inherits from nsISupport. This causes a "diamond problem", and prevents using some utility classes like NS_ProxyRelease or nsMainThreadPtrHandle. MediaDecoder will assert if destructed on anything but the main thread.
This commit is contained in:
trav90
2017-05-04 02:26:52 -05:00
committed by roytam1
parent 3ad0c796f5
commit 23c5c4b2da
2 changed files with 6 additions and 3 deletions
+5 -1
View File
@@ -41,7 +41,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
@@ -150,6 +150,10 @@ 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; }
};
class MetadataContainer
+1 -2
View File
@@ -264,8 +264,7 @@ struct SeekTarget {
MediaDecoderEventVisibility mEventVisibility;
};
class MediaDecoder : public nsIObserver,
public AbstractMediaDecoder
class MediaDecoder : public AbstractMediaDecoder
{
public:
struct SeekResolveValue {