mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-06-01 05:48:56 +00:00
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:
@@ -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
|
||||
|
||||
@@ -264,8 +264,7 @@ struct SeekTarget {
|
||||
MediaDecoderEventVisibility mEventVisibility;
|
||||
};
|
||||
|
||||
class MediaDecoder : public nsIObserver,
|
||||
public AbstractMediaDecoder
|
||||
class MediaDecoder : public AbstractMediaDecoder
|
||||
{
|
||||
public:
|
||||
struct SeekResolveValue {
|
||||
|
||||
Reference in New Issue
Block a user