Have MediaStream::getAudioTracks(), MediaStream::getVideoTracks() return const references
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 May 2015 06:38:50 +0000 (06:38 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 May 2015 06:38:50 +0000 (06:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144794

Reviewed by Philippe Normand.

* Modules/mediastream/MediaStream.h: getAudioTracks() and getVideoTracks()
should return a const reference to the member variables, instead of
copying the objects on every call.

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

Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStream.h

index 2a5dfa9..b6d2260 100644 (file)
@@ -1,3 +1,14 @@
+2015-05-10  Zan Dobersek  <zdobersek@igalia.com>
+
+        Have MediaStream::getAudioTracks(), MediaStream::getVideoTracks() return const references
+        https://bugs.webkit.org/show_bug.cgi?id=144794
+
+        Reviewed by Philippe Normand.
+
+        * Modules/mediastream/MediaStream.h: getAudioTracks() and getVideoTracks()
+        should return a const reference to the member variables, instead of
+        copying the objects on every call.
+
 2015-05-10  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         Use Ref instead of PassRefPtr in WebCore/page
index f458663..d273dae 100644 (file)
@@ -63,8 +63,8 @@ public:
     void removeTrack(PassRefPtr<MediaStreamTrack>, ExceptionCode&);
     MediaStreamTrack* getTrackById(String);
 
-    Vector<RefPtr<MediaStreamTrack>> getAudioTracks() const { return m_audioTracks; }
-    Vector<RefPtr<MediaStreamTrack>> getVideoTracks() const { return m_videoTracks; }
+    const Vector<RefPtr<MediaStreamTrack>>& getAudioTracks() const { return m_audioTracks; }
+    const Vector<RefPtr<MediaStreamTrack>>& getVideoTracks() const { return m_videoTracks; }
     Vector<RefPtr<MediaStreamTrack>> getTracks();
 
     PassRefPtr<MediaStream> clone();