Title: [141871] trunk
Revision
141871
Author
[email protected]
Date
2013-02-05 01:10:59 -0800 (Tue, 05 Feb 2013)

Log Message

MediaStream API: Update RTCPeerConnections stream accessors to match the latest specification
https://bugs.webkit.org/show_bug.cgi?id=108179

Reviewed by Adam Barth.

Source/WebCore:

http://dev.w3.org/2011/webrtc/editor/webrtc.html#interface-definition
The attributes localStreams and remoteStreams have been changes to the methods
getLocalStreams() and getRemoteStreams() which return a native array instead.

Existing tests updated to cover patch.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Modules/mediastream/MediaStream.h:
(WebCore):
* Modules/mediastream/MediaStreamList.cpp: Removed.
* Modules/mediastream/MediaStreamList.h: Removed.
* Modules/mediastream/MediaStreamList.idl: Removed.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::RTCPeerConnection):
(WebCore::RTCPeerConnection::addStream):
(WebCore::RTCPeerConnection::removeStream):
(WebCore::RTCPeerConnection::getLocalStreams):
(WebCore::RTCPeerConnection::getRemoteStreams):
(WebCore::RTCPeerConnection::didAddRemoteStream):
(WebCore::RTCPeerConnection::didRemoveRemoteStream):
* Modules/mediastream/RTCPeerConnection.h:
(RTCPeerConnection):
* Modules/mediastream/RTCPeerConnection.idl:
* WebCore.gypi:

LayoutTests:

Updating tests for RTCPeerConnections new stream accessors.

* fast/mediastream/RTCPeerConnection-AddRemoveStream-expected.txt:
* fast/mediastream/RTCPeerConnection-AddRemoveStream.html:
* fast/mediastream/RTCPeerConnection-statsSelector-expected.txt:
* fast/mediastream/RTCPeerConnection-statsSelector.html:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (141870 => 141871)


--- trunk/LayoutTests/ChangeLog	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/LayoutTests/ChangeLog	2013-02-05 09:10:59 UTC (rev 141871)
@@ -1,3 +1,17 @@
+2013-02-05  Tommy Widenflycht  <[email protected]>
+
+        MediaStream API: Update RTCPeerConnections stream accessors to match the latest specification
+        https://bugs.webkit.org/show_bug.cgi?id=108179
+
+        Reviewed by Adam Barth.
+
+        Updating tests for RTCPeerConnections new stream accessors.
+
+        * fast/mediastream/RTCPeerConnection-AddRemoveStream-expected.txt:
+        * fast/mediastream/RTCPeerConnection-AddRemoveStream.html:
+        * fast/mediastream/RTCPeerConnection-statsSelector-expected.txt:
+        * fast/mediastream/RTCPeerConnection-statsSelector.html:
+
 2013-02-05  Shinya Kawanaka  <[email protected]>
 
         touch-event.html should check touchstartFiredInShadowDOM is true.

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream-expected.txt (141870 => 141871)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream-expected.txt	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream-expected.txt	2013-02-05 09:10:59 UTC (rev 141871)
@@ -4,8 +4,12 @@
 
 
 PASS Got a stream.
+PASS Got another stream.
 PASS onAddStream was called.
+PASS pc.getLocalStreams().length is 1
+PASS pc.getLocalStreams().length is 1
 PASS onRemoveStream was called.
+PASS pc.getLocalStreams().length is 0
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream.html (141870 => 141871)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream.html	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-AddRemoveStream.html	2013-02-05 09:10:59 UTC (rev 141871)
@@ -8,6 +8,7 @@
 description("Tests RTCPeerConnection [add|remove]Stream.");
 
 var stream = null;
+var stream2 = null;
 var pc = null;
 
 function error() {
@@ -24,31 +25,58 @@
     }
 }
 
+function onErroneousRemoveStream() {
+    testFailed('onErroneousRemoveStream was called.');
+    finishJSTest();
+}
+
 function onRemoveStream(event) {
     testPassed('onRemoveStream was called.');
 
+    shouldBe('pc.getLocalStreams().length', '0');
+
     finishJSTest();
 }
 
+function onErroneousAddStream() {
+    testFailed('onErroneousAddStream was called.');
+    finishJSTest();
+}
+
 function onAddStream(event) {
     testPassed('onAddStream was called.');
 
+    pc._onaddstream_ = onErroneousAddStream;
+    pc.addStream(stream);
+    shouldBe('pc.getLocalStreams().length', '1');
+
+    pc._onremovestream_ = onErroneousRemoveStream;
+    pc.removeStream(stream2);
+    shouldBe('pc.getLocalStreams().length', '1');
+
+    pc._onremovestream_ = onRemoveStream;
     pc.removeStream(stream);
 }
 
-function gotStream(s) {
-    testPassed('Got a stream.');
-    stream = s;
+function gotStream2(s) {
+    testPassed('Got another stream.');
+    stream2 = s;
 
     pc = new webkitRTCPeerConnection(null, null);
+
     pc._onaddstream_ = onAddStream;
-    pc._onremovestream_ = onRemoveStream;
-
     pc.addStream(stream);
 }
 
-getUserMedia({audio:true, video:true}, gotStream);
+function gotStream1(s) {
+    testPassed('Got a stream.');
+    stream = s;
 
+    getUserMedia({audio:true, video:true}, gotStream2);
+}
+
+getUserMedia({audio:true, video:true}, gotStream1);
+
 window.jsTestIsAsync = true;
 window.successfullyParsed = true;
 </script>

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-statsSelector-expected.txt (141870 => 141871)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-statsSelector-expected.txt	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-statsSelector-expected.txt	2013-02-05 09:10:59 UTC (rev 141871)
@@ -6,7 +6,7 @@
 PASS pc = new webkitRTCPeerConnection(null) did not throw exception.
 PASS getUserMedia({audio:true, video:true}, gotStream) did not throw exception.
 PASS Got a stream.
-PASS pc.getStats(statsHandler2, pc.localStreams[0].getVideoTracks()[0]) did not throw exception.
+PASS pc.getStats(statsHandler2, pc.getLocalStreams()[0].getVideoTracks()[0]) did not throw exception.
 PASS statsHandler2 was called
 PASS result.length is >= 1
 PASS timestamp is >= startTime

Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-statsSelector.html (141870 => 141871)


--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-statsSelector.html	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-statsSelector.html	2013-02-05 09:10:59 UTC (rev 141871)
@@ -31,7 +31,7 @@
     stream = s;
 
     pc.addStream(stream);
-    shouldNotThrow('pc.getStats(statsHandler2, pc.localStreams[0].getVideoTracks()[0])');
+    shouldNotThrow('pc.getStats(statsHandler2, pc.getLocalStreams()[0].getVideoTracks()[0])');
 }
 
 function statsHandler2(status)

Modified: trunk/Source/WebCore/CMakeLists.txt (141870 => 141871)


--- trunk/Source/WebCore/CMakeLists.txt	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/CMakeLists.txt	2013-02-05 09:10:59 UTC (rev 141871)
@@ -216,7 +216,6 @@
     Modules/mediastream/LocalMediaStream.idl
     Modules/mediastream/MediaStream.idl
     Modules/mediastream/MediaStreamEvent.idl
-    Modules/mediastream/MediaStreamList.idl
     Modules/mediastream/MediaStreamTrack.idl
     Modules/mediastream/MediaStreamTrackEvent.idl
     Modules/mediastream/NavigatorMediaStream.idl
@@ -860,7 +859,6 @@
     Modules/mediastream/MediaConstraintsImpl.cpp
     Modules/mediastream/MediaStream.cpp
     Modules/mediastream/MediaStreamEvent.cpp
-    Modules/mediastream/MediaStreamList.cpp
     Modules/mediastream/MediaStreamRegistry.cpp
     Modules/mediastream/MediaStreamTrack.cpp
     Modules/mediastream/MediaStreamTrackEvent.cpp

Modified: trunk/Source/WebCore/ChangeLog (141870 => 141871)


--- trunk/Source/WebCore/ChangeLog	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/ChangeLog	2013-02-05 09:10:59 UTC (rev 141871)
@@ -1,3 +1,36 @@
+2013-02-05  Tommy Widenflycht  <[email protected]>
+
+        MediaStream API: Update RTCPeerConnections stream accessors to match the latest specification
+        https://bugs.webkit.org/show_bug.cgi?id=108179
+
+        Reviewed by Adam Barth.
+
+        http://dev.w3.org/2011/webrtc/editor/webrtc.html#interface-definition
+        The attributes localStreams and remoteStreams have been changes to the methods
+        getLocalStreams() and getRemoteStreams() which return a native array instead.
+
+        Existing tests updated to cover patch.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Modules/mediastream/MediaStream.h:
+        (WebCore):
+        * Modules/mediastream/MediaStreamList.cpp: Removed.
+        * Modules/mediastream/MediaStreamList.h: Removed.
+        * Modules/mediastream/MediaStreamList.idl: Removed.
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::RTCPeerConnection):
+        (WebCore::RTCPeerConnection::addStream):
+        (WebCore::RTCPeerConnection::removeStream):
+        (WebCore::RTCPeerConnection::getLocalStreams):
+        (WebCore::RTCPeerConnection::getRemoteStreams):
+        (WebCore::RTCPeerConnection::didAddRemoteStream):
+        (WebCore::RTCPeerConnection::didRemoveRemoteStream):
+        * Modules/mediastream/RTCPeerConnection.h:
+        (RTCPeerConnection):
+        * Modules/mediastream/RTCPeerConnection.idl:
+        * WebCore.gypi:
+
 2013-02-05  Viatcheslav Ostapenko  <[email protected]>
 
         [Qt][EFL][WebGL] Webgl doesn't work on nvidia cards

Modified: trunk/Source/WebCore/GNUmakefile.list.am (141870 => 141871)


--- trunk/Source/WebCore/GNUmakefile.list.am	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2013-02-05 09:10:59 UTC (rev 141871)
@@ -515,8 +515,6 @@
 	DerivedSources/WebCore/JSMediaStreamAudioSourceNode.h \
 	DerivedSources/WebCore/JSMediaStreamEvent.cpp \
 	DerivedSources/WebCore/JSMediaStreamEvent.h \
-	DerivedSources/WebCore/JSMediaStreamList.cpp \
-	DerivedSources/WebCore/JSMediaStreamList.h \
 	DerivedSources/WebCore/JSMediaStreamTrack.cpp \
 	DerivedSources/WebCore/JSMediaStreamTrack.h \
 	DerivedSources/WebCore/JSMediaStreamTrackEvent.cpp \
@@ -1239,7 +1237,6 @@
 	$(WebCore)/Modules/mediastream/LocalMediaStream.idl \
 	$(WebCore)/Modules/mediastream/MediaStream.idl \
 	$(WebCore)/Modules/mediastream/MediaStreamEvent.idl \
-	$(WebCore)/Modules/mediastream/MediaStreamList.idl \
 	$(WebCore)/Modules/mediastream/MediaStreamTrack.idl \
 	$(WebCore)/Modules/mediastream/MediaStreamTrackEvent.idl \
 	$(WebCore)/Modules/mediastream/NavigatorMediaStream.idl \
@@ -1929,8 +1926,6 @@
 	Source/WebCore/Modules/mediastream/MediaStream.h \
 	Source/WebCore/Modules/mediastream/MediaStreamEvent.cpp \
 	Source/WebCore/Modules/mediastream/MediaStreamEvent.h \
-	Source/WebCore/Modules/mediastream/MediaStreamList.cpp \
-	Source/WebCore/Modules/mediastream/MediaStreamList.h \
 	Source/WebCore/Modules/mediastream/MediaStreamRegistry.cpp \
 	Source/WebCore/Modules/mediastream/MediaStreamRegistry.h \
 	Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp \

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStream.h (141870 => 141871)


--- trunk/Source/WebCore/Modules/mediastream/MediaStream.h	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStream.h	2013-02-05 09:10:59 UTC (rev 141871)
@@ -113,6 +113,8 @@
     Vector<RefPtr<Event> > m_scheduledEvents;
 };
 
+typedef Vector<RefPtr<MediaStream> > MediaStreamVector;
+
 } // namespace WebCore
 
 #endif // ENABLE(MEDIA_STREAM)

Deleted: trunk/Source/WebCore/Modules/mediastream/MediaStreamList.cpp (141870 => 141871)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamList.cpp	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamList.cpp	2013-02-05 09:10:59 UTC (rev 141871)
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- * Copyright (C) 2011 Ericsson AB. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "MediaStreamList.h"
-
-#if ENABLE(MEDIA_STREAM)
-
-namespace WebCore {
-
-PassRefPtr<MediaStreamList> MediaStreamList::create()
-{
-    return adoptRef(new MediaStreamList());
-}
-
-MediaStreamList::MediaStreamList()
-{
-}
-
-MediaStreamList::~MediaStreamList()
-{
-}
-
-unsigned MediaStreamList::length() const
-{
-    return m_streams.size();
-}
-
-MediaStream* MediaStreamList::item(unsigned index) const
-{
-    if (index >= m_streams.size())
-        return 0;
-    return m_streams[index].get();
-}
-
-void MediaStreamList::append(PassRefPtr<MediaStream> stream)
-{
-    m_streams.append(stream);
-}
-
-void MediaStreamList::remove(const MediaStream* stream)
-{
-    size_t i = m_streams.find(stream);
-    if (i != notFound)
-        return m_streams.remove(i);
-}
-
-bool MediaStreamList::contains(const MediaStream* stream) const
-{
-    return m_streams.contains(stream);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)

Deleted: trunk/Source/WebCore/Modules/mediastream/MediaStreamList.h (141870 => 141871)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamList.h	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamList.h	2013-02-05 09:10:59 UTC (rev 141871)
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef MediaStreamList_h
-#define MediaStreamList_h
-
-#if ENABLE(MEDIA_STREAM)
-
-#include "MediaStream.h"
-
-namespace WebCore {
-
-class MediaStreamList : public RefCounted<MediaStreamList> {
-public:
-    static PassRefPtr<MediaStreamList> create();
-    virtual ~MediaStreamList();
-
-    // DOM methods & attributes for MediaStreamList
-    unsigned length() const;
-    MediaStream* item(unsigned index) const;
-
-    // List manipulation
-    void append(PassRefPtr<MediaStream>);
-    void remove(const MediaStream*);
-    bool contains(const MediaStream*) const;
-
-private:
-    MediaStreamList();
-
-    Vector<RefPtr<MediaStream> > m_streams;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(MEDIA_STREAM)
-
-#endif // MediaStreamList_h

Deleted: trunk/Source/WebCore/Modules/mediastream/MediaStreamList.idl (141870 => 141871)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamList.idl	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamList.idl	2013-02-05 09:10:59 UTC (rev 141871)
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-[
-    Conditional=MEDIA_STREAM,
-    IndexedGetter
-] interface MediaStreamList {
-    MediaStream item(in [IsIndex] unsigned long index);
-
-    readonly attribute unsigned long length;
-};
-

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (141870 => 141871)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2013-02-05 09:10:59 UTC (rev 141871)
@@ -134,8 +134,6 @@
     , m_signalingState(SignalingStateStable)
     , m_iceGatheringState(IceGatheringStateNew)
     , m_iceConnectionState(IceConnectionStateStarting)
-    , m_localStreams(MediaStreamList::create())
-    , m_remoteStreams(MediaStreamList::create())
     , m_scheduledEventTimer(this, &RTCPeerConnection::scheduledEventTimerFired)
     , m_stopped(false)
 {
@@ -379,52 +377,55 @@
 
     RefPtr<MediaStream> stream = prpStream;
     if (!stream) {
-        ec =  TYPE_MISMATCH_ERR;
+        ec = TYPE_MISMATCH_ERR;
         return;
     }
 
+    if (m_localStreams.contains(stream))
+        return;
+
     RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaConstraints, ec);
     if (ec)
         return;
 
-    if (m_localStreams->contains(stream.get()))
-        return;
+    m_localStreams.append(stream);
 
-    m_localStreams->append(stream);
-
     bool valid = m_peerHandler->addStream(stream->descriptor(), constraints);
     if (!valid)
         ec = SYNTAX_ERR;
 }
 
-void RTCPeerConnection::removeStream(MediaStream* stream, ExceptionCode& ec)
+void RTCPeerConnection::removeStream(PassRefPtr<MediaStream> prpStream, ExceptionCode& ec)
 {
     if (m_signalingState == SignalingStateClosed) {
         ec = INVALID_STATE_ERR;
         return;
     }
 
-    if (!stream) {
+    if (!prpStream) {
         ec = TYPE_MISMATCH_ERR;
         return;
     }
 
-    if (!m_localStreams->contains(stream))
+    RefPtr<MediaStream> stream = prpStream;
+
+    size_t pos = m_localStreams.find(stream);
+    if (pos == notFound)
         return;
 
-    m_localStreams->remove(stream);
+    m_localStreams.remove(pos);
 
     m_peerHandler->removeStream(stream->descriptor());
 }
 
-MediaStreamList* RTCPeerConnection::localStreams() const
+MediaStreamVector RTCPeerConnection::getLocalStreams() const
 {
-    return m_localStreams.get();
+    return m_localStreams;
 }
 
-MediaStreamList* RTCPeerConnection::remoteStreams() const
+MediaStreamVector RTCPeerConnection::getRemoteStreams() const
 {
-    return m_remoteStreams.get();
+    return m_remoteStreams;
 }
 
 void RTCPeerConnection::getStats(PassRefPtr<RTCStatsCallback> successCallback, PassRefPtr<MediaStreamTrack> selector)
@@ -506,7 +507,7 @@
         return;
 
     RefPtr<MediaStream> stream = MediaStream::create(scriptExecutionContext(), streamDescriptor);
-    m_remoteStreams->append(stream);
+    m_remoteStreams.append(stream);
 
     scheduleDispatchEvent(MediaStreamEvent::create(eventNames().addstreamEvent, false, false, stream.release()));
 }
@@ -522,8 +523,9 @@
     if (m_signalingState == SignalingStateClosed)
         return;
 
-    ASSERT(m_remoteStreams->contains(stream.get()));
-    m_remoteStreams->remove(stream.get());
+    size_t pos = m_remoteStreams.find(stream);
+    ASSERT(pos != notFound);
+    m_remoteStreams.remove(pos);
 
     scheduleDispatchEvent(MediaStreamEvent::create(eventNames().removestreamEvent, false, false, stream.release()));
 }

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (141870 => 141871)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2013-02-05 09:10:59 UTC (rev 141871)
@@ -38,7 +38,6 @@
 #include "EventTarget.h"
 #include "ExceptionBase.h"
 #include "MediaStream.h"
-#include "MediaStreamList.h"
 #include "RTCIceCandidate.h"
 #include "RTCPeerConnectionHandler.h"
 #include "RTCPeerConnectionHandlerClient.h"
@@ -85,13 +84,13 @@
 
     String iceConnectionState() const;
 
-    MediaStreamList* localStreams() const;
+    MediaStreamVector getLocalStreams() const;
 
-    MediaStreamList* remoteStreams() const;
+    MediaStreamVector getRemoteStreams() const;
 
-    void addStream(const PassRefPtr<MediaStream>, const Dictionary& mediaConstraints, ExceptionCode&);
+    void addStream(PassRefPtr<MediaStream>, const Dictionary& mediaConstraints, ExceptionCode&);
 
-    void removeStream(MediaStream*, ExceptionCode&);
+    void removeStream(PassRefPtr<MediaStream>, ExceptionCode&);
 
     void getStats(PassRefPtr<RTCStatsCallback> successCallback, PassRefPtr<MediaStreamTrack> selector);
 
@@ -150,8 +149,8 @@
     IceGatheringState m_iceGatheringState;
     IceConnectionState m_iceConnectionState;
 
-    RefPtr<MediaStreamList> m_localStreams;
-    RefPtr<MediaStreamList> m_remoteStreams;
+    MediaStreamVector m_localStreams;
+    MediaStreamVector m_remoteStreams;
 
     Vector<RefPtr<RTCDataChannel> > m_dataChannels;
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl (141870 => 141871)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2013-02-05 09:10:59 UTC (rev 141871)
@@ -66,8 +66,8 @@
     readonly attribute DOMString iceGatheringState;
     readonly attribute DOMString iceConnectionState;
 
-    readonly attribute MediaStreamList localStreams;
-    readonly attribute MediaStreamList remoteStreams;
+    sequence<MediaStream> getLocalStreams();
+    sequence<MediaStream> getRemoteStreams();
 
     [StrictTypeChecking] void addStream(in MediaStream stream, in [Optional] Dictionary mediaConstraints)
         raises(DOMException);

Modified: trunk/Source/WebCore/WebCore.gypi (141870 => 141871)


--- trunk/Source/WebCore/WebCore.gypi	2013-02-05 09:07:20 UTC (rev 141870)
+++ trunk/Source/WebCore/WebCore.gypi	2013-02-05 09:10:59 UTC (rev 141871)
@@ -65,7 +65,6 @@
             'Modules/mediastream/LocalMediaStream.idl',
             'Modules/mediastream/MediaStream.idl',
             'Modules/mediastream/MediaStreamEvent.idl',
-            'Modules/mediastream/MediaStreamList.idl',
             'Modules/mediastream/MediaStreamTrack.idl',
             'Modules/mediastream/MediaStreamTrackEvent.idl',
             'Modules/mediastream/NavigatorMediaStream.idl',
@@ -807,8 +806,6 @@
             'Modules/mediastream/MediaStream.h',
             'Modules/mediastream/MediaStreamEvent.cpp',
             'Modules/mediastream/MediaStreamEvent.h',
-            'Modules/mediastream/MediaStreamList.cpp',
-            'Modules/mediastream/MediaStreamList.h',
             'Modules/mediastream/MediaStreamRegistry.cpp',
             'Modules/mediastream/MediaStreamRegistry.h',
             'Modules/mediastream/MediaStreamTrack.cpp',
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to