Removing MediaStreamTrackVector and MediaStreamSourceVector typedefs
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Nov 2013 02:13:19 +0000 (02:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Nov 2013 02:13:19 +0000 (02:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123648

Patch by Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> on 2013-11-01
Reviewed by Eric Carlson.

Source/WebCore:

No new tests needed.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::create):
(WebCore::MediaStream::clone):
(WebCore::MediaStream::cloneMediaStreamTrackVector):
(WebCore::MediaStream::addTrack):
(WebCore::MediaStream::removeTrack):
(WebCore::MediaStream::haveTrackWithSource):
(WebCore::MediaStream::getTrackById):
(WebCore::MediaStream::trackVectorForType):
* Modules/mediastream/MediaStream.h:
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::callSuccessHandler):
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::createMediaStreamSource):
* Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
(WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):
* platform/mediastream/MediaStreamDescriptor.cpp:
(WebCore::MediaStreamDescriptor::create):
(WebCore::MediaStreamDescriptor::MediaStreamDescriptor):
* platform/mediastream/MediaStreamDescriptor.h:
* platform/mediastream/MediaStreamSource.h:

Source/WebKit/blackberry:

* WebCoreSupport/UserMediaClientImpl.cpp:
(WebCore::toMediaStreamDescriptor):
(WebCore::UserMediaClientImpl::requestUserMedia):
* WebCoreSupport/UserMediaClientImpl.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158480 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/MediaStream.h
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
Source/WebCore/Modules/webaudio/AudioContext.cpp
Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp
Source/WebCore/platform/mediastream/MediaStreamDescriptor.cpp
Source/WebCore/platform/mediastream/MediaStreamDescriptor.h
Source/WebCore/platform/mediastream/MediaStreamSource.h
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.cpp
Source/WebKit/blackberry/WebCoreSupport/UserMediaClientImpl.h

index 4c601fa..64459de 100644 (file)
@@ -1,3 +1,35 @@
+2013-11-01  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
+
+        Removing MediaStreamTrackVector and MediaStreamSourceVector typedefs
+        https://bugs.webkit.org/show_bug.cgi?id=123648
+
+        Reviewed by Eric Carlson.
+
+        No new tests needed.
+
+        * Modules/mediastream/MediaStream.cpp:
+        (WebCore::MediaStream::create):
+        (WebCore::MediaStream::clone):
+        (WebCore::MediaStream::cloneMediaStreamTrackVector):
+        (WebCore::MediaStream::addTrack):
+        (WebCore::MediaStream::removeTrack):
+        (WebCore::MediaStream::haveTrackWithSource):
+        (WebCore::MediaStream::getTrackById):
+        (WebCore::MediaStream::trackVectorForType):
+        * Modules/mediastream/MediaStream.h:
+        * Modules/mediastream/MediaStreamTrack.h:
+        * Modules/mediastream/UserMediaRequest.cpp:
+        (WebCore::UserMediaRequest::callSuccessHandler):
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::createMediaStreamSource):
+        * Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
+        (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):
+        * platform/mediastream/MediaStreamDescriptor.cpp:
+        (WebCore::MediaStreamDescriptor::create):
+        (WebCore::MediaStreamDescriptor::MediaStreamDescriptor):
+        * platform/mediastream/MediaStreamDescriptor.h:
+        * platform/mediastream/MediaStreamSource.h:
+
 2013-11-01  Andreas Kling  <akling@apple.com>
 
         createFontFaceValue() should be smarter about overgrown cache.
index 42540cf..8a6bbbb 100644 (file)
@@ -43,7 +43,7 @@ namespace WebCore {
 
 PassRefPtr<MediaStream> MediaStream::create(ScriptExecutionContext& context)
 {
-    return MediaStream::create(context, MediaStreamDescriptor::create(MediaStreamSourceVector(), MediaStreamSourceVector()));
+    return MediaStream::create(context, MediaStreamDescriptor::create(Vector<RefPtr<MediaStreamSource>>(), Vector<RefPtr<MediaStreamSource>>()));
 }
 
 PassRefPtr<MediaStream> MediaStream::create(ScriptExecutionContext& context, PassRefPtr<MediaStream> stream)
@@ -62,7 +62,7 @@ PassRefPtr<MediaStream> MediaStream::create(ScriptExecutionContext& context, Pas
     return MediaStream::create(context, MediaStreamDescriptor::create(audioTracks, videoTracks));
 }
 
-PassRefPtr<MediaStream> MediaStream::create(ScriptExecutionContext& context, const MediaStreamTrackVector& tracks)
+PassRefPtr<MediaStream> MediaStream::create(ScriptExecutionContext& context, const Vector<RefPtr<MediaStreamTrack>>& tracks)
 {
     Vector<RefPtr<MediaStreamTrackPrivate>> audioTracks;
     Vector<RefPtr<MediaStreamTrackPrivate>> videoTracks;
@@ -127,17 +127,17 @@ void MediaStream::setEnded()
 
 PassRefPtr<MediaStream> MediaStream::clone()
 {
-    MediaStreamTrackVector trackSet;
+    Vector<RefPtr<MediaStreamTrack>> trackSet;
 
     cloneMediaStreamTrackVector(trackSet, getAudioTracks());
     cloneMediaStreamTrackVector(trackSet, getVideoTracks());
     return MediaStream::create(*scriptExecutionContext(), trackSet);
 }
 
-void MediaStream::cloneMediaStreamTrackVector(MediaStreamTrackVector& destination, const MediaStreamTrackVector& origin)
+void MediaStream::cloneMediaStreamTrackVector(Vector<RefPtr<MediaStreamTrack>>& destination, const Vector<RefPtr<MediaStreamTrack>>& source)
 {
-    for (unsigned i = 0; i < origin.size(); i++)
-        destination.append(origin[i]->clone());
+    for (unsigned i = 0; i < source.size(); i++)
+        destination.append(source[i]->clone());
 }
 
 void MediaStream::addTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionCode& ec)
@@ -163,7 +163,7 @@ bool MediaStream::addTrack(PassRefPtr<MediaStreamTrack> prpTrack)
     if (getTrackById(track->id()))
         return false;
 
-    MediaStreamTrackVector* tracks = trackVectorForType(track->source()->type());
+    Vector<RefPtr<MediaStreamTrack>>* tracks = trackVectorForType(track->source()->type());
 
     tracks->append(track);
     track->addObserver(this);
@@ -191,7 +191,7 @@ bool MediaStream::removeTrack(PassRefPtr<MediaStreamTrack> prpTrack)
     // This is a common part used by removeTrack called by JavaScript
     // and removeRemoteTrack and only removeRemoteTrack must fire removetrack event
     RefPtr<MediaStreamTrack> track = prpTrack;
-    MediaStreamTrackVector* tracks = trackVectorForType(track->source()->type());
+    Vector<RefPtr<MediaStreamTrack>>* tracks = trackVectorForType(track->source()->type());
 
     size_t pos = tracks->find(track);
     if (pos == notFound)
@@ -216,14 +216,14 @@ bool MediaStream::removeTrack(PassRefPtr<MediaStreamTrack> prpTrack)
 bool MediaStream::haveTrackWithSource(PassRefPtr<MediaStreamSource> source)
 {
     if (source->type() == MediaStreamSource::Audio) {
-        for (MediaStreamTrackVector::iterator iter = m_audioTracks.begin(); iter != m_audioTracks.end(); ++iter) {
+        for (auto iter = m_audioTracks.begin(); iter != m_audioTracks.end(); ++iter) {
             if ((*iter)->source() == source.get())
                 return true;
         }
         return false;
     }
 
-    for (MediaStreamTrackVector::iterator iter = m_videoTracks.begin(); iter != m_videoTracks.end(); ++iter) {
+    for (auto iter = m_videoTracks.begin(); iter != m_videoTracks.end(); ++iter) {
         if ((*iter)->source() == source.get())
             return true;
     }
@@ -233,12 +233,12 @@ bool MediaStream::haveTrackWithSource(PassRefPtr<MediaStreamSource> source)
 
 MediaStreamTrack* MediaStream::getTrackById(String id)
 {
-    for (MediaStreamTrackVector::iterator iter = m_audioTracks.begin(); iter != m_audioTracks.end(); ++iter) {
+    for (auto iter = m_audioTracks.begin(); iter != m_audioTracks.end(); ++iter) {
         if ((*iter)->id() == id)
             return (*iter).get();
     }
 
-    for (MediaStreamTrackVector::iterator iter = m_videoTracks.begin(); iter != m_videoTracks.end(); ++iter) {
+    for (auto iter = m_videoTracks.begin(); iter != m_videoTracks.end(); ++iter) {
         if ((*iter)->id() == id)
             return (*iter).get();
     }
@@ -362,7 +362,7 @@ URLRegistry& MediaStream::registry() const
     return MediaStreamRegistry::registry();
 }
 
-MediaStreamTrackVector* MediaStream::trackVectorForType(MediaStreamSource::Type type)
+Vector<RefPtr<MediaStreamTrack>>* MediaStream::trackVectorForType(MediaStreamSource::Type type)
 {
     switch (type) {
     case MediaStreamSource::Audio:
index 3d674c5..196af56 100644 (file)
@@ -48,7 +48,7 @@ class MediaStream FINAL : public RefCounted<MediaStream>, public URLRegistrable,
 public:
     static PassRefPtr<MediaStream> create(ScriptExecutionContext&);
     static PassRefPtr<MediaStream> create(ScriptExecutionContext&, PassRefPtr<MediaStream>);
-    static PassRefPtr<MediaStream> create(ScriptExecutionContext&, const MediaStreamTrackVector&);
+    static PassRefPtr<MediaStream> create(ScriptExecutionContext&, const Vector<RefPtr<MediaStreamTrack>>&);
     static PassRefPtr<MediaStream> create(ScriptExecutionContext&, PassRefPtr<MediaStreamDescriptor>);
     virtual ~MediaStream();
 
@@ -58,8 +58,8 @@ public:
     void removeTrack(PassRefPtr<MediaStreamTrack>, ExceptionCode&);
     MediaStreamTrack* getTrackById(String);
 
-    MediaStreamTrackVector getAudioTracks() const { return m_audioTracks; }
-    MediaStreamTrackVector getVideoTracks() const { return m_videoTracks; }
+    Vector<RefPtr<MediaStreamTrack>> getAudioTracks() const { return m_audioTracks; }
+    Vector<RefPtr<MediaStreamTrack>> getVideoTracks() const { return m_videoTracks; }
 
     bool ended() const;
     void setEnded();
@@ -108,13 +108,13 @@ private:
     void scheduleDispatchEvent(PassRefPtr<Event>);
     void scheduledEventTimerFired(Timer<MediaStream>*);
 
-    void cloneMediaStreamTrackVector(MediaStreamTrackVector&, const MediaStreamTrackVector&);
+    void cloneMediaStreamTrackVector(Vector<RefPtr<MediaStreamTrack>>&, const Vector<RefPtr<MediaStreamTrack>>&);
 
-    MediaStreamTrackVector* trackVectorForType(MediaStreamSource::Type);
+    Vector<RefPtr<MediaStreamTrack>>* trackVectorForType(MediaStreamSource::Type);
 
     RefPtr<MediaStreamDescriptor> m_descriptor;
-    MediaStreamTrackVector m_audioTracks;
-    MediaStreamTrackVector m_videoTracks;
+    Vector<RefPtr<MediaStreamTrack>> m_audioTracks;
+    Vector<RefPtr<MediaStreamTrack>> m_videoTracks;
 
     Timer<MediaStream> m_scheduledEventTimer;
     Vector<RefPtr<Event>> m_scheduledEvents;
index 9203a07..eac58b9 100644 (file)
@@ -142,8 +142,6 @@ private:
     bool m_stoppingTrack;
 };
 
-typedef Vector<RefPtr<MediaStreamTrack>> MediaStreamTrackVector;
-
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)
index fe3469b..f59866c 100644 (file)
@@ -165,12 +165,12 @@ void UserMediaRequest::callSuccessHandler(PassRefPtr<MediaStreamDescriptor> stre
 
     RefPtr<MediaStream> stream = MediaStream::create(*m_scriptExecutionContext, streamDescriptor);
 
-    MediaStreamTrackVector tracks = stream->getAudioTracks();
-    for (MediaStreamTrackVector::iterator iter = tracks.begin(); iter != tracks.end(); ++iter)
+    Vector<RefPtr<MediaStreamTrack>> tracks = stream->getAudioTracks();
+    for (auto iter = tracks.begin(); iter != tracks.end(); ++iter)
         (*iter)->applyConstraints(m_audioConstraints);
 
     tracks = stream->getVideoTracks();
-    for (MediaStreamTrackVector::iterator iter = tracks.begin(); iter != tracks.end(); ++iter)
+    for (auto iter = tracks.begin(); iter != tracks.end(); ++iter)
         (*iter)->applyConstraints(m_videoConstraints);
 
     m_successCallback->handleEvent(stream.get());
index e2d1947..6598889 100644 (file)
@@ -416,7 +416,7 @@ PassRefPtr<MediaStreamAudioSourceNode> AudioContext::createMediaStreamSource(Med
 
     AudioSourceProvider* provider = 0;
 
-    MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks();
+    Vector<RefPtr<MediaStreamTrack>> audioTracks = mediaStream->getAudioTracks();
     // FIXME: get a provider for non-local MediaStreams (like from a remote peer).
     for (size_t i = 0; i < audioTracks.size(); ++i) {
         RefPtr<MediaStreamTrack> localAudio = audioTracks[i];
index ca838aa..5bffa52 100644 (file)
@@ -49,9 +49,9 @@ MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* c
     setNodeType(NodeTypeMediaStreamAudioDestination);
 
     m_source = MediaStreamAudioSource::create();
-    MediaStreamSourceVector audioSources;
+    Vector<RefPtr<MediaStreamSource>> audioSources;
     audioSources.append(m_source);
-    m_stream = MediaStream::create(*context->scriptExecutionContext(), MediaStreamDescriptor::create(audioSources, MediaStreamSourceVector()));
+    m_stream = MediaStream::create(*context->scriptExecutionContext(), MediaStreamDescriptor::create(audioSources, Vector<RefPtr<MediaStreamSource>>()));
 
     m_source->setAudioFormat(numberOfChannels, context->sampleRate());
 
index 92f9b6d..0566268 100644 (file)
@@ -42,7 +42,7 @@
 
 namespace WebCore {
 
-PassRefPtr<MediaStreamDescriptor> MediaStreamDescriptor::create(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
+PassRefPtr<MediaStreamDescriptor> MediaStreamDescriptor::create(const Vector<RefPtr<MediaStreamSource>>& audioSources, const Vector<RefPtr<MediaStreamSource>>& videoSources)
 {
     return adoptRef(new MediaStreamDescriptor(createCanonicalUUIDString(), audioSources, videoSources));
 }
@@ -123,7 +123,7 @@ void MediaStreamDescriptor::removeRemoteTrack(MediaStreamTrackPrivate* track)
         removeTrack(track);
 }
 
-MediaStreamDescriptor::MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources)
+MediaStreamDescriptor::MediaStreamDescriptor(const String& id, const Vector<RefPtr<MediaStreamSource>>& audioSources, const Vector<RefPtr<MediaStreamSource>>& videoSources)
     : m_client(0)
     , m_id(id)
     , m_ended(false)
index dd0c481..32081f5 100644 (file)
@@ -57,7 +57,7 @@ public:
 
 class MediaStreamDescriptor : public RefCounted<MediaStreamDescriptor> {
 public:
-    static PassRefPtr<MediaStreamDescriptor> create(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
+    static PassRefPtr<MediaStreamDescriptor> create(const Vector<RefPtr<MediaStreamSource>>& audioSources, const Vector<RefPtr<MediaStreamSource>>& videoSources);
     static PassRefPtr<MediaStreamDescriptor> create(const Vector<RefPtr<MediaStreamTrackPrivate>>& audioPrivateTracks, const Vector<RefPtr<MediaStreamTrackPrivate>>& videoPrivateTracks);
 
     virtual ~MediaStreamDescriptor() { }
@@ -95,13 +95,13 @@ public:
     void removeRemoteTrack(MediaStreamTrackPrivate*);
 
 private:
-    MediaStreamDescriptor(const String& id, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
+    MediaStreamDescriptor(const String& id, const Vector<RefPtr<MediaStreamSource>>& audioSources, const Vector<RefPtr<MediaStreamSource>>& videoSources);
     MediaStreamDescriptor(const String& id, const Vector<RefPtr<MediaStreamTrackPrivate>>& audioPrivateTracks, const Vector<RefPtr<MediaStreamTrackPrivate>>& videoPrivateTracks);
 
     MediaStreamDescriptorClient* m_client;
     String m_id;
-    MediaStreamSourceVector m_audioStreamSources;
-    MediaStreamSourceVector m_videoStreamSources;
+    Vector<RefPtr<MediaStreamSource>> m_audioStreamSources;
+    Vector<RefPtr<MediaStreamSource>> m_videoStreamSources;
 
     Vector<RefPtr<MediaStreamTrackPrivate>> m_audioPrivateTracks;
     Vector<RefPtr<MediaStreamTrackPrivate>> m_videoPrivateTracks;
index 5ca2e60..6966a3b 100644 (file)
@@ -122,8 +122,6 @@ private:
     bool m_remote;
 };
 
-typedef Vector<RefPtr<MediaStreamSource>> MediaStreamSourceVector;
-
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)
index 09e165b..d5fa49f 100644 (file)
@@ -1,3 +1,15 @@
+2013-11-01  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
+
+        Removing MediaStreamTrackVector and MediaStreamSourceVector typedefs
+        https://bugs.webkit.org/show_bug.cgi?id=123648
+
+        Reviewed by Eric Carlson.
+
+        * WebCoreSupport/UserMediaClientImpl.cpp:
+        (WebCore::toMediaStreamDescriptor):
+        (WebCore::UserMediaClientImpl::requestUserMedia):
+        * WebCoreSupport/UserMediaClientImpl.h:
+
 2013-10-31  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Remove InspectorState
index 67f2379..f811ac2 100644 (file)
@@ -55,13 +55,13 @@ static PassRefPtr<MediaStreamSource> toMediaStreamSource(const WebMediaStreamSou
 
 static PassRefPtr<MediaStreamDescriptor> toMediaStreamDescriptor(const WebMediaStreamDescriptor& d)
 {
-    MediaStreamSourceVector audioSources;
+    Vector<RefPtr<MediaStreamSource>> audioSources;
     for (size_t i = 0; i < d.audios().size(); i++) {
         RefPtr<MediaStreamSource> src = toMediaStreamSource(d.audios()[i]);
         audioSources.append(src.release());
     }
 
-    MediaStreamSourceVector videoSources;
+    Vector<RefPtr<MediaStreamSource>> videoSources;
     for (size_t i = 0; i < d.videos().size(); i++) {
         RefPtr<MediaStreamSource> src = toMediaStreamSource(d.videos()[i]);
         videoSources.append(src.release());
@@ -113,7 +113,7 @@ void UserMediaClientImpl::pageDestroyed()
     delete this;
 }
 
-void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> prpRequest, const MediaStreamSourceVector&, const MediaStreamSourceVector&)
+void UserMediaClientImpl::requestUserMedia(PassRefPtr<UserMediaRequest> prpRequest, const Vector<RefPtr<MediaStreamSource>>&, const Vector<RefPtr<MediaStreamSource>>&)
 {
     UserMediaRequest* request = prpRequest.get();
     OwnPtr<WebUserMediaRequestClientImpl> requestClient = adoptPtr(new WebUserMediaRequestClientImpl(prpRequest));
index f76cb3d..7bc1168 100644 (file)
@@ -42,7 +42,7 @@ public:
     ~UserMediaClientImpl();
 
     void pageDestroyed();
-    void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector& audioSources, const WebCore::MediaStreamSourceVector& videoSources);
+    void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const Vector<RefPtr<WebCore::MediaStreamSource>>& audioSources, const Vector<RefPtr<WebCore::MediaStreamSource>>& videoSources);
     void cancelUserMediaRequest(WebCore::UserMediaRequest*);
 
 private: