Remove "virtual" from all lines that have both "virtual" and "override".
[WebKit-https.git] / Source / WebCore / Modules / mediastream / MediaStreamTrack.h
index 427a998..679e677 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2011 Ericsson AB. All rights reserved.
+ * Copyright (C) 2011, 2015 Ericsson AB. All rights reserved.
  * Copyright (C) 2013 Apple Inc. All rights reserved.
  * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
  *
@@ -32,8 +32,8 @@
 
 #include "ActiveDOMObject.h"
 #include "EventTarget.h"
-#include "MediaStreamSource.h"
 #include "MediaStreamTrackPrivate.h"
+#include "RealtimeMediaSource.h"
 #include "ScriptWrappable.h"
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
 
+class AudioSourceProvider;
 class Dictionary;
 class MediaConstraintsImpl;
-class MediaSourceStates;
-class MediaStreamTrackSourcesCallback;
-class MediaStreamCapabilities;
+class MediaSourceSettings;
 class MediaTrackConstraints;
 
-class MediaStreamTrack : public RefCounted<MediaStreamTrack>, public ScriptWrappable, public ActiveDOMObject, public EventTargetWithInlineData, public MediaStreamTrackPrivateClient {
+class MediaStreamTrack final : public RefCounted<MediaStreamTrack>, public ActiveDOMObject, public EventTargetWithInlineData, public MediaStreamTrackPrivate::Observer {
 public:
     class Observer {
     public:
@@ -57,9 +56,10 @@ public:
         virtual void trackDidEnd() = 0;
     };
 
+    static Ref<MediaStreamTrack> create(ScriptExecutionContext&, MediaStreamTrackPrivate&);
     virtual ~MediaStreamTrack();
 
-    virtual const AtomicString& kind() const = 0;
+    const AtomicString& kind() const;
     const String& id() const;
     const String& label() const;
 
@@ -69,79 +69,66 @@ public:
     bool muted() const;
     bool readonly() const;
     bool remote() const;
-    bool stopped() const;
 
     const AtomicString& readyState() const;
 
-    static void getSources(ScriptExecutionContext*, PassRefPtr<MediaStreamTrackSourcesCallback>, ExceptionCode&);
-
-    RefPtr<MediaTrackConstraints> getConstraints() const;
-    RefPtr<MediaSourceStates> states() const;
-    RefPtr<MediaStreamCapabilities> getCapabilities() const;
-    void applyConstraints(const Dictionary&);
-    void applyConstraints(PassRefPtr<MediaConstraints>);
+    bool ended() const;
 
     RefPtr<MediaStreamTrack> clone();
     void stopProducingData();
 
-    DEFINE_ATTRIBUTE_EVENT_LISTENER(mute);
-    DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute);
-    DEFINE_ATTRIBUTE_EVENT_LISTENER(started);
-    DEFINE_ATTRIBUTE_EVENT_LISTENER(ended);
-    DEFINE_ATTRIBUTE_EVENT_LISTENER(overconstrained);
+    RefPtr<MediaTrackConstraints> getConstraints() const;
+    RefPtr<MediaSourceSettings> getSettings() const;
+    RefPtr<RealtimeMediaSourceCapabilities> getCapabilities() const;
+    void applyConstraints(const Dictionary&);
+    void applyConstraints(const MediaConstraints&);
 
-    MediaStreamSource* source() const { return m_privateTrack->source(); }
-    MediaStreamTrackPrivate& privateTrack() { return m_privateTrack.get(); }
+    RealtimeMediaSource& source() const { return m_private->source(); }
+    MediaStreamTrackPrivate& privateTrack() { return m_private.get(); }
 
-    bool ended() const;
+    AudioSourceProvider* audioSourceProvider();
 
     void addObserver(Observer*);
     void removeObserver(Observer*);
 
     // EventTarget
-    virtual EventTargetInterface eventTargetInterface() const override final { return MediaStreamTrackEventTargetInterfaceType; }
-    virtual ScriptExecutionContext* scriptExecutionContext() const override final { return ActiveDOMObject::scriptExecutionContext(); }
+    EventTargetInterface eventTargetInterface() const override final { return MediaStreamTrackEventTargetInterfaceType; }
+    ScriptExecutionContext* scriptExecutionContext() const override final { return ActiveDOMObject::scriptExecutionContext(); }
 
     using RefCounted<MediaStreamTrack>::ref;
     using RefCounted<MediaStreamTrack>::deref;
 
-protected:
-    explicit MediaStreamTrack(MediaStreamTrack&);
-    MediaStreamTrack(ScriptExecutionContext&, MediaStreamTrackPrivate&, const Dictionary*);
-
-    void setSource(PassRefPtr<MediaStreamSource>);
-
 private:
+    MediaStreamTrack(ScriptExecutionContext&, MediaStreamTrackPrivate&);
+    explicit MediaStreamTrack(MediaStreamTrack&);
 
     void configureTrackRendering();
-    void trackDidEnd();
-    void scheduleEventDispatch(PassRefPtr<Event>);
 
-    // ActiveDOMObject
-    virtual void stop() override final;
+    // ActiveDOMObject API.
+    void stop() override final;
+    const char* activeDOMObjectName() const override final;
+    bool canSuspendForDocumentSuspension() const override final;
 
     // EventTarget
-    virtual void refEventTarget() override final { ref(); }
-    virtual void derefEventTarget() override final { deref(); }
-
-    // MediaStreamTrackPrivateClient
-    void trackReadyStateChanged();
-    void trackMutedChanged();
-    void trackEnabledChanged();
+    void refEventTarget() override final { ref(); }
+    void derefEventTarget() override final { deref(); }
 
-    Vector<RefPtr<Event>> m_scheduledEvents;
-
-    RefPtr<MediaConstraintsImpl> m_constraints;
-    Mutex m_mutex;
+    // MediaStreamTrackPrivate::Observer
+    void trackEnded(MediaStreamTrackPrivate&) override;
+    void trackMutedChanged(MediaStreamTrackPrivate&) override;
+    void trackSettingsChanged(MediaStreamTrackPrivate&) override;
+    void trackEnabledChanged(MediaStreamTrackPrivate&) override;
 
     Vector<Observer*> m_observers;
+    Ref<MediaStreamTrackPrivate> m_private;
 
-    Ref<MediaStreamTrackPrivate> m_privateTrack;
-    bool m_eventDispatchScheduled;
+    RefPtr<MediaConstraintsImpl> m_constraints;
 
-    bool m_stoppingTrack;
+    bool m_ended { false };
 };
 
+typedef Vector<RefPtr<MediaStreamTrack>> MediaStreamTrackVector;
+
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)