Diff
Modified: trunk/LayoutTests/ChangeLog (214626 => 214627)
--- trunk/LayoutTests/ChangeLog 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/LayoutTests/ChangeLog 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,3 +1,13 @@
+2017-03-30 Youenn Fablet <you...@apple.com>
+
+ Clean up RTCDataChannel
+ https://bugs.webkit.org/show_bug.cgi?id=169732
+
+ Reviewed by Chris Dumez.
+
+ * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added.
+ * webrtc/datachannel/bufferedAmountLowThreshold.html: Added.
+
2017-03-30 Chris Dumez <cdu...@apple.com>
svg/animations/animations-paused-in-background-page.html is flaky
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (214626 => 214627)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,3 +1,12 @@
+2017-03-30 Youenn Fablet <you...@apple.com>
+
+ Clean up RTCDataChannel
+ https://bugs.webkit.org/show_bug.cgi?id=169732
+
+ Reviewed by Chris Dumez.
+
+ * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt:
+
2017-03-28 Youenn Fablet <you...@apple.com>
Fix addIceCandidate after r214441
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt (214626 => 214627)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,6 +1,6 @@
-FAIL RTCDataChannelEvent constructor without a required argument. Can't find variable: RTCDataChannelEvent
-FAIL RTCDataChannelEvent constructor with channel passed as null. assert_throws: function "function () { new RTCDataChannelEvent('type', { channel: null }); }" threw object "ReferenceError: Can't find variable: RTCDataChannelEvent" ("ReferenceError") expected object "TypeError" ("TypeError")
-FAIL RTCDataChannelEvent constructor with a channel passed as undefined. assert_throws: function "function () { new RTCDataChannelEvent('type', { channel: undefined }); }" threw object "ReferenceError: Can't find variable: RTCDataChannelEvent" ("ReferenceError") expected object "TypeError" ("TypeError")
-FAIL RTCDataChannelEvent constructor with full arguments. Can't find variable: RTCDataChannelEvent
+PASS RTCDataChannelEvent constructor without a required argument.
+PASS RTCDataChannelEvent constructor with channel passed as null.
+PASS RTCDataChannelEvent constructor with a channel passed as undefined.
+PASS RTCDataChannelEvent constructor with full arguments.
Modified: trunk/LayoutTests/webrtc/datachannel/basic.html (214626 => 214627)
--- trunk/LayoutTests/webrtc/datachannel/basic.html 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/LayoutTests/webrtc/datachannel/basic.html 2017-03-30 21:42:19 UTC (rev 214627)
@@ -95,7 +95,7 @@
remoteChannel = event.channel;
remoteChannel._onmessage_ = receiveMessages;
};
- }, (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("udp") == -1; });
+ }, { filterOutICECandidate: (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("udp") == -1; } });
});
}, "Basic data channel exchange from offerer to receiver using UDP only");
@@ -114,7 +114,7 @@
remoteChannel = event.channel;
remoteChannel._onmessage_ = receiveMessages;
};
- }, (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("tcp") == -1; });
+ }, { filterOutICECandidate: (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("tcp") == -1; } });
});
}, "Basic data channel exchange from offerer to receiver using TCP only");
@@ -136,7 +136,7 @@
finishTest = resolve;
createConnections((localConnection) => {
- var init = { ordered: true, maxPacketLifeTime: 10, maxRetransmitTime: 11, protocol: "whatever", negotiated: false, id: "id" };
+ var init = { ordered: true, maxPacketLifeTime: 10, maxRetransmitTime: 11, protocol: "whatever", negotiated: false, id: 1 };
localChannel = localConnection.createDataChannel('sendDataChannel', init);
localChannel._onopen_ = () => { sendMessages(localChannel) };
}, (remoteConnection) => {
Added: trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-expected.txt (0 => 214627)
--- trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-expected.txt (rev 0)
+++ trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-expected.txt 2017-03-30 21:42:19 UTC (rev 214627)
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: line 76: channel send is throwing
+CONSOLE MESSAGE: line 76: channel send is throwing
+
+PASS Default buffer threshold
+PASS Large buffer threshold reached
+PASS Medium buffer threshold not reached
+
Added: trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold.html (0 => 214627)
--- trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold.html (rev 0)
+++ trunk/LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold.html 2017-03-30 21:42:19 UTC (rev 214627)
@@ -0,0 +1,143 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Testing bufferedAmountLowThreashold RTCDataChannel attribute and event</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script src =""
+ <script>
+var localChannel;
+var remoteChannel;
+
+function closeDataChannels() {
+ localChannel.close();
+ remoteChannel.close();
+ closeConnections();
+}
+
+var longString = "abcdefgh";
+for (var cptr = 0; cptr < 14; ++cptr)
+ longString += longString;
+
+function sendMessages(channel)
+{
+ channel.send(longString);
+ channel.send(longString);
+}
+
+function receiveMessages(event) {
+ if (++counter === 1)
+ return;
+ finishTest();
+}
+
+var finishTest;
+
+promise_test((test) => {
+ counter = 0;
+ var gotEvent = false;
+ return new Promise((resolve, reject) => {
+ if (window.internals)
+ internals.useMockRTCPeerConnectionFactory("TwoRealPeerConnections");
+
+ finishTest = resolve;
+ createConnections((localConnection) => {
+ localChannel = localConnection.createDataChannel('sendDataChannel');
+ localChannel._onopen_ = () => { sendMessages(localChannel); };
+ localChannel._onbufferedamountlow_ = () => {
+ gotEvent = true;
+ }
+ assert_equals(localChannel.bufferedAmountLowThreshold, 0, "default bufferedAmountLowThreshold value");
+ }, (remoteConnection) => {
+ remoteConnection._ondatachannel_ = (event) => {
+ remoteChannel = event.channel;
+ remoteChannel._onmessage_ = receiveMessages;
+ };
+ });
+ }).then (() => {
+ return waitFor(500);
+ }).then (() => {
+ closeDataChannels();
+ assert_true(gotEvent, "got onbufferedamountlow event");
+ });
+}, "Default buffer threshold");
+
+function sendContinuouslyMessages(channel)
+{
+ try {
+ while (channel.bufferedAmount < 200000)
+ channel.send(longString);
+
+ setTimeout(() => sendContinuouslyMessages(channel), 1);
+ } catch(e) {
+ console.log("channel send is throwing");
+ }
+}
+
+promise_test((test) => {
+ counter = 0;
+ var gotEvent = false;
+ return new Promise((resolve, reject) => {
+ if (window.internals)
+ internals.useMockRTCPeerConnectionFactory("TwoRealPeerConnections");
+
+ finishTest = resolve;
+ createConnections((localConnection) => {
+ localChannel = localConnection.createDataChannel('sendDataChannel');
+ localChannel._onopen_ = () => {
+ sendContinuouslyMessages(localChannel);
+ localChannel._onbufferedamountlow_ = () => {
+ gotEvent = true;
+ }
+ };
+ localChannel.bufferedAmountLowThreshold = 200000;
+ }, (remoteConnection) => {
+ remoteConnection._ondatachannel_ = (event) => {
+ remoteChannel = event.channel;
+ remoteChannel._onmessage_ = receiveMessages;
+ };
+ });
+ }).then (() => {
+ return waitFor(500);
+ }).then (() => {
+ closeDataChannels();
+ assert_true(gotEvent, "got onbufferedamountlow event");
+ });
+}, "Large buffer threshold reached");
+
+promise_test((test) => {
+ counter = 0;
+ var gotEvent = false;
+ return new Promise((resolve, reject) => {
+ if (window.internals)
+ internals.useMockRTCPeerConnectionFactory("TwoRealPeerConnections");
+
+ finishTest = resolve;
+ createConnections((localConnection) => {
+ localChannel = localConnection.createDataChannel('sendDataChannel');
+ localChannel._onopen_ = () => {
+ sendContinuouslyMessages(localChannel);
+ localChannel._onbufferedamountlow_ = () => {
+ gotEvent = true;
+ }
+ };
+ localChannel.bufferedAmountLowThreshold = 100000;
+ }, (remoteConnection) => {
+ remoteConnection._ondatachannel_ = (event) => {
+ remoteChannel = event.channel;
+ remoteChannel._onmessage_ = receiveMessages;
+ };
+ });
+ }).then (() => {
+ return waitFor(500);
+ }).then (() => {
+ closeDataChannels();
+ assert_false(gotEvent, "got onbufferedamountlow event");
+ });
+}, "Medium buffer threshold not reached");
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/webrtc/datachannel/datachannel-event-expected.txt (0 => 214627)
--- trunk/LayoutTests/webrtc/datachannel/datachannel-event-expected.txt (rev 0)
+++ trunk/LayoutTests/webrtc/datachannel/datachannel-event-expected.txt 2017-03-30 21:42:19 UTC (rev 214627)
@@ -0,0 +1,3 @@
+
+PASS Testing data channel event constructor
+
Added: trunk/LayoutTests/webrtc/datachannel/datachannel-event.html (0 => 214627)
--- trunk/LayoutTests/webrtc/datachannel/datachannel-event.html (rev 0)
+++ trunk/LayoutTests/webrtc/datachannel/datachannel-event.html 2017-03-30 21:42:19 UTC (rev 214627)
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Testing RTCDataChannelEvent</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+test(() => {
+ var pc = new RTCPeerConnection();
+ var channel = pc.createDataChannel("test");
+
+ assert_throws(new TypeError, () => new RTCDataChannelEvent());
+ assert_throws(new TypeError, () => new RTCDataChannelEvent("test"));
+ assert_throws(new TypeError, () => new RTCDataChannelEvent("test", undefined));
+ assert_throws(new TypeError, () => new RTCDataChannelEvent("test", { channel: 1 }));
+ assert_throws(new TypeError, () => new RTCDataChannelEvent(undefined, { channel: 1 }));
+
+ var event = new RTCDataChannelEvent("test", { channel: channel });
+ assert_equals(event.channel, channel, "channel passed in constructor should be used");
+ assert_equals(event.type, "test");
+ assert_equals(event.isTrusted, false, "trusted");
+ assert_equals(event.bubbles, false, "bubble");
+ assert_equals(event.cancelable, false, "cancelable");
+
+}, "Testing data channel event constructor");
+ </script>
+ </body>
+</html>
Modified: trunk/LayoutTests/webrtc/routines.js (214626 => 214627)
--- trunk/LayoutTests/webrtc/routines.js 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/LayoutTests/webrtc/routines.js 2017-03-30 21:42:19 UTC (rev 214627)
@@ -2,16 +2,16 @@
var localConnection;
var remoteConnection;
-function createConnections(setupLocalConnection, setupRemoteConnection, filterOutICECandidate) {
+function createConnections(setupLocalConnection, setupRemoteConnection, options = { }) {
localConnection = new RTCPeerConnection();
- localConnection._onicecandidate_ = (event) => { iceCallback1(event, filterOutICECandidate) };
+ localConnection._onicecandidate_ = (event) => { iceCallback1(event, options.filterOutICECandidate) };
setupLocalConnection(localConnection);
remoteConnection = new RTCPeerConnection();
- remoteConnection._onicecandidate_ = (event) => { iceCallback2(event, filterOutICECandidate) };
+ remoteConnection._onicecandidate_ = (event) => { iceCallback2(event, options.filterOutICECandidate) };
setupRemoteConnection(remoteConnection);
- localConnection.createOffer().then(gotDescription1, onCreateSessionDescriptionError);
+ localConnection.createOffer().then((desc) => gotDescription1(desc, options), onCreateSessionDescriptionError);
return [localConnection, remoteConnection]
}
@@ -27,15 +27,21 @@
assert_unreached();
}
-function gotDescription1(desc)
+function gotDescription1(desc, options)
{
+ if (options.observeOffer)
+ options.observeOffer(desc);
+
localConnection.setLocalDescription(desc);
remoteConnection.setRemoteDescription(desc);
- remoteConnection.createAnswer().then(gotDescription2, onCreateSessionDescriptionError);
+ remoteConnection.createAnswer().then((desc) => gotDescription2(desc, options), onCreateSessionDescriptionError);
}
-function gotDescription2(desc)
+function gotDescription2(desc, options)
{
+ if (options.observeAnswer)
+ options.observeAnswer(desc);
+
remoteConnection.setLocalDescription(desc);
localConnection.setRemoteDescription(desc);
}
Modified: trunk/Source/_javascript_Core/ChangeLog (214626 => 214627)
--- trunk/Source/_javascript_Core/ChangeLog 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,3 +1,12 @@
+2017-03-30 Youenn Fablet <you...@apple.com>
+
+ Clean up RTCDataChannel
+ https://bugs.webkit.org/show_bug.cgi?id=169732
+
+ Reviewed by Chris Dumez.
+
+ * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent.
+
2017-03-30 Saam Barati <sbar...@apple.com>
WebAssembly: pass Wasm::Context* to vmEntryToWasm when not using fast TLS
Modified: trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h (214626 => 214627)
--- trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/_javascript_Core/runtime/CommonIdentifiers.h 2017-03-30 21:42:19 UTC (rev 214627)
@@ -100,8 +100,10 @@
macro(ReferenceError) \
macro(Reflect) \
macro(RegExp) \
+ macro(Request) \
macro(Response) \
- macro(Request) \
+ macro(RTCDataChannel) \
+ macro(RTCDataChannelEvent) \
macro(RTCDTMFToneChangeEvent) \
macro(RTCIceCandidate) \
macro(RTCIceTransport) \
Modified: trunk/Source/WebCore/ChangeLog (214626 => 214627)
--- trunk/Source/WebCore/ChangeLog 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/ChangeLog 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,3 +1,59 @@
+2017-03-30 Youenn Fablet <you...@apple.com> and Jon Lee <jon...@apple.com>
+
+ Clean up RTCDataChannel
+ https://bugs.webkit.org/show_bug.cgi?id=169732
+
+ Reviewed by Chris Dumez.
+
+ Test: webrtc/datachannel/datachannel-event.html
+ webrtc/datachannel/bufferedAmountLowThreshold.html
+
+ Making RTCDataChannel interface closer to the spec updating implementation accordingly.
+ See https://w3c.github.io/webrtc-pc/#rtcdatachannel.
+ In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes.
+ Doing some additional cleaning refactoring.
+
+ Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by
+ libwebrtc without needing to get it from the libwebrtc network thread again.
+ In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc
+ OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be
+ updated to increase in the send method.
+
+ Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount.
+
+ * Modules/mediastream/RTCDataChannel.cpp:
+ (WebCore::RTCDataChannel::send):
+ (WebCore::RTCDataChannel::close):
+ (WebCore::RTCDataChannel::didChangeReadyState):
+ (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
+ * Modules/mediastream/RTCDataChannel.h:
+ * Modules/mediastream/RTCDataChannel.idl:
+ * Modules/mediastream/RTCDataChannelEvent.cpp:
+ (WebCore::RTCDataChannelEvent::create):
+ (WebCore::RTCDataChannelEvent::RTCDataChannelEvent):
+ (WebCore::RTCDataChannelEvent::channel):
+ * Modules/mediastream/RTCDataChannelEvent.h:
+ * Modules/mediastream/RTCDataChannelEvent.idl:
+ * Modules/mediastream/RTCPeerConnection.idl:
+ * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
+ (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
+ * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+ (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/EventNames.h:
+ * platform/mediastream/RTCDataChannelHandler.h:
+ * platform/mediastream/RTCDataChannelHandlerClient.h:
+ * platform/mediastream/RTCDataChannelState.h: Added.
+ * platform/mediastream/RTCPeerConnectionHandlerClient.h:
+ * platform/mock/RTCDataChannelHandlerMock.cpp:
+ (WebCore::RTCDataChannelHandlerMock::setClient):
+ (WebCore::RTCDataChannelHandlerMock::close):
+ * platform/mock/RTCNotifiersMock.cpp:
+ (WebCore::IceConnectionNotifier::IceConnectionNotifier):
+ (WebCore::SignalingStateNotifier::SignalingStateNotifier):
+ (WebCore::DataChannelStateNotifier::DataChannelStateNotifier):
+ * platform/mock/RTCNotifiersMock.h:
+
2017-03-30 Javier Fernandez <jfernan...@igalia.com>
[css-align] Adapt content-alignment properties to the new baseline syntax
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp (214626 => 214627)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -71,30 +72,11 @@
{
}
-const AtomicString& RTCDataChannel::readyState() const
-{
- static NeverDestroyed<AtomicString> connectingState("connecting", AtomicString::ConstructFromLiteral);
- static NeverDestroyed<AtomicString> openState("open", AtomicString::ConstructFromLiteral);
- static NeverDestroyed<AtomicString> closingState("closing", AtomicString::ConstructFromLiteral);
- static NeverDestroyed<AtomicString> closedState("closed", AtomicString::ConstructFromLiteral);
-
- switch (m_readyState) {
- case ReadyStateConnecting:
- return connectingState;
- case ReadyStateOpen:
- return openState;
- case ReadyStateClosing:
- return closingState;
- case ReadyStateClosed:
- return closedState;
- }
-
- ASSERT_NOT_REACHED();
- return emptyAtom;
-}
-
size_t RTCDataChannel::bufferedAmount() const
{
+ // FIXME: We should compute our own bufferedAmount and not count on m_handler which is made null at closing time.
+ if (m_stopped)
+ return 0;
return m_handler->bufferedAmount();
}
@@ -124,7 +106,8 @@
ExceptionOr<void> RTCDataChannel::send(const String& data)
{
- if (m_readyState != ReadyStateOpen)
+ // FIXME: We should only throw in Connected state.
+ if (m_readyState != RTCDataChannelState::Open)
return Exception { INVALID_STATE_ERR };
if (!m_handler->sendStringData(data)) {
@@ -137,7 +120,8 @@
ExceptionOr<void> RTCDataChannel::send(ArrayBuffer& data)
{
- if (m_readyState != ReadyStateOpen)
+ // FIXME: We should only throw in Connected state.
+ if (m_readyState != RTCDataChannelState::Open)
return Exception { INVALID_STATE_ERR };
size_t dataLength = data.byteLength();
@@ -156,6 +140,7 @@
ExceptionOr<void> RTCDataChannel::send(ArrayBufferView& data)
{
+ // FIXME: We should only throw in Connected state.
return send(*data.unsharedBuffer());
}
@@ -171,7 +156,7 @@
return;
m_stopped = true;
- m_readyState = ReadyStateClosed;
+ m_readyState = RTCDataChannelState::Closed;
m_handler->close();
m_handler->setClient(nullptr);
@@ -179,18 +164,18 @@
unsetPendingActivity(this);
}
-void RTCDataChannel::didChangeReadyState(ReadyState newState)
+void RTCDataChannel::didChangeReadyState(RTCDataChannelState newState)
{
- if (m_stopped || m_readyState == ReadyStateClosed || m_readyState == newState)
+ if (m_stopped || m_readyState == RTCDataChannelState::Closed || m_readyState == newState)
return;
m_readyState = newState;
switch (m_readyState) {
- case ReadyStateOpen:
+ case RTCDataChannelState::Open:
scheduleDispatchEvent(Event::create(eventNames().openEvent, false, false));
break;
- case ReadyStateClosed:
+ case RTCDataChannelState::Closed:
scheduleDispatchEvent(Event::create(eventNames().closeEvent, false, false));
break;
default:
@@ -231,13 +216,13 @@
scheduleDispatchEvent(Event::create(eventNames().errorEvent, false, false));
}
-void RTCDataChannel::bufferedAmountIsDecreasing()
+void RTCDataChannel::bufferedAmountIsDecreasing(size_t amount)
{
if (m_stopped)
return;
- if (bufferedAmount() <= m_bufferedAmountLowThreshold)
- scheduleDispatchEvent(Event::create(eventNames().bufferedAmountLowThresholdEvent, false, false));
+ if (amount <= m_bufferedAmountLowThreshold)
+ scheduleDispatchEvent(Event::create(eventNames().bufferedamountlowEvent, false, false));
}
void RTCDataChannel::stop()
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.h (214626 => 214627)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.h 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.h 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -57,7 +58,7 @@
std::optional<unsigned short> id() const { return m_options.id; };
String label() const { return m_label; }
- const AtomicString& readyState() const;
+ RTCDataChannelState readyState() const {return m_readyState; }
size_t bufferedAmount() const;
size_t bufferedAmountLowThreshold() const { return m_bufferedAmountLowThreshold; }
void setBufferedAmountLowThreshold(size_t value) { m_bufferedAmountLowThreshold = value; }
@@ -90,21 +91,21 @@
// ActiveDOMObject API
void stop() final;
const char* activeDOMObjectName() const final { return "RTCDataChannel"; }
- bool canSuspendForDocumentSuspension() const final { return m_readyState == ReadyStateClosed; }
+ bool canSuspendForDocumentSuspension() const final { return m_readyState == RTCDataChannelState::Closed; }
// RTCDataChannelHandlerClient API
- void didChangeReadyState(ReadyState) final;
+ void didChangeReadyState(RTCDataChannelState) final;
void didReceiveStringData(const String&) final;
void didReceiveRawData(const char*, size_t) final;
void didDetectError() final;
- void bufferedAmountIsDecreasing() final;
+ void bufferedAmountIsDecreasing(size_t) final;
std::unique_ptr<RTCDataChannelHandler> m_handler;
+ // FIXME: m_stopped is probably redundant with m_readyState.
bool m_stopped { false };
+ RTCDataChannelState m_readyState { RTCDataChannelState::Connecting };
- ReadyState m_readyState { ReadyStateConnecting };
-
enum class BinaryType { Blob, ArrayBuffer };
BinaryType m_binaryType { BinaryType::ArrayBuffer };
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.idl (214626 => 214627)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.idl 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.idl 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,17 +26,20 @@
[
ActiveDOMObject,
Conditional=WEB_RTC,
- NoInterfaceObject,
+ EnabledAtRuntime=PeerConnection,
] interface RTCDataChannel : EventTarget {
- readonly attribute DOMString label;
+ // FIXME: Add support for priority attribute.
+
+ readonly attribute USVString label;
readonly attribute boolean ordered;
readonly attribute unsigned short? maxPacketLifeTime;
readonly attribute unsigned short? maxRetransmits;
- readonly attribute DOMString protocol;
+ readonly attribute USVString protocol;
readonly attribute boolean negotiated;
readonly attribute unsigned short? id;
- readonly attribute DOMString readyState;
+ readonly attribute RTCDataChannelState readyState;
readonly attribute unsigned long bufferedAmount;
+ attribute unsigned long bufferedAmountLowThreshold;
[SetterMayThrowException] attribute DOMString binaryType;
@@ -42,7 +46,7 @@
[MayThrowException] void send(ArrayBuffer data);
[MayThrowException] void send(ArrayBufferView data);
[MayThrowException] void send(Blob data);
- [MayThrowException] void send(DOMString data);
+ [MayThrowException] void send(USVString data);
void close();
@@ -50,4 +54,16 @@
attribute EventHandler onerror;
attribute EventHandler onclose;
attribute EventHandler onmessage;
+ attribute EventHandler onbufferedamountlow;
};
+
+[
+ Conditional=WEB_RTC,
+ EnabledAtRuntime=PeerConnection,
+ ImplementedAs=RTCDataChannelState
+] enum RTCDataChannelState {
+ "connecting",
+ "open",
+ "closing",
+ "closed"
+};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.cpp (214626 => 214627)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.cpp 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.cpp 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -36,6 +37,11 @@
return adoptRef(*new RTCDataChannelEvent(type, canBubble, cancelable, WTFMove(channel)));
}
+Ref<RTCDataChannelEvent> RTCDataChannelEvent::create(const AtomicString& type, Init&& initializer, IsTrusted isTrusted)
+{
+ return adoptRef(*new RTCDataChannelEvent(type, WTFMove(initializer), isTrusted));
+}
+
RTCDataChannelEvent::RTCDataChannelEvent(const AtomicString& type, bool canBubble, bool cancelable, Ref<RTCDataChannel>&& channel)
: Event(type, canBubble, cancelable)
, m_channel(WTFMove(channel))
@@ -42,11 +48,17 @@
{
}
-RTCDataChannel* RTCDataChannelEvent::channel()
+RTCDataChannelEvent::RTCDataChannelEvent(const AtomicString& type, Init&& initializer, IsTrusted isTrusted)
+ : Event(type, initializer, isTrusted)
+ , m_channel(initializer.channel.releaseNonNull())
{
- return m_channel.ptr();
}
+RTCDataChannel& RTCDataChannelEvent::channel()
+{
+ return m_channel.get();
+}
+
EventInterface RTCDataChannelEvent::eventInterface() const
{
return RTCDataChannelEventInterfaceType;
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.h (214626 => 214627)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.h 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.h 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,16 +33,22 @@
namespace WebCore {
-class RTCDataChannelEvent : public Event {
+class RTCDataChannelEvent final : public Event {
public:
+ struct Init : EventInit {
+ RefPtr<RTCDataChannel> channel;
+ };
+
static Ref<RTCDataChannelEvent> create(const AtomicString& type, bool canBubble, bool cancelable, Ref<RTCDataChannel>&&);
+ static Ref<RTCDataChannelEvent> create(const AtomicString& type, Init&&, IsTrusted = IsTrusted::No);
- RTCDataChannel* channel();
+ RTCDataChannel& channel();
virtual EventInterface eventInterface() const;
private:
RTCDataChannelEvent(const AtomicString& type, bool canBubble, bool cancelable, Ref<RTCDataChannel>&&);
+ RTCDataChannelEvent(const AtomicString& type, Init&&, IsTrusted);
Ref<RTCDataChannel> m_channel;
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.idl (214626 => 214627)
--- trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.idl 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.idl 2017-03-30 21:42:19 UTC (rev 214627)
@@ -23,11 +23,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// FIXME 169662: missing Constructor(DOMString type, RTCDataChannelEventInit eventInitDict)
[
- NoInterfaceObject,
Conditional=WEB_RTC,
- EnabledAtRuntime=PeerConnection
+ Constructor(DOMString type, RTCDataChannelEventInit eventInitDict),
+ EnabledAtRuntime=PeerConnection,
] interface RTCDataChannelEvent : Event {
readonly attribute RTCDataChannel channel;
};
+
+dictionary RTCDataChannelEventInit : EventInit {
+ required RTCDataChannel channel;
+};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl (214626 => 214627)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl 2017-03-30 21:42:19 UTC (rev 214627)
@@ -42,7 +42,7 @@
unsigned short maxRetransmits;
USVString protocol = "";
boolean negotiated = false;
- unsigned short id;
+ [EnforceRange] unsigned short id;
// FIXME 169644: missing priority
};
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp (214626 => 214627)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp 2017-03-30 21:42:19 UTC (rev 214627)
@@ -64,19 +64,19 @@
void LibWebRTCDataChannelHandler::OnStateChange()
{
- RTCDataChannel::ReadyState state;
+ RTCDataChannelState state;
switch (m_channel->state()) {
case webrtc::DataChannelInterface::kConnecting:
- state = RTCDataChannel::ReadyStateConnecting;
+ state = RTCDataChannelState::Connecting;
break;
case webrtc::DataChannelInterface::kOpen:
- state = RTCDataChannel::ReadyStateOpen;
+ state = RTCDataChannelState::Open;
break;
case webrtc::DataChannelInterface::kClosing:
- state = RTCDataChannel::ReadyStateClosing;
+ state = RTCDataChannelState::Closing;
break;
case webrtc::DataChannelInterface::kClosed:
- state = RTCDataChannel::ReadyStateClosed;
+ state = RTCDataChannelState::Closed;
break;
}
ASSERT(m_client);
@@ -104,8 +104,8 @@
if (previousAmount <= m_channel->buffered_amount())
return;
ASSERT(m_client);
- callOnMainThread([protectedClient = makeRef(*m_client)] {
- protectedClient->bufferedAmountIsDecreasing();
+ callOnMainThread([protectedClient = makeRef(*m_client), amount = m_channel->buffered_amount()] {
+ protectedClient->bufferedAmountIsDecreasing(static_cast<size_t>(amount));
});
}
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (214626 => 214627)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2017-03-30 21:42:19 UTC (rev 214627)
@@ -600,7 +600,7 @@
callOnMainThread([channel = channel.copyRef()] {
// FIXME: We should be able to write channel->didChangeReadyState(...)
RTCDataChannelHandlerClient& client = channel.get();
- client.didChangeReadyState(RTCDataChannel::ReadyStateOpen);
+ client.didChangeReadyState(RTCDataChannelState::Open);
});
}
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (214626 => 214627)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1439,6 +1439,7 @@
316DCB4F1E7910A6001B5F87 /* JSRTCSignalingState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316DCB491E7910A6001B5F87 /* JSRTCSignalingState.cpp */; };
316DCB501E7910A6001B5F87 /* JSRTCSignalingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 316DCB4A1E7910A6001B5F87 /* JSRTCSignalingState.h */; };
316DCB8A1E7A6996001B5F87 /* RTCIceTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316DCB881E7A6996001B5F87 /* RTCIceTransport.cpp */; };
+ 316DE7021E83AE1D0084C261 /* RTCDataChannelState.h in Headers */ = {isa = PBXBuildFile; fileRef = 316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */; };
316FE0710E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316FE06D0E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp */; };
316FE0720E6CCBEE00BF6088 /* JSCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 316FE06E0E6CCBEE00BF6088 /* JSCSSKeyframeRule.h */; };
316FE0730E6CCBEE00BF6088 /* JSCSSKeyframesRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316FE06F0E6CCBEE00BF6088 /* JSCSSKeyframesRule.cpp */; };
@@ -8961,6 +8962,7 @@
316DCB881E7A6996001B5F87 /* RTCIceTransport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTCIceTransport.cpp; sourceTree = "<group>"; };
316DCB891E7A6996001B5F87 /* RTCIceTransport.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCIceTransport.idl; sourceTree = "<group>"; };
316DCB8E1E7A6C79001B5F87 /* RTCIceTransportState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCIceTransportState.idl; sourceTree = "<group>"; };
+ 316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelState.h; sourceTree = "<group>"; };
316FE06D0E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSKeyframeRule.cpp; sourceTree = "<group>"; };
316FE06E0E6CCBEE00BF6088 /* JSCSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSKeyframeRule.h; sourceTree = "<group>"; };
316FE06F0E6CCBEE00BF6088 /* JSCSSKeyframesRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSKeyframesRule.cpp; sourceTree = "<group>"; };
@@ -16033,6 +16035,7 @@
3135910C1E7DDCB600F30630 /* RTCBundlePolicy.h */,
07221BA217CF0AD400848E51 /* RTCDataChannelHandler.h */,
07221BA317CF0AD400848E51 /* RTCDataChannelHandlerClient.h */,
+ 316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */,
07221BA417CF0AD400848E51 /* RTCDTMFSenderHandler.h */,
07221BA517CF0AD400848E51 /* RTCDTMFSenderHandlerClient.h */,
07221BA617CF0AD400848E51 /* RTCIceCandidateDescriptor.cpp */,
@@ -26808,6 +26811,7 @@
FC9A0F75164094CF003D6B8D /* DOMCSSNamespace.h in Headers */,
9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */,
7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */,
+ 316DE7021E83AE1D0084C261 /* RTCDataChannelState.h in Headers */,
BC1BDF25156C18C7001C1243 /* DOMError.h in Headers */,
2ED609BD1145B07100C8684E /* DOMFormData.h in Headers */,
A8185F3B09765766005826D9 /* DOMImplementation.h in Headers */,
Modified: trunk/Source/WebCore/dom/EventNames.h (214626 => 214627)
--- trunk/Source/WebCore/dom/EventNames.h 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/dom/EventNames.h 2017-03-30 21:42:19 UTC (rev 214627)
@@ -67,7 +67,7 @@
macro(blocked) \
macro(blur) \
macro(boundary) \
- macro(bufferedAmountLowThreshold) \
+ macro(bufferedamountlow) \
macro(cached) \
macro(cancel) \
macro(canplay) \
Modified: trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h (214626 => 214627)
--- trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Modified: trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandlerClient.h (214626 => 214627)
--- trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandlerClient.h 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandlerClient.h 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,6 +27,7 @@
#if ENABLE(WEB_RTC)
+#include "RTCDataChannelState.h"
#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/text/WTFString.h>
@@ -33,20 +35,13 @@
class RTCDataChannelHandlerClient : public ThreadSafeRefCounted<RTCDataChannelHandlerClient> {
public:
- enum ReadyState {
- ReadyStateConnecting = 0,
- ReadyStateOpen = 1,
- ReadyStateClosing = 2,
- ReadyStateClosed = 3,
- };
-
virtual ~RTCDataChannelHandlerClient() { }
- virtual void didChangeReadyState(ReadyState) = 0;
+ virtual void didChangeReadyState(RTCDataChannelState) = 0;
virtual void didReceiveStringData(const String&) = 0;
virtual void didReceiveRawData(const char*, size_t) = 0;
virtual void didDetectError() = 0;
- virtual void bufferedAmountIsDecreasing() = 0;
+ virtual void bufferedAmountIsDecreasing(size_t) = 0;
};
} // namespace WebCore
Added: trunk/Source/WebCore/platform/mediastream/RTCDataChannelState.h (0 => 214627)
--- trunk/Source/WebCore/platform/mediastream/RTCDataChannelState.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/RTCDataChannelState.h 2017-03-30 21:42:19 UTC (rev 214627)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 Apple 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.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_RTC)
+
+namespace WebCore {
+
+enum class RTCDataChannelState {
+ Connecting,
+ Open,
+ Closing,
+ Closed
+};
+
+}; // namespace WebCore
+
+#endif
Modified: trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandlerClient.h (214626 => 214627)
--- trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandlerClient.h 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandlerClient.h 2017-03-30 21:42:19 UTC (rev 214627)
@@ -33,6 +33,9 @@
#if ENABLE(WEB_RTC)
+#include "RTCIceConnectionState.h"
+#include "RTCIceGatheringState.h"
+#include "RTCSignalingState.h"
#include <wtf/PassRefPtr.h>
namespace WebCore {
@@ -43,38 +46,13 @@
class RTCPeerConnectionHandlerClient {
public:
- enum SignalingState {
- SignalingStateStable = 1,
- SignalingStateHaveLocalOffer = 2,
- SignalingStateHaveRemoteOffer = 3,
- SignalingStateHaveLocalPrAnswer = 4,
- SignalingStateHaveRemotePrAnswer = 5,
- SignalingStateClosed = 6,
- };
-
- enum IceConnectionState {
- IceConnectionStateNew = 1,
- IceConnectionStateChecking = 2,
- IceConnectionStateConnected = 3,
- IceConnectionStateCompleted = 4,
- IceConnectionStateFailed = 5,
- IceConnectionStateDisconnected = 6,
- IceConnectionStateClosed = 7
- };
-
- enum IceGatheringState {
- IceGatheringStateNew = 1,
- IceGatheringStateGathering = 2,
- IceGatheringStateComplete = 3
- };
-
virtual ~RTCPeerConnectionHandlerClient() { }
virtual void negotiationNeeded() = 0;
virtual void didGenerateIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) = 0;
- virtual void didChangeSignalingState(SignalingState) = 0;
- virtual void didChangeIceGatheringState(IceGatheringState) = 0;
- virtual void didChangeIceConnectionState(IceConnectionState) = 0;
+ virtual void didChangeSignalingState(RTCSignalingState) = 0;
+ virtual void didChangeIceGatheringState(RTCIceGatheringState) = 0;
+ virtual void didChangeIceConnectionState(RTCIceConnectionState) = 0;
virtual void didAddRemoteStream(PassRefPtr<MediaStreamPrivate>) = 0;
virtual void didRemoveRemoteStream(MediaStreamPrivate*) = 0;
virtual void didAddRemoteDataChannel(std::unique_ptr<RTCDataChannelHandler>) = 0;
Modified: trunk/Source/WebCore/platform/mock/RTCDataChannelHandlerMock.cpp (214626 => 214627)
--- trunk/Source/WebCore/platform/mock/RTCDataChannelHandlerMock.cpp 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/platform/mock/RTCDataChannelHandlerMock.cpp 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -24,11 +25,10 @@
*/
#include "config.h"
+#include "RTCDataChannelHandlerMock.h"
#if ENABLE(WEB_RTC)
-#include "RTCDataChannelHandlerMock.h"
-
#include "RTCDataChannelHandlerClient.h"
#include "RTCNotifiersMock.h"
@@ -46,8 +46,8 @@
return;
m_client = client;
- RefPtr<DataChannelStateNotifier> notifier = adoptRef(new DataChannelStateNotifier(m_client, RTCDataChannelHandlerClient::ReadyStateOpen));
- m_timerEvents.append(adoptRef(new TimerEvent(this, notifier)));
+ auto notifier = adoptRef(*new DataChannelStateNotifier(m_client, RTCDataChannelState::Open));
+ m_timerEvents.append(adoptRef(new TimerEvent(this, WTFMove(notifier))));
}
bool RTCDataChannelHandlerMock::sendStringData(const String& string)
@@ -64,8 +64,8 @@
void RTCDataChannelHandlerMock::close()
{
- RefPtr<DataChannelStateNotifier> notifier = adoptRef(new DataChannelStateNotifier(m_client, RTCDataChannelHandlerClient::ReadyStateClosed));
- m_timerEvents.append(adoptRef(new TimerEvent(this, notifier)));
+ auto notifier = adoptRef(*new DataChannelStateNotifier(m_client, RTCDataChannelState::Closed));
+ m_timerEvents.append(adoptRef(new TimerEvent(this, WTFMove(notifier))));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mock/RTCNotifiersMock.cpp (214626 => 214627)
--- trunk/Source/WebCore/platform/mock/RTCNotifiersMock.cpp 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/platform/mock/RTCNotifiersMock.cpp 2017-03-30 21:42:19 UTC (rev 214627)
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -67,7 +68,7 @@
m_request->requestFailed(m_errorName);
}
-IceConnectionNotifier::IceConnectionNotifier(RTCPeerConnectionHandlerClient* client, RTCPeerConnectionHandlerClient::IceConnectionState connectionState, RTCPeerConnectionHandlerClient::IceGatheringState gatheringState)
+IceConnectionNotifier::IceConnectionNotifier(RTCPeerConnectionHandlerClient* client, RTCIceConnectionState connectionState, RTCIceGatheringState gatheringState)
: m_client(client)
, m_connectionState(connectionState)
, m_gatheringState(gatheringState)
@@ -80,7 +81,7 @@
m_client->didChangeIceConnectionState(m_connectionState);
}
-SignalingStateNotifier::SignalingStateNotifier(RTCPeerConnectionHandlerClient* client, RTCPeerConnectionHandlerClient::SignalingState signalingState)
+SignalingStateNotifier::SignalingStateNotifier(RTCPeerConnectionHandlerClient* client, RTCSignalingState signalingState)
: m_client(client)
, m_signalingState(signalingState)
{
@@ -101,7 +102,7 @@
m_client->didAddRemoteDataChannel(std::make_unique<RTCDataChannelHandlerMock>("RTCDataChannelHandlerMock", RTCDataChannelInit()));
}
-DataChannelStateNotifier::DataChannelStateNotifier(RTCDataChannelHandlerClient* client, RTCDataChannelHandlerClient::ReadyState state)
+DataChannelStateNotifier::DataChannelStateNotifier(RTCDataChannelHandlerClient* client, RTCDataChannelState state)
: m_client(client)
, m_state(state)
{
Modified: trunk/Source/WebCore/platform/mock/RTCNotifiersMock.h (214626 => 214627)
--- trunk/Source/WebCore/platform/mock/RTCNotifiersMock.h 2017-03-30 21:35:39 UTC (rev 214626)
+++ trunk/Source/WebCore/platform/mock/RTCNotifiersMock.h 2017-03-30 21:42:19 UTC (rev 214627)
@@ -67,25 +67,25 @@
class IceConnectionNotifier : public MockNotifier {
public:
- IceConnectionNotifier(RTCPeerConnectionHandlerClient*, RTCPeerConnectionHandlerClient::IceConnectionState, RTCPeerConnectionHandlerClient::IceGatheringState);
+ IceConnectionNotifier(RTCPeerConnectionHandlerClient*, RTCIceConnectionState, RTCIceGatheringState);
void fire() override;
private:
RTCPeerConnectionHandlerClient* m_client;
- RTCPeerConnectionHandlerClient::IceConnectionState m_connectionState;
- RTCPeerConnectionHandlerClient::IceGatheringState m_gatheringState;
+ RTCIceConnectionState m_connectionState;
+ RTCIceGatheringState m_gatheringState;
};
class SignalingStateNotifier : public MockNotifier {
public:
- SignalingStateNotifier(RTCPeerConnectionHandlerClient*, RTCPeerConnectionHandlerClient::SignalingState);
+ SignalingStateNotifier(RTCPeerConnectionHandlerClient*, RTCSignalingState);
void fire() override;
private:
RTCPeerConnectionHandlerClient* m_client;
- RTCPeerConnectionHandlerClient::SignalingState m_signalingState;
+ RTCSignalingState m_signalingState;
};
class RemoteDataChannelNotifier : public MockNotifier {
@@ -100,13 +100,13 @@
class DataChannelStateNotifier : public MockNotifier {
public:
- DataChannelStateNotifier(RTCDataChannelHandlerClient*, RTCDataChannelHandlerClient::ReadyState);
+ DataChannelStateNotifier(RTCDataChannelHandlerClient*, RTCDataChannelState);
void fire() override;
private:
RTCDataChannelHandlerClient* m_client;
- RTCDataChannelHandlerClient::ReadyState m_state;
+ RTCDataChannelState m_state;
};
} // namespace WebCore