Clean up RTCDataChannel
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Mar 2017 21:42:19 +0000 (21:42 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Mar 2017 21:42:19 +0000 (21:42 +0000)
commitba94d1336266dcbf10365002cff857b3f6939db7
tree165523975bc1f683aba10cda8a13c7161d4ead06
parent06bf48be76dc423da3a68b36b6ca0c82010b7a1f
Clean up RTCDataChannel
https://bugs.webkit.org/show_bug.cgi?id=169732

LayoutTests/imported/w3c:

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30
Reviewed by Chris Dumez.

* web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt:

Source/JavaScriptCore:

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30
Reviewed by Chris Dumez.

* runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent.

Source/WebCore:

Patch by Youenn Fablet  <youenn@apple.com> and Jon Lee <jonlee@apple.com> on 2017-03-30
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:

LayoutTests:

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30
Reviewed by Chris Dumez.

* webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added.
* webrtc/datachannel/bufferedAmountLowThreshold.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
30 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt
LayoutTests/webrtc/datachannel/basic.html
LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold-expected.txt [new file with mode: 0644]
LayoutTests/webrtc/datachannel/bufferedAmountLowThreshold.html [new file with mode: 0644]
LayoutTests/webrtc/datachannel/datachannel-event-expected.txt [new file with mode: 0644]
LayoutTests/webrtc/datachannel/datachannel-event.html [new file with mode: 0644]
LayoutTests/webrtc/routines.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/RTCDataChannel.cpp
Source/WebCore/Modules/mediastream/RTCDataChannel.h
Source/WebCore/Modules/mediastream/RTCDataChannel.idl
Source/WebCore/Modules/mediastream/RTCDataChannelEvent.cpp
Source/WebCore/Modules/mediastream/RTCDataChannelEvent.h
Source/WebCore/Modules/mediastream/RTCDataChannelEvent.idl
Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp
Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/EventNames.h
Source/WebCore/platform/mediastream/RTCDataChannelHandler.h
Source/WebCore/platform/mediastream/RTCDataChannelHandlerClient.h
Source/WebCore/platform/mediastream/RTCDataChannelState.h [new file with mode: 0644]
Source/WebCore/platform/mediastream/RTCPeerConnectionHandlerClient.h
Source/WebCore/platform/mock/RTCDataChannelHandlerMock.cpp
Source/WebCore/platform/mock/RTCNotifiersMock.cpp
Source/WebCore/platform/mock/RTCNotifiersMock.h