diff options
Diffstat (limited to 'dom/media/webspeech/recognition/SpeechRecognition.h')
-rw-r--r-- | dom/media/webspeech/recognition/SpeechRecognition.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/dom/media/webspeech/recognition/SpeechRecognition.h b/dom/media/webspeech/recognition/SpeechRecognition.h index 687f38041e..465cadc8cb 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.h +++ b/dom/media/webspeech/recognition/SpeechRecognition.h @@ -52,7 +52,6 @@ LogModule* GetSpeechRecognitionLog(); class SpeechRecognition final : public DOMEventTargetHelper, public nsIObserver, - public DOMMediaStream::TrackListener, public SupportsWeakPtr { public: explicit SpeechRecognition(nsPIDOMWindowInner* aOwnerWindow); @@ -133,7 +132,24 @@ class SpeechRecognition final : public DOMEventTargetHelper, EVENT_COUNT }; - void NotifyTrackAdded(const RefPtr<MediaStreamTrack>& aTrack) override; + void NotifyTrackAdded(const RefPtr<MediaStreamTrack>& aTrack); + + class TrackListener final : public DOMMediaStream::TrackListener { + public: + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TrackListener, + DOMMediaStream::TrackListener) + explicit TrackListener(SpeechRecognition* aSpeechRecognition) + : mSpeechRecognition(aSpeechRecognition) {} + void NotifyTrackAdded(const RefPtr<MediaStreamTrack>& aTrack) override { + mSpeechRecognition->NotifyTrackAdded(aTrack); + } + + private: + virtual ~TrackListener() = default; + RefPtr<SpeechRecognition> mSpeechRecognition; + }; + // aMessage should be valid UTF-8, but invalid UTF-8 byte sequences are // replaced with the REPLACEMENT CHARACTER on conversion to UTF-16. void DispatchError(EventType aErrorType, @@ -266,6 +282,8 @@ class SpeechRecognition final : public DOMEventTargetHelper, // a conforming implementation. uint32_t mMaxAlternatives; + RefPtr<TrackListener> mListener; + void ProcessTestEventRequest(nsISupports* aSubject, const nsAString& aEventName); |