Diff
Modified: trunk/LayoutTests/ChangeLog (131493 => 131494)
--- trunk/LayoutTests/ChangeLog 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/LayoutTests/ChangeLog 2012-10-16 20:41:36 UTC (rev 131494)
@@ -1,3 +1,15 @@
+2012-10-16 Tommy Widenflycht <tom...@google.com>
+
+ MediaStream API: Add the chromium API for RTCDataChannel
+ https://bugs.webkit.org/show_bug.cgi?id=99435
+
+ Reviewed by Adam Barth.
+
+ Adding tests for RTCDataChannel.
+
+ * fast/mediastream/RTCPeerConnection-datachannel-expected.txt: Added.
+ * fast/mediastream/RTCPeerConnection-datachannel.html: Added.
+
2012-10-16 Tony Chang <t...@chromium.org>
Unreviewed, rebaseline 2 Chromium Mac test.
Added: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-datachannel-expected.txt (0 => 131494)
--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-datachannel-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-datachannel-expected.txt 2012-10-16 20:41:36 UTC (rev 131494)
@@ -0,0 +1,30 @@
+Tests RTCDataChannel.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS pc_onopen was called
+PASS dc.readyState is 'connecting'
+PASS dc.reliable is true
+PASS dc.reliable is true
+PASS dc.reliable is true
+PASS dc.reliable is false
+PASS dc_onopen was called
+PASS dc.readyState is 'open'
+PASS dc.label is 'label'
+PASS dc_onmessage_string was called
+PASS data is 'xyzzy'
+PASS dc_onmessage_arraybuffer was called
+PASS data.byteLength is 2
+PASS array[0] is 17
+PASS array[1] is 19
+PASS dc_onmessage_arraybufferview was called
+PASS data.byteLength is 2
+PASS array[0] is 11
+PASS array[1] is 13
+PASS dc_onclose was called
+PASS dc.readyState is 'closed'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-datachannel.html (0 => 131494)
--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-datachannel.html (rev 0)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-datachannel.html 2012-10-16 20:41:36 UTC (rev 131494)
@@ -0,0 +1,96 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description("Tests RTCDataChannel.");
+
+var pc = null;
+var dc = null;
+var data;
+var array;
+
+function dc_onclose() {
+ testPassed("dc_onclose was called");
+ shouldBe("dc.readyState", "'closed'");
+
+ finishJSTest();
+}
+
+function dc_onmessage_arraybufferview(e) {
+ testPassed("dc_onmessage_arraybufferview was called");
+ data = ""
+ shouldBe("data.byteLength", "2");
+ array = new Int8Array(e.data);
+ shouldBe("array[0]", "11");
+ shouldBe("array[1]", "13");
+
+ dc._onclose_ = dc_onclose;
+ dc.close();
+}
+
+function dc_onmessage_arraybuffer(e) {
+ testPassed("dc_onmessage_arraybuffer was called");
+ data = ""
+ shouldBe("data.byteLength", "2");
+ array = new Int8Array(e.data);
+ shouldBe("array[0]", "17");
+ shouldBe("array[1]", "19");
+
+ array[0] = 11;
+ array[1] = 13;
+ dc._onmessage_ = dc_onmessage_arraybufferview;
+ dc.send(array);
+}
+
+function dc_onmessage_string(e) {
+ testPassed("dc_onmessage_string was called");
+ data = ""
+ shouldBe("data", "'xyzzy'");
+
+ dc.binaryType = "arraybuffer";
+ var buffer = new ArrayBuffer(2);
+ var array = new Int8Array(buffer);
+ array[0] = 17;
+ array[1] = 19;
+ dc._onmessage_ = dc_onmessage_arraybuffer;
+ dc.send(buffer);
+}
+
+function dc_onopen() {
+ testPassed("dc_onopen was called");
+ shouldBe("dc.readyState", "'open'");
+ shouldBe("dc.label", "'label'");
+
+ dc._onmessage_ = dc_onmessage_string;
+ dc.send("xyzzy");
+}
+
+function pc_onopen() {
+ testPassed("pc_onopen was called");
+ dc = pc.createDataChannel("label1");
+ shouldBe("dc.readyState", "'connecting'");
+ shouldBe("dc.reliable", "true");
+
+ dc = pc.createDataChannel("label2", {});
+ shouldBe("dc.reliable", "true");
+
+ dc = pc.createDataChannel("label3", {reliable:true});
+ shouldBe("dc.reliable", "true");
+
+ dc = pc.createDataChannel("label", {reliable:false});
+ shouldBe("dc.reliable", "false");
+ dc._onopen_ = dc_onopen;
+}
+
+pc = new webkitRTCPeerConnection(null, null);
+pc._onopen_ = pc_onopen;
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/Platform/ChangeLog (131493 => 131494)
--- trunk/Source/Platform/ChangeLog 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Source/Platform/ChangeLog 2012-10-16 20:41:36 UTC (rev 131494)
@@ -1,3 +1,31 @@
+2012-10-16 Tommy Widenflycht <tom...@google.com>
+
+ MediaStream API: Add the chromium API for RTCDataChannel
+ https://bugs.webkit.org/show_bug.cgi?id=99435
+
+ Reviewed by Adam Barth.
+
+ Adding WebRTCDataChannel.
+
+ * Platform.gypi:
+ * chromium/public/WebRTCDataChannel.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebRTCDataChannel):
+ (ExtraData):
+ (WebKit::WebRTCDataChannel::ExtraData::~ExtraData):
+ (WebKit::WebRTCDataChannel::WebRTCDataChannel):
+ (WebKit::WebRTCDataChannel::~WebRTCDataChannel):
+ (WebKit::WebRTCDataChannel::operator=):
+ (WebKit::WebRTCDataChannel::isNull):
+ * chromium/public/WebRTCPeerConnectionHandler.h:
+ (WebKit):
+ (WebRTCPeerConnectionHandler):
+ (WebKit::WebRTCPeerConnectionHandler::openDataChannel):
+ (WebKit::WebRTCPeerConnectionHandler::sendStringData):
+ (WebKit::WebRTCPeerConnectionHandler::sendRawData):
+ (WebKit::WebRTCPeerConnectionHandler::closeDataChannel):
+
2012-10-13 Chris Rogers <crog...@google.com>
WebAudioBus needs support for resizing bus to a smaller size
Modified: trunk/Source/Platform/Platform.gypi (131493 => 131494)
--- trunk/Source/Platform/Platform.gypi 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Source/Platform/Platform.gypi 2012-10-16 20:41:36 UTC (rev 131494)
@@ -107,6 +107,7 @@
'chromium/public/WebPrivateOwnPtr.h',
'chromium/public/WebPrivatePtr.h',
'chromium/public/WebRTCConfiguration.h',
+ 'chromium/public/WebRTCDataChannel.h',
'chromium/public/WebRTCICECandidate.h',
'chromium/public/WebRTCPeerConnectionHandler.h',
'chromium/public/WebRTCPeerConnectionHandlerClient.h',
Added: trunk/Source/Platform/chromium/public/WebRTCDataChannel.h (0 => 131494)
--- trunk/Source/Platform/chromium/public/WebRTCDataChannel.h (rev 0)
+++ trunk/Source/Platform/chromium/public/WebRTCDataChannel.h 2012-10-16 20:41:36 UTC (rev 131494)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2012 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 WebRTCDataChannel_h
+#define WebRTCDataChannel_h
+
+#include "WebCommon.h"
+#include "WebPrivatePtr.h"
+#include "WebString.h"
+
+namespace WebCore {
+class RTCDataChannelDescriptor;
+}
+
+namespace WebKit {
+
+class WebRTCDataChannel {
+public:
+ class ExtraData {
+ public:
+ virtual ~ExtraData() { }
+ };
+
+ enum ReadyState {
+ ReadyStateConnecting = 0,
+ ReadyStateOpen = 1,
+ ReadyStateClosing = 2,
+ ReadyStateClosed = 3,
+ };
+
+ WebRTCDataChannel() { }
+ WebRTCDataChannel(const WebRTCDataChannel& other) { assign(other); }
+ ~WebRTCDataChannel() { reset(); }
+
+ WebRTCDataChannel& operator=(const WebRTCDataChannel& other)
+ {
+ assign(other);
+ return *this;
+ }
+
+ WEBKIT_EXPORT void initialize(const WebString& label, bool reliable);
+
+ WEBKIT_EXPORT void assign(const WebRTCDataChannel&);
+
+ WEBKIT_EXPORT void reset();
+ bool isNull() const { return m_private.isNull(); }
+
+ WEBKIT_EXPORT WebString label() const;
+ WEBKIT_EXPORT bool reliable() const;
+
+ WEBKIT_EXPORT void setBufferedAmount(unsigned long);
+ WEBKIT_EXPORT void readyStateChanged(ReadyState);
+ WEBKIT_EXPORT void dataArrived(const WebString&);
+ WEBKIT_EXPORT void dataArrived(const char*, size_t);
+ WEBKIT_EXPORT void error();
+
+ // Extra data associated with this WebRTCDataChannel.
+ // If non-null, the extra data pointer will be deleted when the object is destroyed.
+ // Setting the extra data pointer will cause any existing non-null
+ // extra data pointer to be deleted.
+ WEBKIT_EXPORT ExtraData* extraData() const;
+ WEBKIT_EXPORT void setExtraData(ExtraData*);
+
+#if WEBKIT_IMPLEMENTATION
+ WebRTCDataChannel(const WTF::PassRefPtr<WebCore::RTCDataChannelDescriptor>&);
+ WebRTCDataChannel(WebCore::RTCDataChannelDescriptor*);
+ operator WTF::PassRefPtr<WebCore::RTCDataChannelDescriptor>() const;
+ operator WebCore::RTCDataChannelDescriptor*() const;
+#endif
+
+private:
+ WebPrivatePtr<WebCore::RTCDataChannelDescriptor> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebRTCDataChannel_h
Modified: trunk/Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h (131493 => 131494)
--- trunk/Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h 2012-10-16 20:41:36 UTC (rev 131494)
@@ -35,12 +35,14 @@
class WebMediaConstraints;
class WebMediaStreamDescriptor;
class WebRTCConfiguration;
+class WebRTCDataChannel;
class WebRTCICECandidate;
class WebRTCPeerConnectionHandlerClient;
class WebRTCSessionDescription;
class WebRTCSessionDescriptionRequest;
class WebRTCStatsRequest;
class WebRTCVoidRequest;
+class WebString;
class WebRTCPeerConnectionHandler {
public:
@@ -61,6 +63,12 @@
// FIXME: Remove default implementation when clients have changed.
virtual void getStats(const WebRTCStatsRequest&) { }
virtual void stop() = 0;
+
+ // RTCDataChannel
+ virtual bool openDataChannel(const WebRTCDataChannel&) { return false; }
+ virtual bool sendStringData(const WebRTCDataChannel&, const WebString&) { return false; }
+ virtual bool sendRawData(const WebRTCDataChannel&, const char*, size_t) { return false; }
+ virtual void closeDataChannel(const WebRTCDataChannel&) { }
};
} // namespace WebKit
Modified: trunk/Source/WebCore/ChangeLog (131493 => 131494)
--- trunk/Source/WebCore/ChangeLog 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Source/WebCore/ChangeLog 2012-10-16 20:41:36 UTC (rev 131494)
@@ -1,3 +1,42 @@
+2012-10-16 Tommy Widenflycht <tom...@google.com>
+
+ MediaStream API: Add the chromium API for RTCDataChannel
+ https://bugs.webkit.org/show_bug.cgi?id=99435
+
+ Reviewed by Adam Barth.
+
+ Adding WebRTCDataChannel.
+
+ Test: fast/mediastream/RTCPeerConnection-datachannel.html
+
+ * WebCore.gypi:
+ * platform/chromium/support/WebRTCDataChannel.cpp: Added.
+ (WebKit):
+ (ExtraDataContainer):
+ (WebKit::ExtraDataContainer::ExtraDataContainer):
+ (WebKit::ExtraDataContainer::extraData):
+ (WebKit::WebRTCDataChannel::WebRTCDataChannel):
+ (WebKit::WebRTCDataChannel::initialize):
+ (WebKit::WebRTCDataChannel::assign):
+ (WebKit::WebRTCDataChannel::reset):
+ (WebKit::WebRTCDataChannel::operator PassRefPtr<WebCore::RTCDataChannelDescriptor>):
+ (WebKit::WebRTCDataChannel::operator WebCore::RTCDataChannelDescriptor*):
+ (WebKit::WebRTCDataChannel::extraData):
+ (WebKit::WebRTCDataChannel::setExtraData):
+ (WebKit::WebRTCDataChannel::label):
+ (WebKit::WebRTCDataChannel::reliable):
+ (WebKit::WebRTCDataChannel::setBufferedAmount):
+ (WebKit::WebRTCDataChannel::readyStateChanged):
+ (WebKit::WebRTCDataChannel::dataArrived):
+ (WebKit::WebRTCDataChannel::error):
+ * platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
+ (WebCore::RTCPeerConnectionHandlerChromium::negotiationNeeded):
+ (WebCore::RTCPeerConnectionHandlerChromium::didGenerateICECandidate):
+ (WebCore):
+ (WebCore::RTCPeerConnectionHandlerChromium::didChangeReadyState):
+ (WebCore::RTCPeerConnectionHandlerChromium::didChangeICEState):
+ (WebCore::RTCPeerConnectionHandlerChromium::didRemoveRemoteStream):
+
2012-10-16 Brady Eidson <beid...@apple.com>
Update indentation in *ResourceLoader headers to match modern WebKit style
Modified: trunk/Source/WebCore/WebCore.gypi (131493 => 131494)
--- trunk/Source/WebCore/WebCore.gypi 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Source/WebCore/WebCore.gypi 2012-10-16 20:41:36 UTC (rev 131494)
@@ -8391,6 +8391,7 @@
'platform/chromium/support/WebMediaStreamSourcesRequest.cpp',
'platform/chromium/support/WebPrerender.cpp',
'platform/chromium/support/WebRTCConfiguration.cpp',
+ 'platform/chromium/support/WebRTCDataChannel.cpp',
'platform/chromium/support/WebRTCICECandidate.cpp',
'platform/chromium/support/WebRTCSessionDescription.cpp',
'platform/chromium/support/WebRTCSessionDescriptionRequest.cpp',
Added: trunk/Source/WebCore/platform/chromium/support/WebRTCDataChannel.cpp (0 => 131494)
--- trunk/Source/WebCore/platform/chromium/support/WebRTCDataChannel.cpp (rev 0)
+++ trunk/Source/WebCore/platform/chromium/support/WebRTCDataChannel.cpp 2012-10-16 20:41:36 UTC (rev 131494)
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include <public/WebRTCDataChannel.h>
+
+#include "RTCDataChannelDescriptor.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class ExtraDataContainer : public WebCore::RTCDataChannelDescriptor::ExtraData {
+public:
+ ExtraDataContainer(WebRTCDataChannel::ExtraData* extraData) : m_extraData(WTF::adoptPtr(extraData)) { }
+
+ WebRTCDataChannel::ExtraData* extraData() { return m_extraData.get(); }
+
+private:
+ OwnPtr<WebRTCDataChannel::ExtraData> m_extraData;
+};
+
+WebRTCDataChannel::WebRTCDataChannel(const PassRefPtr<RTCDataChannelDescriptor>& dataChannel)
+ : m_private(dataChannel)
+{
+}
+
+WebRTCDataChannel::WebRTCDataChannel(RTCDataChannelDescriptor* dataChannel)
+ : m_private(dataChannel)
+{
+}
+
+void WebRTCDataChannel::initialize(const WebString& label, bool reliable)
+{
+ m_private = RTCDataChannelDescriptor::create(label, reliable);
+}
+
+void WebRTCDataChannel::assign(const WebRTCDataChannel& other)
+{
+ m_private = other.m_private;
+}
+
+void WebRTCDataChannel::reset()
+{
+ m_private.reset();
+}
+
+WebRTCDataChannel::operator PassRefPtr<WebCore::RTCDataChannelDescriptor>() const
+{
+ return m_private.get();
+}
+
+WebRTCDataChannel::operator WebCore::RTCDataChannelDescriptor*() const
+{
+ return m_private.get();
+}
+
+WebRTCDataChannel::ExtraData* WebRTCDataChannel::extraData() const
+{
+ RefPtr<RTCDataChannelDescriptor::ExtraData> data = ""
+ if (!data)
+ return 0;
+ return static_cast<ExtraDataContainer*>(data.get())->extraData();
+}
+
+void WebRTCDataChannel::setExtraData(ExtraData* extraData)
+{
+ m_private->setExtraData(adoptRef(new ExtraDataContainer(extraData)));
+}
+
+WebString WebRTCDataChannel::label() const
+{
+ ASSERT(!isNull());
+ return m_private->label();
+}
+
+bool WebRTCDataChannel::reliable() const
+{
+ ASSERT(!isNull());
+ return m_private->reliable();
+}
+
+void WebRTCDataChannel::setBufferedAmount(unsigned long bufferedAmount)
+{
+ ASSERT(!isNull());
+ m_private->setBufferedAmount(bufferedAmount);
+}
+
+void WebRTCDataChannel::readyStateChanged(ReadyState state)
+{
+ ASSERT(!isNull());
+ m_private->readyStateChanged(static_cast<RTCDataChannelDescriptor::ReadyState>(state));
+}
+
+void WebRTCDataChannel::dataArrived(const WebString& data)
+{
+ ASSERT(!isNull());
+ m_private->dataArrived(data);
+}
+
+void WebRTCDataChannel::dataArrived(const char* data, size_t dataLength)
+{
+ ASSERT(!isNull());
+ m_private->dataArrived(data, dataLength);
+}
+
+void WebRTCDataChannel::error()
+{
+ ASSERT(!isNull());
+ m_private->error();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
+
Modified: trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp (131493 => 131494)
--- trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp 2012-10-16 20:41:36 UTC (rev 131494)
@@ -47,6 +47,7 @@
#include <public/WebMediaConstraints.h>
#include <public/WebMediaStreamDescriptor.h>
#include <public/WebRTCConfiguration.h>
+#include <public/WebRTCDataChannel.h>
#include <public/WebRTCICECandidate.h>
#include <public/WebRTCSessionDescription.h>
#include <public/WebRTCSessionDescriptionRequest.h>
@@ -175,6 +176,38 @@
m_webHandler->getStats(request);
}
+bool RTCPeerConnectionHandlerChromium::openDataChannel(PassRefPtr<RTCDataChannelDescriptor> dataChannel)
+{
+ if (!m_webHandler)
+ return false;
+
+ return m_webHandler->openDataChannel(dataChannel);
+}
+
+bool RTCPeerConnectionHandlerChromium::sendStringData(PassRefPtr<RTCDataChannelDescriptor> dataChannel, const String& data)
+{
+ if (!m_webHandler)
+ return false;
+
+ return m_webHandler->sendStringData(dataChannel, data);
+}
+
+bool RTCPeerConnectionHandlerChromium::sendRawData(PassRefPtr<RTCDataChannelDescriptor> dataChannel, const char* data, size_t dataLength)
+{
+ if (!m_webHandler)
+ return false;
+
+ return m_webHandler->sendRawData(dataChannel, data, dataLength);
+}
+
+void RTCPeerConnectionHandlerChromium::closeDataChannel(PassRefPtr<RTCDataChannelDescriptor> dataChannel)
+{
+ if (!m_webHandler)
+ return;
+
+ return m_webHandler->closeDataChannel(dataChannel);
+}
+
void RTCPeerConnectionHandlerChromium::stop()
{
if (!m_webHandler)
@@ -213,29 +246,6 @@
m_client->didRemoveRemoteStream(webMediaStreamDescriptor);
}
-bool RTCPeerConnectionHandlerChromium::openDataChannel(PassRefPtr<RTCDataChannelDescriptor> dataChannel)
-{
- // FIXME: Implement when WebKit changes have landed.
- return false;
-}
-
-bool RTCPeerConnectionHandlerChromium::sendStringData(PassRefPtr<RTCDataChannelDescriptor> dataChannel, const String& data)
-{
- // FIXME: Implement when WebKit changes have landed.
- return false;
-}
-
-bool RTCPeerConnectionHandlerChromium::sendRawData(PassRefPtr<RTCDataChannelDescriptor> dataChannel, const char* data, size_t dataLength)
-{
- // FIXME: Implement when WebKit changes have landed.
- return false;
-}
-
-void RTCPeerConnectionHandlerChromium::closeDataChannel(PassRefPtr<RTCDataChannelDescriptor> dataChannel)
-{
- // FIXME: Implement when WebKit changes have landed.
-}
-
} // namespace WebCore
#endif // ENABLE(MEDIA_STREAM)
Modified: trunk/Source/WebKit/chromium/ChangeLog (131493 => 131494)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-10-16 20:41:36 UTC (rev 131494)
@@ -1,3 +1,14 @@
+2012-10-16 Tommy Widenflycht <tom...@google.com>
+
+ MediaStream API: Add the chromium API for RTCDataChannel
+ https://bugs.webkit.org/show_bug.cgi?id=99435
+
+ Reviewed by Adam Barth.
+
+ Adding checks for RTCDataChannel.
+
+ * src/AssertMatchingEnums.cpp:
+
2012-10-16 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed. Rolled DEPS.
Modified: trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp (131493 => 131494)
--- trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp 2012-10-16 20:41:36 UTC (rev 131494)
@@ -64,6 +64,7 @@
#include "PageVisibilityState.h"
#include "PeerConnection00.h"
#include "PlatformCursor.h"
+#include "RTCDataChannelDescriptor.h"
#include "RTCPeerConnectionHandlerClient.h"
#include "ReferrerPolicy.h"
#include "ResourceResponse.h"
@@ -116,6 +117,7 @@
#include <public/WebMediaStreamSource.h>
#include <public/WebPeerConnection00Handler.h>
#include <public/WebPeerConnection00HandlerClient.h>
+#include <public/WebRTCDataChannel.h>
#include <public/WebRTCPeerConnectionHandler.h>
#include <public/WebRTCPeerConnectionHandlerClient.h>
#include <public/WebReferrerPolicy.h>
@@ -591,6 +593,11 @@
COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateCompleted, RTCPeerConnectionHandlerClient::IceStateCompleted);
COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateFailed, RTCPeerConnectionHandlerClient::IceStateFailed);
COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateClosed, RTCPeerConnectionHandlerClient::IceStateClosed);
+
+COMPILE_ASSERT_MATCHING_ENUM(WebRTCDataChannel::ReadyStateConnecting, RTCDataChannelDescriptor::ReadyStateConnecting);
+COMPILE_ASSERT_MATCHING_ENUM(WebRTCDataChannel::ReadyStateOpen, RTCDataChannelDescriptor::ReadyStateOpen);
+COMPILE_ASSERT_MATCHING_ENUM(WebRTCDataChannel::ReadyStateClosing, RTCDataChannelDescriptor::ReadyStateClosing);
+COMPILE_ASSERT_MATCHING_ENUM(WebRTCDataChannel::ReadyStateClosed, RTCDataChannelDescriptor::ReadyStateClosed);
#endif
#if ENABLE(SCRIPTED_SPEECH)
Modified: trunk/Tools/ChangeLog (131493 => 131494)
--- trunk/Tools/ChangeLog 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Tools/ChangeLog 2012-10-16 20:41:36 UTC (rev 131494)
@@ -1,3 +1,31 @@
+2012-10-16 Tommy Widenflycht <tom...@google.com>
+
+ MediaStream API: Add the chromium API for RTCDataChannel
+ https://bugs.webkit.org/show_bug.cgi?id=99435
+
+ Reviewed by Adam Barth.
+
+ Adding mock support for WebRTCDataChannel.
+
+ * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
+ (StringDataTask):
+ (StringDataTask::StringDataTask):
+ (CharPtrDataTask):
+ (CharPtrDataTask::CharPtrDataTask):
+ (DataChannelReadyStateTask):
+ (DataChannelReadyStateTask::DataChannelReadyStateTask):
+ (RTCPeerConnectionReadyStateTask):
+ (RTCPeerConnectionReadyStateTask::RTCPeerConnectionReadyStateTask):
+ (MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler):
+ (MockWebRTCPeerConnectionHandler::initialize):
+ (MockWebRTCPeerConnectionHandler::stop):
+ (MockWebRTCPeerConnectionHandler::openDataChannel):
+ (MockWebRTCPeerConnectionHandler::closeDataChannel):
+ (MockWebRTCPeerConnectionHandler::sendStringData):
+ (MockWebRTCPeerConnectionHandler::sendRawData):
+ * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h:
+ (MockWebRTCPeerConnectionHandler):
+
2012-10-16 Chris Rogers <crog...@google.com>
Rename some AudioNodes
Modified: trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp (131493 => 131494)
--- trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp 2012-10-16 20:41:36 UTC (rev 131494)
@@ -124,17 +124,103 @@
bool m_succeeded;
};
+class StringDataTask : public MethodTask<MockWebRTCPeerConnectionHandler> {
+public:
+ StringDataTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, const WebString& data)
+ : MethodTask<MockWebRTCPeerConnectionHandler>(object)
+ , m_dataChannel(dataChannel)
+ , m_data(data)
+ {
+ }
+
+ virtual void runIfValid() OVERRIDE
+ {
+ m_dataChannel.dataArrived(m_data);
+ }
+
+private:
+ WebRTCDataChannel m_dataChannel;
+ WebString m_data;
+};
+
+class CharPtrDataTask : public MethodTask<MockWebRTCPeerConnectionHandler> {
+public:
+ CharPtrDataTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, const char* data, size_t length)
+ : MethodTask<MockWebRTCPeerConnectionHandler>(object)
+ , m_dataChannel(dataChannel)
+ , m_length(length)
+ {
+ m_data = new char[m_length];
+ memcpy(m_data, data, m_length);
+ }
+
+ virtual void runIfValid() OVERRIDE
+ {
+ m_dataChannel.dataArrived(m_data, m_length);
+ delete m_data;
+ }
+
+private:
+ WebRTCDataChannel m_dataChannel;
+ char* m_data;
+ size_t m_length;
+};
+
+class DataChannelReadyStateTask : public MethodTask<MockWebRTCPeerConnectionHandler> {
+public:
+ DataChannelReadyStateTask(MockWebRTCPeerConnectionHandler* object, const WebRTCDataChannel& dataChannel, WebRTCDataChannel::ReadyState state)
+ : MethodTask<MockWebRTCPeerConnectionHandler>(object)
+ , m_dataChannel(dataChannel)
+ , m_state(state)
+ {
+ }
+
+ virtual void runIfValid() OVERRIDE
+ {
+ m_dataChannel.readyStateChanged(m_state);
+ }
+
+private:
+ WebRTCDataChannel m_dataChannel;
+ WebRTCDataChannel::ReadyState m_state;
+};
+
+class RTCPeerConnectionReadyStateTask : public MethodTask<MockWebRTCPeerConnectionHandler> {
+public:
+ RTCPeerConnectionReadyStateTask(MockWebRTCPeerConnectionHandler* object, WebRTCPeerConnectionHandlerClient* client, WebRTCPeerConnectionHandlerClient::ReadyState state)
+ : MethodTask<MockWebRTCPeerConnectionHandler>(object)
+ , m_client(client)
+ , m_state(state)
+ {
+ }
+
+ virtual void runIfValid() OVERRIDE
+ {
+ m_client->didChangeReadyState(m_state);
+ }
+
+private:
+ WebRTCPeerConnectionHandlerClient* m_client;
+ WebRTCPeerConnectionHandlerClient::ReadyState m_state;
+};
+
/////////////////////
MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler(WebRTCPeerConnectionHandlerClient* client)
: m_client(client)
+ , m_stopped(false)
, m_streamCount(0)
{
}
bool MockWebRTCPeerConnectionHandler::initialize(const WebRTCConfiguration&, const WebMediaConstraints& constraints)
{
- return MockConstraints::verifyConstraints(constraints);
+ if (MockConstraints::verifyConstraints(constraints)) {
+ postTask(new RTCPeerConnectionReadyStateTask(this, m_client, WebRTCPeerConnectionHandlerClient::ReadyStateActive));
+ return true;
+ }
+
+ return false;
}
void MockWebRTCPeerConnectionHandler::createOffer(const WebRTCSessionDescriptionRequest& request, const WebMediaConstraints& constraints)
@@ -230,6 +316,39 @@
void MockWebRTCPeerConnectionHandler::stop()
{
+ m_stopped = true;
}
+bool MockWebRTCPeerConnectionHandler::openDataChannel(const WebRTCDataChannel& dataChannel)
+{
+ if (m_stopped)
+ return false;
+
+ postTask(new DataChannelReadyStateTask(this, dataChannel, WebRTCDataChannel::ReadyStateOpen));
+ return true;
+}
+
+void MockWebRTCPeerConnectionHandler::closeDataChannel(const WebRTCDataChannel& dataChannel)
+{
+ postTask(new DataChannelReadyStateTask(this, dataChannel, WebRTCDataChannel::ReadyStateClosed));
+}
+
+bool MockWebRTCPeerConnectionHandler::sendStringData(const WebRTCDataChannel& dataChannel, const WebString& data)
+{
+ if (m_stopped)
+ return false;
+
+ postTask(new StringDataTask(this, dataChannel, data));
+ return true;
+}
+
+bool MockWebRTCPeerConnectionHandler::sendRawData(const WebRTCDataChannel& dataChannel, const char* data, size_t length)
+{
+ if (m_stopped)
+ return false;
+
+ postTask(new CharPtrDataTask(this, dataChannel, data, length));
+ return true;
+}
+
#endif // ENABLE(MEDIA_STREAM)
Modified: trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h (131493 => 131494)
--- trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h 2012-10-16 20:36:20 UTC (rev 131493)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h 2012-10-16 20:41:36 UTC (rev 131494)
@@ -34,6 +34,7 @@
#if ENABLE(MEDIA_STREAM)
#include "Task.h"
+#include <public/WebRTCDataChannel.h>
#include <public/WebRTCPeerConnectionHandler.h>
#include <public/WebRTCSessionDescription.h>
#include <public/WebRTCSessionDescriptionRequest.h>
@@ -62,6 +63,11 @@
virtual void getStats(const WebKit::WebRTCStatsRequest&) OVERRIDE;
virtual void stop() OVERRIDE;
+ virtual bool openDataChannel(const WebKit::WebRTCDataChannel&) OVERRIDE;
+ virtual bool sendStringData(const WebKit::WebRTCDataChannel&, const WebKit::WebString&) OVERRIDE;
+ virtual bool sendRawData(const WebKit::WebRTCDataChannel&, const char*, size_t) OVERRIDE;
+ virtual void closeDataChannel(const WebKit::WebRTCDataChannel&) OVERRIDE;
+
// Task related methods
TaskList* taskList() { return &m_taskList; }
@@ -69,6 +75,7 @@
MockWebRTCPeerConnectionHandler() { }
WebKit::WebRTCPeerConnectionHandlerClient* m_client;
+ bool m_stopped;
TaskList m_taskList;
WebKit::WebRTCSessionDescription m_localDescription;
WebKit::WebRTCSessionDescription m_remoteDescription;