#457: M1419363 + WeakPtr support from M1267918

This commit is contained in:
Cameron Kaiser 2018-01-15 15:29:43 -08:00
parent f1e53a0c01
commit ec2be8cb3f
2 changed files with 8 additions and 2 deletions

View File

@ -3110,11 +3110,13 @@ public:
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
if (MOZ_UNLIKELY(!mElement)) return; // bug 1419363
mElement->NotifyMediaStreamTracksAvailable(aStream);
}
private:
HTMLMediaElement* mElement;
WeakPtr<HTMLMediaElement> mElement;
};
class HTMLMediaElement::MediaStreamTrackListener :

View File

@ -18,6 +18,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/TextTrackManager.h"
#include "mozilla/WeakPtr.h"
#include "MediaDecoder.h"
#ifdef MOZ_EME
#include "mozilla/dom/MediaKeys.h"
@ -76,7 +77,8 @@ class HTMLMediaElement : public nsGenericHTMLElement,
public nsIDOMHTMLMediaElement,
public nsIObserver,
public MediaDecoderOwner,
public nsIAudioChannelAgentCallback
public nsIAudioChannelAgentCallback,
public SupportsWeakPtr<HTMLMediaElement>
{
friend AutoNotifyAudioChannelAgent;
@ -89,6 +91,8 @@ public:
typedef mozilla::MediaDecoderOwner MediaDecoderOwner;
typedef mozilla::MetadataTags MetadataTags;
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(HTMLMediaElement)
CORSMode GetCORSMode() {
return mCORSMode;
}