Drop [UsePointersEvenForNonNullableObjectArguments] from MediaStream interfaces
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2016 07:18:30 +0000 (07:18 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2016 07:18:30 +0000 (07:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156905

Reviewed by Darin Adler.

Source/WebCore:

Removing UsePointersEvenForNonNullableObjectArguments from MediaStream, RTCPeerConnection and RTCRtpSender.
Updating methods to take references and making some related refactoring.

Test: fast/mediastream/MediaStream-add-remove-null-undefined-tracks.html
Changes also covered by updated tests.

* Modules/mediastream/MediaEndpointPeerConnection.cpp:
(WebCore::MediaEndpointPeerConnection::createOfferTask):
* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::create):
(WebCore::MediaStream::addTrack):
(WebCore::MediaStream::removeTrack):
(WebCore::MediaStream::didAddTrack):
(WebCore::MediaStream::didRemoveTrack):
(WebCore::MediaStream::internalAddTrack):
(WebCore::MediaStream::internalRemoveTrack):
* Modules/mediastream/MediaStream.h:
* Modules/mediastream/MediaStream.idl:
* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::send):
* Modules/mediastream/RTCDataChannel.h:
* Modules/mediastream/RTCDataChannel.idl:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::addTrack):
(WebCore::RTCPeerConnection::removeTrack):
(WebCore::RTCPeerConnection::queuedSetLocalDescription):
(WebCore::RTCPeerConnection::queuedSetRemoteDescription):
(WebCore::RTCPeerConnection::queuedAddIceCandidate):
(WebCore::RTCPeerConnection::privateGetStats):
(WebCore::RTCPeerConnection::queuedCreateOffer): Deleted.
(WebCore::RTCPeerConnection::localDescription): Deleted.
(WebCore::RTCPeerConnection::currentLocalDescription): Deleted.
(WebCore::RTCPeerConnection::remoteDescription): Deleted.
(WebCore::RTCPeerConnection::currentRemoteDescription): Deleted.
(WebCore::RTCPeerConnection::signalingState): Deleted.
(WebCore::RTCPeerConnection::createDataChannel): Deleted.
(WebCore::RTCPeerConnection::close): Deleted.
* Modules/mediastream/RTCPeerConnection.h:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCRtpReceiver.cpp:
(WebCore::RTCRtpReceiver::RTCRtpReceiver):
* Modules/mediastream/RTCRtpReceiver.h:
(WebCore::RTCRtpReceiver::create):
* Modules/mediastream/RTCRtpSender.cpp:
(WebCore::RTCRtpSender::RTCRtpSender):
(WebCore::RTCRtpSender::replaceTrack):
* Modules/mediastream/RTCRtpSender.h:
(WebCore::RTCRtpSender::create):
* Modules/mediastream/RTCRtpSender.idl:
* Modules/mediastream/RTCRtpSenderReceiverBase.h:
(WebCore::RTCRtpSenderReceiverBase::track):
(WebCore::RTCRtpSenderReceiverBase::RTCRtpSenderReceiverBase):

LayoutTests:

* fast/mediastream/MediaStream-add-remove-null-undefined-tracks-expected.txt: Added.
* fast/mediastream/MediaStream-add-remove-null-undefined-tracks.html: Added.
* fast/mediastream/RTCPeerConnection-add-removeTrack-expected.txt: Rebasing.
* fast/mediastream/RTCPeerConnection-add-removeTrack.html: Adding null/undefined tests for addTrack/removeTrack.
* fast/mediastream/RTCPeerConnection-datachannel.html: Adding test for send() method.
Test expectation is not rebased as test is timing out and marked as skip.

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

23 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/MediaStream-add-remove-null-undefined-tracks-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStream-add-remove-null-undefined-tracks.html [new file with mode: 0644]
LayoutTests/fast/mediastream/RTCPeerConnection-add-removeTrack-expected.txt
LayoutTests/fast/mediastream/RTCPeerConnection-add-removeTrack.html
LayoutTests/fast/mediastream/RTCPeerConnection-datachannel.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/MediaStream.h
Source/WebCore/Modules/mediastream/MediaStream.idl
Source/WebCore/Modules/mediastream/RTCDataChannel.cpp
Source/WebCore/Modules/mediastream/RTCDataChannel.h
Source/WebCore/Modules/mediastream/RTCDataChannel.idl
Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
Source/WebCore/Modules/mediastream/RTCPeerConnection.h
Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
Source/WebCore/Modules/mediastream/RTCRtpReceiver.cpp
Source/WebCore/Modules/mediastream/RTCRtpReceiver.h
Source/WebCore/Modules/mediastream/RTCRtpSender.cpp
Source/WebCore/Modules/mediastream/RTCRtpSender.h
Source/WebCore/Modules/mediastream/RTCRtpSender.idl
Source/WebCore/Modules/mediastream/RTCRtpSenderReceiverBase.h

index 638d73b..0cc2e1c 100644 (file)
@@ -1,3 +1,17 @@
+2016-04-29  Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        Drop [UsePointersEvenForNonNullableObjectArguments] from MediaStream interfaces
+        https://bugs.webkit.org/show_bug.cgi?id=156905
+
+        Reviewed by Darin Adler.
+
+        * fast/mediastream/MediaStream-add-remove-null-undefined-tracks-expected.txt: Added.
+        * fast/mediastream/MediaStream-add-remove-null-undefined-tracks.html: Added.
+        * fast/mediastream/RTCPeerConnection-add-removeTrack-expected.txt: Rebasing.
+        * fast/mediastream/RTCPeerConnection-add-removeTrack.html: Adding null/undefined tests for addTrack/removeTrack.
+        * fast/mediastream/RTCPeerConnection-datachannel.html: Adding test for send() method.
+        Test expectation is not rebased as test is timing out and marked as skip.
+
 2016-04-28  Joanmarie Diggs  <jdiggs@igalia.com>
 
         AX: [ATK] Expose subscript and superscript format style groups using ATK_ROLE_SUBSCRIPT and ATK_ROLE_SUPERSCRIPT
diff --git a/LayoutTests/fast/mediastream/MediaStream-add-remove-null-undefined-tracks-expected.txt b/LayoutTests/fast/mediastream/MediaStream-add-remove-null-undefined-tracks-expected.txt
new file mode 100644 (file)
index 0000000..bade8c6
--- /dev/null
@@ -0,0 +1,17 @@
+Test adding and removing null and undefined tracks.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Calling addTrack with null and undefined parameters
+PASS stream.addTrack(null); threw exception TypeError: Type error.
+PASS stream.addTrack(undefined); threw exception TypeError: Type error.
+
+Calling removeTrack with null and undefined parameters
+PASS stream.removeTrack(null); threw exception TypeError: Type error.
+PASS stream.removeTrack(undefined); threw exception TypeError: Type error.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/mediastream/MediaStream-add-remove-null-undefined-tracks.html b/LayoutTests/fast/mediastream/MediaStream-add-remove-null-undefined-tracks.html
new file mode 100644 (file)
index 0000000..1040483
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+        <script src="./resources/getUserMedia-helper.js"></script>
+    </head>
+    <body>
+        <p id="description"></p>
+        <div id="console"></div>
+        <script>
+            description("Test adding and removing null and undefined tracks.");
+
+            var stream;
+
+            function gotStream(s) {
+                stream = s;
+
+                debug("<br>Calling addTrack with null and undefined parameters");
+                shouldThrow("stream.addTrack(null);");
+                shouldThrow("stream.addTrack(undefined);");
+
+                debug("<br>Calling removeTrack with null and undefined parameters");
+                shouldThrow("stream.removeTrack(null);");
+                shouldThrow("stream.removeTrack(undefined);");
+
+                finishJSTest();
+            }
+
+            getUserMedia("allow", {audio:true, video:true}, gotStream);
+
+            window.jsTestIsAsync = true;
+            window.successfullyParsed = true;
+        </script>
+        <script src="../../resources/js-test-post.js"></script>
+    </body>
+</html>
index fa33959..7e53c17 100644 (file)
@@ -21,6 +21,10 @@ PASS pc.getSenders().length is 2
 PASS senderFromPc2 = pc2.addTrack(track, stream) did not throw exception.
 removeTrack() with 'foreign' sender must be ignored (not throw)
 PASS pc.removeTrack(senderFromPc2) did not throw exception.
+PASS pc.addTrack(null); threw exception TypeError: Type error.
+PASS pc.addTrack(undefined); threw exception TypeError: Type error.
+PASS pc.removeTrack(null); threw exception TypeError: Type error.
+PASS pc.removeTrack(undefined); threw exception TypeError: Type error.
 PASS successfullyParsed is true
 
 TEST COMPLETE
index d1ed5a3..7a6d0cf 100644 (file)
                 debug("removeTrack() with 'foreign' sender must be ignored (not throw)");
                 shouldNotThrow("pc.removeTrack(senderFromPc2)");
 
+                shouldThrow("pc.addTrack(null);");
+                shouldThrow("pc.addTrack(undefined);");
+                shouldThrow("pc.removeTrack(null);");
+                shouldThrow("pc.removeTrack(undefined);");
+
                 finishJSTest();
             })
             .catch(function (error) {
index 881a89d..9c860f8 100644 (file)
@@ -66,6 +66,9 @@
 
                 dc.onmessage = dc_onmessage_string;
                 shouldNotThrow("dc.send('xyzzy');");
+
+                shouldThrow("dc.send(null);");
+                shouldThrow("dc.send(undefined);");
             }
 
             function pc_ondatachannel(e) {
index fbea10b..f19116c 100644 (file)
@@ -1,3 +1,63 @@
+2016-04-29  Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        Drop [UsePointersEvenForNonNullableObjectArguments] from MediaStream interfaces
+        https://bugs.webkit.org/show_bug.cgi?id=156905
+
+        Reviewed by Darin Adler.
+
+        Removing UsePointersEvenForNonNullableObjectArguments from MediaStream, RTCPeerConnection and RTCRtpSender.
+        Updating methods to take references and making some related refactoring.
+
+        Test: fast/mediastream/MediaStream-add-remove-null-undefined-tracks.html
+        Changes also covered by updated tests.
+
+        * Modules/mediastream/MediaEndpointPeerConnection.cpp:
+        (WebCore::MediaEndpointPeerConnection::createOfferTask):
+        * Modules/mediastream/MediaStream.cpp:
+        (WebCore::MediaStream::create):
+        (WebCore::MediaStream::addTrack):
+        (WebCore::MediaStream::removeTrack):
+        (WebCore::MediaStream::didAddTrack):
+        (WebCore::MediaStream::didRemoveTrack):
+        (WebCore::MediaStream::internalAddTrack):
+        (WebCore::MediaStream::internalRemoveTrack):
+        * Modules/mediastream/MediaStream.h:
+        * Modules/mediastream/MediaStream.idl:
+        * Modules/mediastream/RTCDataChannel.cpp:
+        (WebCore::RTCDataChannel::send):
+        * Modules/mediastream/RTCDataChannel.h:
+        * Modules/mediastream/RTCDataChannel.idl:
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::addTrack):
+        (WebCore::RTCPeerConnection::removeTrack):
+        (WebCore::RTCPeerConnection::queuedSetLocalDescription):
+        (WebCore::RTCPeerConnection::queuedSetRemoteDescription):
+        (WebCore::RTCPeerConnection::queuedAddIceCandidate):
+        (WebCore::RTCPeerConnection::privateGetStats):
+        (WebCore::RTCPeerConnection::queuedCreateOffer): Deleted.
+        (WebCore::RTCPeerConnection::localDescription): Deleted.
+        (WebCore::RTCPeerConnection::currentLocalDescription): Deleted.
+        (WebCore::RTCPeerConnection::remoteDescription): Deleted.
+        (WebCore::RTCPeerConnection::currentRemoteDescription): Deleted.
+        (WebCore::RTCPeerConnection::signalingState): Deleted.
+        (WebCore::RTCPeerConnection::createDataChannel): Deleted.
+        (WebCore::RTCPeerConnection::close): Deleted.
+        * Modules/mediastream/RTCPeerConnection.h:
+        * Modules/mediastream/RTCPeerConnection.idl:
+        * Modules/mediastream/RTCRtpReceiver.cpp:
+        (WebCore::RTCRtpReceiver::RTCRtpReceiver):
+        * Modules/mediastream/RTCRtpReceiver.h:
+        (WebCore::RTCRtpReceiver::create):
+        * Modules/mediastream/RTCRtpSender.cpp:
+        (WebCore::RTCRtpSender::RTCRtpSender):
+        (WebCore::RTCRtpSender::replaceTrack):
+        * Modules/mediastream/RTCRtpSender.h:
+        (WebCore::RTCRtpSender::create):
+        * Modules/mediastream/RTCRtpSender.idl:
+        * Modules/mediastream/RTCRtpSenderReceiverBase.h:
+        (WebCore::RTCRtpSenderReceiverBase::track):
+        (WebCore::RTCRtpSenderReceiverBase::RTCRtpSenderReceiverBase):
+
 2016-04-28  Daniel Bates  <dabates@apple.com>
 
         Remove extraneous space characters from parameter list for RenderListBox::paintItem()
index ce0c581..56bc14f 100644 (file)
@@ -139,12 +139,12 @@ void MediaEndpointPeerConnection::createOfferTask(RTCOfferOptions&, SessionDescr
     // Add media descriptions for senders.
     for (auto& sender : senders) {
         RefPtr<PeerMediaDescription> mediaDescription = PeerMediaDescription::create();
-        MediaStreamTrack* track = sender->track();
+        MediaStreamTrack& track = sender->track();
 
         mediaDescription->setMediaStreamId(sender->mediaStreamIds()[0]);
-        mediaDescription->setMediaStreamTrackId(track->id());
-        mediaDescription->setType(track->kind());
-        mediaDescription->setPayloads(track->kind() == "audio" ? m_defaultAudioPayloads : m_defaultVideoPayloads);
+        mediaDescription->setMediaStreamTrackId(track.id());
+        mediaDescription->setType(track.kind());
+        mediaDescription->setPayloads(track.kind() == "audio" ? m_defaultAudioPayloads : m_defaultVideoPayloads);
         mediaDescription->setDtlsFingerprintHashFunction(m_dtlsFingerprintFunction);
         mediaDescription->setDtlsFingerprint(m_dtlsFingerprint);
         mediaDescription->setCname(m_cname);
index e148cab..bbc8ba7 100644 (file)
@@ -47,11 +47,9 @@ Ref<MediaStream> MediaStream::create(ScriptExecutionContext& context)
     return MediaStream::create(context, MediaStreamPrivate::create(Vector<RefPtr<MediaStreamTrackPrivate>>()));
 }
 
-Ref<MediaStream> MediaStream::create(ScriptExecutionContext& context, MediaStream* stream)
+Ref<MediaStream> MediaStream::create(ScriptExecutionContext& context, MediaStream& stream)
 {
-    ASSERT(stream);
-
-    return adoptRef(*new MediaStream(context, stream->getTracks()));
+    return adoptRef(*new MediaStream(context, stream.getTracks()));
 }
 
 Ref<MediaStream> MediaStream::create(ScriptExecutionContext& context, const MediaStreamTrackVector& tracks)
@@ -97,7 +95,7 @@ MediaStream::MediaStream(ScriptExecutionContext& context, RefPtr<MediaStreamPriv
     MediaStreamRegistry::shared().registerStream(*this);
 
     for (auto& trackPrivate : m_private->tracks()) {
-        RefPtr<MediaStreamTrack> track = MediaStreamTrack::create(context, *trackPrivate);
+        auto track = MediaStreamTrack::create(context, *trackPrivate);
         track->addObserver(this);
         m_trackSet.add(track->id(), WTFMove(track));
     }
@@ -128,18 +126,18 @@ RefPtr<MediaStream> MediaStream::clone()
     return MediaStream::create(*scriptExecutionContext(), clonedTracks);
 }
 
-void MediaStream::addTrack(RefPtr<MediaStreamTrack>&& track)
+void MediaStream::addTrack(MediaStreamTrack& track)
 {
-    if (!internalAddTrack(WTFMove(track), StreamModifier::DomAPI))
+    if (!internalAddTrack(track, StreamModifier::DomAPI))
         return;
 
     for (auto& observer : m_observers)
         observer->didAddOrRemoveTrack();
 }
 
-void MediaStream::removeTrack(MediaStreamTrack* track)
+void MediaStream::removeTrack(MediaStreamTrack& track)
 {
-    if (!internalRemoveTrack(track, StreamModifier::DomAPI))
+    if (!internalRemoveTrack(track.id(), StreamModifier::DomAPI))
         return;
 
     for (auto& observer : m_observers)
@@ -203,30 +201,31 @@ void MediaStream::didAddTrack(MediaStreamTrackPrivate& trackPrivate)
 
 void MediaStream::didRemoveTrack(MediaStreamTrackPrivate& trackPrivate)
 {
-    RefPtr<MediaStreamTrack> track = getTrackById(trackPrivate.id());
-    ASSERT(track);
-    internalRemoveTrack(WTFMove(track), StreamModifier::Platform);
+    internalRemoveTrack(trackPrivate.id(), StreamModifier::Platform);
 }
 
-bool MediaStream::internalAddTrack(RefPtr<MediaStreamTrack>&& track, StreamModifier streamModifier)
+bool MediaStream::internalAddTrack(Ref<MediaStreamTrack>&& trackToAdd, StreamModifier streamModifier)
 {
-    if (getTrackById(track->id()))
+    auto result = m_trackSet.add(trackToAdd->id(), WTFMove(trackToAdd));
+    if (!result.isNewEntry)
         return false;
 
-    m_trackSet.add(track->id(), track);
-    track->addObserver(this);
+    ASSERT(result.iterator->value);
+    auto& track = *result.iterator->value;
+    track.addObserver(this);
 
     if (streamModifier == StreamModifier::DomAPI)
-        m_private->addTrack(&track->privateTrack(), MediaStreamPrivate::NotifyClientOption::DontNotify);
+        m_private->addTrack(&track.privateTrack(), MediaStreamPrivate::NotifyClientOption::DontNotify);
     else
-        dispatchEvent(MediaStreamTrackEvent::create(eventNames().addtrackEvent, false, false, WTFMove(track)));
+        dispatchEvent(MediaStreamTrackEvent::create(eventNames().addtrackEvent, false, false, &track));
 
     return true;
 }
 
-bool MediaStream::internalRemoveTrack(RefPtr<MediaStreamTrack>&& track, StreamModifier streamModifier)
+bool MediaStream::internalRemoveTrack(const String& trackId, StreamModifier streamModifier)
 {
-    if (!m_trackSet.remove(track->id()))
+    auto track = m_trackSet.take(trackId);
+    if (!track)
         return false;
 
     track->removeObserver(this);
index 7e9dbf3..8f8ad98 100644 (file)
@@ -56,15 +56,15 @@ public:
     };
 
     static Ref<MediaStream> create(ScriptExecutionContext&);
-    static Ref<MediaStream> create(ScriptExecutionContext&, MediaStream*);
+    static Ref<MediaStream> create(ScriptExecutionContext&, MediaStream&);
     static Ref<MediaStream> create(ScriptExecutionContext&, const MediaStreamTrackVector&);
     static Ref<MediaStream> create(ScriptExecutionContext&, RefPtr<MediaStreamPrivate>&&);
     virtual ~MediaStream();
 
     String id() const { return m_private->id(); }
 
-    void addTrack(RefPtr<MediaStreamTrack>&&);
-    void removeTrack(MediaStreamTrack*);
+    void addTrack(MediaStreamTrack&);
+    void removeTrack(MediaStreamTrack&);
     MediaStreamTrack* getTrackById(String);
 
     MediaStreamTrackVector getAudioTracks() const;
@@ -118,8 +118,8 @@ private:
     void pageMutedStateDidChange() final;
     MediaProducer::MediaStateFlags mediaState() const final;
 
-    bool internalAddTrack(RefPtr<MediaStreamTrack>&&, StreamModifier);
-    bool internalRemoveTrack(RefPtr<MediaStreamTrack>&&, StreamModifier);
+    bool internalAddTrack(Ref<MediaStreamTrack>&&, StreamModifier);
+    bool internalRemoveTrack(const String&, StreamModifier);
 
     void scheduleActiveStateChange();
     void activityEventTimerFired();
index 0c99e56..72f509a 100644 (file)
@@ -28,7 +28,6 @@
     Constructor(MediaStream stream),
     Constructor(MediaStreamTrack[] tracks),
     ConstructorCallWith=ScriptExecutionContext,
-    UsePointersEvenForNonNullableObjectArguments,
 ] interface MediaStream : EventTarget {
 
     readonly attribute DOMString id;
index 2601def..1de39eb 100644 (file)
@@ -202,20 +202,18 @@ void RTCDataChannel::send(const String& data, ExceptionCode& ec)
     }
 }
 
-void RTCDataChannel::send(PassRefPtr<ArrayBuffer> prpData, ExceptionCode& ec)
+void RTCDataChannel::send(ArrayBuffer& data, ExceptionCode& ec)
 {
     if (m_readyState != ReadyStateOpen) {
         ec = INVALID_STATE_ERR;
         return;
     }
 
-    RefPtr<ArrayBuffer> data = prpData;
-
-    size_t dataLength = data->byteLength();
+    size_t dataLength = data.byteLength();
     if (!dataLength)
         return;
 
-    const char* dataPointer = static_cast<const char*>(data->data());
+    const char* dataPointer = static_cast<const char*>(data.data());
 
     if (!m_handler->sendRawData(dataPointer, dataLength)) {
         // FIXME: Decide what the right exception here is.
@@ -223,13 +221,15 @@ void RTCDataChannel::send(PassRefPtr<ArrayBuffer> prpData, ExceptionCode& ec)
     }
 }
 
-void RTCDataChannel::send(PassRefPtr<ArrayBufferView> data, ExceptionCode& ec)
+void RTCDataChannel::send(ArrayBufferView* data, ExceptionCode& ec)
 {
+    ASSERT(data);
     RefPtr<ArrayBuffer> arrayBuffer(data->buffer());
-    send(arrayBuffer.release(), ec);
+    ASSERT(arrayBuffer);
+    send(*arrayBuffer, ec);
 }
 
-void RTCDataChannel::send(PassRefPtr<Blob>, ExceptionCode& ec)
+void RTCDataChannel::send(Blob&, ExceptionCode& ec)
 {
     // FIXME: implement
     ec = NOT_SUPPORTED_ERR;
index a2fd884..0f8d601 100644 (file)
@@ -65,9 +65,9 @@ public:
     void setBinaryType(const AtomicString&, ExceptionCode&);
 
     void send(const String&, ExceptionCode&);
-    void send(PassRefPtr<JSC::ArrayBuffer>, ExceptionCode&);
-    void send(PassRefPtr<JSC::ArrayBufferView>, ExceptionCode&);
-    void send(PassRefPtr<Blob>, ExceptionCode&);
+    void send(JSC::ArrayBuffer&, ExceptionCode&);
+    void send(JSC::ArrayBufferView*, ExceptionCode&);
+    void send(Blob&, ExceptionCode&);
 
     void close();
 
index bad9bc5..55e0d86 100644 (file)
@@ -23,9 +23,8 @@
  */
 
 [
-    NoInterfaceObject,
     Conditional=WEB_RTC,
-    UsePointersEvenForNonNullableObjectArguments,
+    NoInterfaceObject,
 ] interface RTCDataChannel : EventTarget {
     readonly attribute DOMString label;
     readonly attribute boolean ordered;
index 26b5437..677eef2 100644 (file)
@@ -101,13 +101,8 @@ RTCPeerConnection::~RTCPeerConnection()
     stop();
 }
 
-RefPtr<RTCRtpSender> RTCPeerConnection::addTrack(RefPtr<MediaStreamTrack>&& track, Vector<MediaStream*> streams, ExceptionCode& ec)
+RefPtr<RTCRtpSender> RTCPeerConnection::addTrack(Ref<MediaStreamTrack>&& track, Vector<MediaStream*> streams, ExceptionCode& ec)
 {
-    if (!track) {
-        ec = TypeError;
-        return nullptr;
-    }
-
     if (m_signalingState == SignalingState::Closed) {
         ec = INVALID_STATE_ERR;
         return nullptr;
@@ -139,22 +134,17 @@ RefPtr<RTCRtpSender> RTCPeerConnection::addTrack(RefPtr<MediaStreamTrack>&& trac
     return sender;
 }
 
-void RTCPeerConnection::removeTrack(RTCRtpSender* sender, ExceptionCode& ec)
+void RTCPeerConnection::removeTrack(RTCRtpSender& sender, ExceptionCode& ec)
 {
-    if (!sender) {
-        ec = TypeError;
-        return;
-    }
-
     if (m_signalingState == SignalingState::Closed) {
         ec = INVALID_STATE_ERR;
         return;
     }
 
-    if (!m_senderSet.contains(sender))
+    if (!m_senderSet.contains(&sender))
         return;
 
-    sender->stop();
+    sender.stop();
 
     m_backend->markAsNeedingNegotiation();
 }
@@ -194,15 +184,14 @@ void RTCPeerConnection::queuedCreateAnswer(const Dictionary& answerOptions, Sess
     m_backend->createAnswer(*options, WTFMove(promise));
 }
 
-void RTCPeerConnection::queuedSetLocalDescription(RTCSessionDescription* description, PeerConnection::VoidPromise&& promise)
+void RTCPeerConnection::queuedSetLocalDescription(RTCSessionDescription& description, PeerConnection::VoidPromise&& promise)
 {
     if (m_signalingState == SignalingState::Closed) {
         promise.reject(DOMError::create("InvalidStateError"));
         return;
     }
 
-    ASSERT(description);
-    m_backend->setLocalDescription(*description, WTFMove(promise));
+    m_backend->setLocalDescription(description, WTFMove(promise));
 }
 
 RefPtr<RTCSessionDescription> RTCPeerConnection::localDescription() const
@@ -220,15 +209,14 @@ RefPtr<RTCSessionDescription> RTCPeerConnection::pendingLocalDescription() const
     return m_backend->pendingLocalDescription();
 }
 
-void RTCPeerConnection::queuedSetRemoteDescription(RTCSessionDescription* description, PeerConnection::VoidPromise&& promise)
+void RTCPeerConnection::queuedSetRemoteDescription(RTCSessionDescription& description, PeerConnection::VoidPromise&& promise)
 {
     if (m_signalingState == SignalingState::Closed) {
         promise.reject(DOMError::create("InvalidStateError"));
         return;
     }
 
-    ASSERT(description);
-    m_backend->setRemoteDescription(*description, WTFMove(promise));
+    m_backend->setRemoteDescription(description, WTFMove(promise));
 }
 
 RefPtr<RTCSessionDescription> RTCPeerConnection::remoteDescription() const
@@ -246,15 +234,14 @@ RefPtr<RTCSessionDescription> RTCPeerConnection::pendingRemoteDescription() cons
     return m_backend->pendingRemoteDescription();
 }
 
-void RTCPeerConnection::queuedAddIceCandidate(RTCIceCandidate* rtcCandidate, VoidPromise&& promise)
+void RTCPeerConnection::queuedAddIceCandidate(RTCIceCandidate& rtcCandidate, VoidPromise&& promise)
 {
     if (m_signalingState == SignalingState::Closed) {
         promise.reject(DOMError::create("InvalidStateError"));
         return;
     }
 
-    ASSERT(rtcCandidate);
-    m_backend->addIceCandidate(*rtcCandidate, WTFMove(promise));
+    m_backend->addIceCandidate(rtcCandidate, WTFMove(promise));
 }
 
 String RTCPeerConnection::signalingState() const
@@ -341,14 +328,14 @@ void RTCPeerConnection::setConfiguration(const Dictionary& configuration, Except
     m_backend->setConfiguration(*m_configuration);
 }
 
-void RTCPeerConnection::privateGetStats(MediaStreamTrack* selector, PeerConnection::StatsPromise&& promise)
+void RTCPeerConnection::privateGetStats(MediaStreamTrack& selector, PeerConnection::StatsPromise&& promise)
 {
-    m_backend->getStats(selector, WTFMove(promise));
+    m_backend->getStats(&selector, WTFMove(promise));
 }
 
 void RTCPeerConnection::privateGetStats(PeerConnection::StatsPromise&& promise)
 {
-    privateGetStats(nullptr, WTFMove(promise));
+    m_backend->getStats(nullptr, WTFMove(promise));
 }
 
 RefPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String, const Dictionary&, ExceptionCode& ec)
index d2fd088..5e255ee 100644 (file)
@@ -67,25 +67,25 @@ public:
     Vector<RefPtr<RTCRtpSender>> getSenders() const override { return m_senderSet; }
     Vector<RefPtr<RTCRtpReceiver>> getReceivers() const { return m_receiverSet; }
 
-    RefPtr<RTCRtpSender> addTrack(RefPtr<MediaStreamTrack>&&, Vector<MediaStream*>, ExceptionCode&);
-    void removeTrack(RTCRtpSender*, ExceptionCode&);
+    RefPtr<RTCRtpSender> addTrack(Ref<MediaStreamTrack>&&, Vector<MediaStream*>, ExceptionCode&);
+    void removeTrack(RTCRtpSender&, ExceptionCode&);
 
     void queuedCreateOffer(const Dictionary& offerOptions, PeerConnection::SessionDescriptionPromise&&);
     void queuedCreateAnswer(const Dictionary& answerOptions, PeerConnection::SessionDescriptionPromise&&);
 
-    void queuedSetLocalDescription(RTCSessionDescription*, PeerConnection::VoidPromise&&);
+    void queuedSetLocalDescription(RTCSessionDescription&, PeerConnection::VoidPromise&&);
     RefPtr<RTCSessionDescription> localDescription() const;
     RefPtr<RTCSessionDescription> currentLocalDescription() const;
     RefPtr<RTCSessionDescription> pendingLocalDescription() const;
 
-    void queuedSetRemoteDescription(RTCSessionDescription*, PeerConnection::VoidPromise&&);
+    void queuedSetRemoteDescription(RTCSessionDescription&, PeerConnection::VoidPromise&&);
     RefPtr<RTCSessionDescription> remoteDescription() const;
     RefPtr<RTCSessionDescription> currentRemoteDescription() const;
     RefPtr<RTCSessionDescription> pendingRemoteDescription() const;
 
     String signalingState() const;
 
-    void queuedAddIceCandidate(RTCIceCandidate*, PeerConnection::VoidPromise&&);
+    void queuedAddIceCandidate(RTCIceCandidate&, PeerConnection::VoidPromise&&);
 
     String iceGatheringState() const;
     String iceConnectionState() const;
@@ -93,7 +93,7 @@ public:
     RTCConfiguration* getConfiguration() const;
     void setConfiguration(const Dictionary& configuration, ExceptionCode&);
 
-    void privateGetStats(MediaStreamTrack*, PeerConnection::StatsPromise&&);
+    void privateGetStats(MediaStreamTrack&, PeerConnection::StatsPromise&&);
     void privateGetStats(PeerConnection::StatsPromise&&);
 
     RefPtr<RTCDataChannel> createDataChannel(String label, const Dictionary& dataChannelDict, ExceptionCode&);
index 9a0c3ee..782663c 100644 (file)
  */
 
 [
-    Conditional=WEB_RTC,
     ActiveDOMObject,
-    CustomConstructor(Dictionary rtcConfiguration),
+    Conditional=WEB_RTC,
     ConstructorCallWith=ScriptExecutionContext,
     ConstructorRaisesException,
+    CustomConstructor(Dictionary rtcConfiguration),
     InterfaceName=webkitRTCPeerConnection,
-    UsePointersEvenForNonNullableObjectArguments,
 ] interface RTCPeerConnection : EventTarget {
 
     // Private functions called by runQueuedOperation() (RTCPeerConnectionInternals.js)
index 7c263ce..152e602 100644 (file)
@@ -35,7 +35,7 @@
 
 namespace WebCore {
 
-RTCRtpReceiver::RTCRtpReceiver(RefPtr<MediaStreamTrack>&& track)
+RTCRtpReceiver::RTCRtpReceiver(Ref<MediaStreamTrack>&& track)
     : RTCRtpSenderReceiverBase(WTFMove(track))
 {
 }
index 058b9be..a77eac5 100644 (file)
@@ -39,13 +39,13 @@ namespace WebCore {
 
 class RTCRtpReceiver : public RTCRtpSenderReceiverBase {
 public:
-    static Ref<RTCRtpReceiver> create(RefPtr<MediaStreamTrack>&& track)
+    static Ref<RTCRtpReceiver> create(Ref<MediaStreamTrack>&& track)
     {
         return adoptRef(*new RTCRtpReceiver(WTFMove(track)));
     }
 
 private:
-    explicit RTCRtpReceiver(RefPtr<MediaStreamTrack>&&);
+    explicit RTCRtpReceiver(Ref<MediaStreamTrack>&&);
 };
 
 } // namespace WebCore
index 21ffcae..764fa68 100644 (file)
@@ -39,7 +39,7 @@
 
 namespace WebCore {
 
-RTCRtpSender::RTCRtpSender(RefPtr<MediaStreamTrack>&& track, Vector<String>&& mediaStreamIds, RTCRtpSenderClient& client)
+RTCRtpSender::RTCRtpSender(Ref<MediaStreamTrack>&& track, Vector<String>&& mediaStreamIds, RTCRtpSenderClient& client)
     : RTCRtpSenderReceiverBase(WTFMove(track))
     , m_mediaStreamIds(WTFMove(mediaStreamIds))
     , m_client(&client)
@@ -48,24 +48,19 @@ RTCRtpSender::RTCRtpSender(RefPtr<MediaStreamTrack>&& track, Vector<String>&& me
     m_trackId = m_track->id();
 }
 
-void RTCRtpSender::replaceTrack(MediaStreamTrack* withTrack, PeerConnection::VoidPromise&& promise, ExceptionCode& ec)
+void RTCRtpSender::replaceTrack(MediaStreamTrack& withTrack, PeerConnection::VoidPromise&& promise, ExceptionCode& ec)
 {
-    if (!withTrack) {
-        ec = TypeError;
-        return;
-    }
-
     if (!m_client) {
         promise.reject(DOMError::create("InvalidStateError"));
         return;
     }
 
-    if (m_track->kind() != withTrack->kind()) {
+    if (m_track->kind() != withTrack.kind()) {
         ec = TypeError;
         return;
     }
 
-    m_client->replaceTrack(*this, *withTrack, WTFMove(promise));
+    m_client->replaceTrack(*this, withTrack, WTFMove(promise));
 }
 
 } // namespace WebCore
index df71784..60b9920 100644 (file)
@@ -48,7 +48,7 @@ public:
 
 class RTCRtpSender : public RTCRtpSenderReceiverBase {
 public:
-    static Ref<RTCRtpSender> create(RefPtr<MediaStreamTrack>&& track, Vector<String>&& mediaStreamIds, RTCRtpSenderClient& client)
+    static Ref<RTCRtpSender> create(Ref<MediaStreamTrack>&& track, Vector<String>&& mediaStreamIds, RTCRtpSenderClient& client)
     {
         return adoptRef(*new RTCRtpSender(WTFMove(track), WTFMove(mediaStreamIds), client));
     }
@@ -58,10 +58,10 @@ public:
 
     void stop() { m_client = nullptr; }
 
-    void replaceTrack(MediaStreamTrack*, PeerConnection::VoidPromise&&, ExceptionCode&);
+    void replaceTrack(MediaStreamTrack&, PeerConnection::VoidPromise&&, ExceptionCode&);
 
 private:
-    RTCRtpSender(RefPtr<MediaStreamTrack>&&, Vector<String>&& mediaStreamIds, RTCRtpSenderClient&);
+    RTCRtpSender(Ref<MediaStreamTrack>&&, Vector<String>&& mediaStreamIds, RTCRtpSenderClient&);
 
     String m_trackId;
     Vector<String> m_mediaStreamIds;
index 508b6d1..de41275 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=WEB_RTC,
-    UsePointersEvenForNonNullableObjectArguments,
 ] interface RTCRtpSender {
     readonly attribute MediaStreamTrack track;
 
index e92b6c7..39c9ebc 100644 (file)
@@ -46,14 +46,14 @@ class RTCRtpSenderReceiverBase : public RefCounted<RTCRtpSenderReceiverBase>, pu
 public:
     virtual ~RTCRtpSenderReceiverBase() { }
 
-    MediaStreamTrack* track() const {  return m_track.get(); }
+    MediaStreamTrack& track() { return m_track; }
 
 protected:
-    RTCRtpSenderReceiverBase(RefPtr<MediaStreamTrack>&& track)
-        : m_track(track)
+    RTCRtpSenderReceiverBase(Ref<MediaStreamTrack>&& track)
+        : m_track(WTFMove(track))
     { }
 
-    RefPtr<MediaStreamTrack> m_track;
+    Ref<MediaStreamTrack> m_track;
 };
 
 } // namespace WebCore