Source/WebCore/ChangeLog

112017-03-15 Jon Lee <jonlee@apple.com>
22
 3 Clean up RTCDataChannel
 4 https://bugs.webkit.org/show_bug.cgi?id=169732
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Update based on 13 March 2017 Editor's Draft of the WebRTC spec.
 9
 10 Add maxPacketLifeTime, and alias older maxRetransmitTime to it.
 11 * Modules/mediastream/RTCDataChannel.h:
 12 * Modules/mediastream/RTCDataChannel.idl: Reorder based on the spec. Add FIXMEs as necessary.
 13 * Modules/mediastream/RTCPeerConnection.idl: Update maxPacketLifeTime here also. Add
 14 [EnforceRange], which depends on bug 169731.
 15 * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: Refactor.
 16 (WebCore::LibWebRTCMediaEndpoint::createDataChannel):
 17 (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
 18 * platform/mediastream/RTCDataChannelHandler.h: Refactor.
 19
 202017-03-15 Jon Lee <jonlee@apple.com>
 21
322 Add support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
423 https://bugs.webkit.org/show_bug.cgi?id=169731
524

Source/WebCore/Modules/mediastream/RTCDataChannel.h

@@public:
4949 static Ref<RTCDataChannel> create(ScriptExecutionContext&, std::unique_ptr<RTCDataChannelHandler>&&, String&&, RTCDataChannelInit&&);
5050
5151 bool ordered() const { return m_options.ordered; }
52  unsigned short maxRetransmitTime() const { return m_options.maxRetransmitTime; }
 52 unsigned short maxPacketLifeTime() const { return m_options.maxPacketLifeTime; }
5353 unsigned short maxRetransmits() const { return m_options.maxRetransmits; }
5454 String protocol() const { return m_options.protocol; }
5555 bool negotiated() const { return m_options.negotiated; };

Source/WebCore/Modules/mediastream/RTCDataChannel.idl

2626 Conditional=WEB_RTC,
2727 NoInterfaceObject,
2828] interface RTCDataChannel : EventTarget {
 29 // FIXME 169662: switch to USVString
2930 readonly attribute DOMString label;
3031 readonly attribute boolean ordered;
31  readonly attribute unsigned short maxRetransmitTime;
 32 // FIXME 169662: make nullable
 33 readonly attribute unsigned short maxPacketLifeTime;
 34 // FIXME 169662: make nullable
3235 readonly attribute unsigned short maxRetransmits;
 36 // FIXME 169662: switch to USVString
3337 readonly attribute DOMString protocol;
3438 readonly attribute boolean negotiated;
 39 // FIXME 169662: make nullable
3540 readonly attribute unsigned short id;
 41 // FIXME 169662: missing priority
 42 // FIXME 169662: switch to RTCDataChannelState
3643 readonly attribute DOMString readyState;
3744 readonly attribute unsigned long bufferedAmount;
38 
 45 // FIXME 169662: missing bufferedAmountLowThreshold
 46 attribute EventHandler onopen;
 47 // FIXME 169662: missing onbufferedamountlow
 48 attribute EventHandler onerror;
 49 attribute EventHandler onclose;
 50 void close();
 51 attribute EventHandler onmessage;
3952 [SetterMayThrowException] attribute DOMString binaryType;
4053
 54 // FIXME 169662: switch to USVString
 55 [MayThrowException] void send(DOMString data);
 56 [MayThrowException] void send(Blob data);
4157 [MayThrowException] void send(ArrayBuffer data);
4258 [MayThrowException] void send(ArrayBufferView data);
43  [MayThrowException] void send(Blob data);
44  [MayThrowException] void send(DOMString data);
45 
46  void close();
4759
48  attribute EventHandler onopen;
49  attribute EventHandler onerror;
50  attribute EventHandler onclose;
51  attribute EventHandler onmessage;
 60 // Legacy
 61 [ImplementedAs=maxPacketLifeTime] readonly attribute unsigned short maxRetransmitTime;
5262};

Source/WebCore/Modules/mediastream/RTCPeerConnection.idl

3636 EnabledAtRuntime=PeerConnection
3737] dictionary RTCDataChannelInit {
3838 boolean ordered = true;
39  // FIXME 169644: rename to maxPacketLifeTime;
40  unsigned short maxRetransmitTime;
 39 unsigned short maxPacketLifeTime;
4140 unsigned short maxRetransmits;
4241 USVString protocol = "";
4342 boolean negotiated = false;
44  unsigned short id;
 43 [EnforceRange] unsigned short id;
4544 // FIXME 169644: missing priority
 45
 46 [ImplementedAs=maxPacketLifeTime] unsigned short maxRetransmitTime;
4647};
4748
4849[

Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp

@@std::unique_ptr<RTCDataChannelHandler> LibWebRTCMediaEndpoint::createDataChannel
432432{
433433 webrtc::DataChannelInit init;
434434 init.ordered = options.ordered;
435  init.maxRetransmitTime = options.maxRetransmitTime;
 435 init.maxRetransmitTime = options.maxPacketLifeTime;
436436 init.maxRetransmits = options.maxRetransmits;
437437 init.protocol = options.protocol.utf8().data();
438438 init.negotiated = options.negotiated;

@@void LibWebRTCMediaEndpoint::addDataChannel(rtc::scoped_refptr<webrtc::DataChann
448448
449449 RTCDataChannelInit init;
450450 init.ordered = dataChannel->ordered();
451  init.maxRetransmitTime = dataChannel->maxRetransmitTime();
 451 init.maxPacketLifeTime = dataChannel->maxRetransmitTime();
452452 init.maxRetransmits = dataChannel->maxRetransmits();
453453 init.protocol = String(protocol.data(), protocol.size());
454454 init.negotiated = dataChannel->negotiated();

Source/WebCore/platform/mediastream/RTCDataChannelHandler.h

@@namespace WebCore {
3232
3333struct RTCDataChannelInit {
3434 bool ordered { true };
35  int maxRetransmitTime { -1 };
 35 int maxPacketLifeTime { -1 };
3636 int maxRetransmits { -1 };
3737 String protocol;
3838 bool negotiated { false };