Changeset 214627 in webkit


Ignore:
Timestamp:
Mar 30, 2017, 2:42:19 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

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.
Location:
trunk
Files:
5 added
25 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/LayoutTests/ChangeLog

    r214626 r214627  
     12017-03-30  Youenn Fablet  <youenn@apple.com>
     2
     3        Clean up RTCDataChannel
     4        https://bugs.webkit.org/show_bug.cgi?id=169732
     5
     6        Reviewed by Chris Dumez.
     7
     8        * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added.
     9        * webrtc/datachannel/bufferedAmountLowThreshold.html: Added.
     10
    1112017-03-30  Chris Dumez  <cdumez@apple.com>
    212
  • TabularUnified trunk/LayoutTests/imported/w3c/ChangeLog

    r214490 r214627  
     12017-03-30  Youenn Fablet  <youenn@apple.com>
     2
     3        Clean up RTCDataChannel
     4        https://bugs.webkit.org/show_bug.cgi?id=169732
     5
     6        Reviewed by Chris Dumez.
     7
     8        * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt:
     9
    1102017-03-28  Youenn Fablet  <youenn@apple.com>
    211
  • TabularUnified trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt

    r211930 r214627  
    11
    2 FAIL RTCDataChannelEvent constructor without a required argument. Can't find variable: RTCDataChannelEvent
    3 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")
    4 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")
    5 FAIL RTCDataChannelEvent constructor with full arguments. Can't find variable: RTCDataChannelEvent
     2PASS RTCDataChannelEvent constructor without a required argument.
     3PASS RTCDataChannelEvent constructor with channel passed as null.
     4PASS RTCDataChannelEvent constructor with a channel passed as undefined.
     5PASS RTCDataChannelEvent constructor with full arguments.
    66
  • TabularUnified trunk/LayoutTests/webrtc/datachannel/basic.html

    r214441 r214627  
    9696                remoteChannel.onmessage = receiveMessages;
    9797            };
    98         }, (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("udp") == -1; });
     98        }, { filterOutICECandidate: (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("udp") == -1; } });
    9999    });
    100100}, "Basic data channel exchange from offerer to receiver using UDP only");
     
    115115                remoteChannel.onmessage = receiveMessages;
    116116            };
    117         }, (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("tcp") == -1; });
     117        }, { filterOutICECandidate: (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("tcp") == -1; } });
    118118    });
    119119}, "Basic data channel exchange from offerer to receiver using TCP only");
     
    137137        finishTest = resolve;
    138138        createConnections((localConnection) => {
    139             var init = { ordered: true, maxPacketLifeTime: 10, maxRetransmitTime: 11, protocol: "whatever", negotiated: false, id: "id" };
     139            var init = { ordered: true, maxPacketLifeTime: 10, maxRetransmitTime: 11, protocol: "whatever", negotiated: false, id: 1 };
    140140            localChannel = localConnection.createDataChannel('sendDataChannel', init);
    141141            localChannel.onopen = () => { sendMessages(localChannel) };
  • TabularUnified trunk/LayoutTests/webrtc/routines.js

    r214441 r214627  
    33var remoteConnection;
    44
    5 function createConnections(setupLocalConnection, setupRemoteConnection, filterOutICECandidate) {
     5function createConnections(setupLocalConnection, setupRemoteConnection, options = { }) {
    66    localConnection = new RTCPeerConnection();
    7     localConnection.onicecandidate = (event) => { iceCallback1(event, filterOutICECandidate) };
     7    localConnection.onicecandidate = (event) => { iceCallback1(event, options.filterOutICECandidate) };
    88    setupLocalConnection(localConnection);
    99
    1010    remoteConnection = new RTCPeerConnection();
    11     remoteConnection.onicecandidate = (event) => { iceCallback2(event, filterOutICECandidate) };
     11    remoteConnection.onicecandidate = (event) => { iceCallback2(event, options.filterOutICECandidate) };
    1212    setupRemoteConnection(remoteConnection);
    1313
    14     localConnection.createOffer().then(gotDescription1, onCreateSessionDescriptionError);
     14    localConnection.createOffer().then((desc) => gotDescription1(desc, options), onCreateSessionDescriptionError);
    1515
    1616    return [localConnection, remoteConnection]
     
    2828}
    2929
    30 function gotDescription1(desc)
     30function gotDescription1(desc, options)
    3131{
     32    if (options.observeOffer)
     33        options.observeOffer(desc);
     34
    3235    localConnection.setLocalDescription(desc);
    3336    remoteConnection.setRemoteDescription(desc);
    34     remoteConnection.createAnswer().then(gotDescription2, onCreateSessionDescriptionError);
     37    remoteConnection.createAnswer().then((desc) => gotDescription2(desc, options), onCreateSessionDescriptionError);
    3538}
    3639
    37 function gotDescription2(desc)
     40function gotDescription2(desc, options)
    3841{
     42    if (options.observeAnswer)
     43        options.observeAnswer(desc);
     44
    3945    remoteConnection.setLocalDescription(desc);
    4046    localConnection.setRemoteDescription(desc);
  • TabularUnified trunk/Source/JavaScriptCore/ChangeLog

    r214602 r214627  
     12017-03-30  Youenn Fablet  <youenn@apple.com>
     2
     3        Clean up RTCDataChannel
     4        https://bugs.webkit.org/show_bug.cgi?id=169732
     5
     6        Reviewed by Chris Dumez.
     7
     8        * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent.
     9
    1102017-03-30  Saam Barati  <sbarati@apple.com>
    211
  • TabularUnified trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r214289 r214627  
    101101    macro(Reflect) \
    102102    macro(RegExp) \
     103    macro(Request) \
    103104    macro(Response) \
    104     macro(Request) \
     105    macro(RTCDataChannel) \
     106    macro(RTCDataChannelEvent) \
    105107    macro(RTCDTMFToneChangeEvent) \
    106108    macro(RTCIceCandidate) \
  • TabularUnified trunk/Source/WebCore/ChangeLog

    r214624 r214627  
     12017-03-30  Youenn Fablet  <youenn@apple.com> and Jon Lee <jonlee@apple.com>
     2
     3        Clean up RTCDataChannel
     4        https://bugs.webkit.org/show_bug.cgi?id=169732
     5
     6        Reviewed by Chris Dumez.
     7
     8        Test: webrtc/datachannel/datachannel-event.html
     9              webrtc/datachannel/bufferedAmountLowThreshold.html
     10
     11        Making RTCDataChannel interface closer to the spec updating implementation accordingly.
     12        See https://w3c.github.io/webrtc-pc/#rtcdatachannel.
     13        In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes.
     14        Doing some additional cleaning refactoring.
     15
     16        Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by
     17        libwebrtc without needing to get it from the libwebrtc network thread again.
     18        In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc
     19        OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be
     20        updated to increase in the send method.
     21
     22        Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount.
     23
     24        * Modules/mediastream/RTCDataChannel.cpp:
     25        (WebCore::RTCDataChannel::send):
     26        (WebCore::RTCDataChannel::close):
     27        (WebCore::RTCDataChannel::didChangeReadyState):
     28        (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
     29        * Modules/mediastream/RTCDataChannel.h:
     30        * Modules/mediastream/RTCDataChannel.idl:
     31        * Modules/mediastream/RTCDataChannelEvent.cpp:
     32        (WebCore::RTCDataChannelEvent::create):
     33        (WebCore::RTCDataChannelEvent::RTCDataChannelEvent):
     34        (WebCore::RTCDataChannelEvent::channel):
     35        * Modules/mediastream/RTCDataChannelEvent.h:
     36        * Modules/mediastream/RTCDataChannelEvent.idl:
     37        * Modules/mediastream/RTCPeerConnection.idl:
     38        * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
     39        (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
     40        * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
     41        (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
     42        * WebCore.xcodeproj/project.pbxproj:
     43        * dom/EventNames.h:
     44        * platform/mediastream/RTCDataChannelHandler.h:
     45        * platform/mediastream/RTCDataChannelHandlerClient.h:
     46        * platform/mediastream/RTCDataChannelState.h: Added.
     47        * platform/mediastream/RTCPeerConnectionHandlerClient.h:
     48        * platform/mock/RTCDataChannelHandlerMock.cpp:
     49        (WebCore::RTCDataChannelHandlerMock::setClient):
     50        (WebCore::RTCDataChannelHandlerMock::close):
     51        * platform/mock/RTCNotifiersMock.cpp:
     52        (WebCore::IceConnectionNotifier::IceConnectionNotifier):
     53        (WebCore::SignalingStateNotifier::SignalingStateNotifier):
     54        (WebCore::DataChannelStateNotifier::DataChannelStateNotifier):
     55        * platform/mock/RTCNotifiersMock.h:
     56
    1572017-03-30  Javier Fernandez  <jfernandez@igalia.com>
    258
  • TabularUnified trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp

    r214508 r214627  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    7273}
    7374
    74 const AtomicString& RTCDataChannel::readyState() const
    75 {
    76     static NeverDestroyed<AtomicString> connectingState("connecting", AtomicString::ConstructFromLiteral);
    77     static NeverDestroyed<AtomicString> openState("open", AtomicString::ConstructFromLiteral);
    78     static NeverDestroyed<AtomicString> closingState("closing", AtomicString::ConstructFromLiteral);
    79     static NeverDestroyed<AtomicString> closedState("closed", AtomicString::ConstructFromLiteral);
    80 
    81     switch (m_readyState) {
    82     case ReadyStateConnecting:
    83         return connectingState;
    84     case ReadyStateOpen:
    85         return openState;
    86     case ReadyStateClosing:
    87         return closingState;
    88     case ReadyStateClosed:
    89         return closedState;
    90     }
    91 
    92     ASSERT_NOT_REACHED();
    93     return emptyAtom;
    94 }
    95 
    9675size_t RTCDataChannel::bufferedAmount() const
    9776{
     77    // FIXME: We should compute our own bufferedAmount and not count on m_handler which is made null at closing time.
     78    if (m_stopped)
     79        return 0;
    9880    return m_handler->bufferedAmount();
    9981}
     
    125107ExceptionOr<void> RTCDataChannel::send(const String& data)
    126108{
    127     if (m_readyState != ReadyStateOpen)
     109    // FIXME: We should only throw in Connected state.
     110    if (m_readyState != RTCDataChannelState::Open)
    128111        return Exception { INVALID_STATE_ERR };
    129112
     
    138121ExceptionOr<void> RTCDataChannel::send(ArrayBuffer& data)
    139122{
    140     if (m_readyState != ReadyStateOpen)
     123    // FIXME: We should only throw in Connected state.
     124    if (m_readyState != RTCDataChannelState::Open)
    141125        return Exception { INVALID_STATE_ERR };
    142126
     
    157141ExceptionOr<void> RTCDataChannel::send(ArrayBufferView& data)
    158142{
     143    // FIXME: We should only throw in Connected state.
    159144    return send(*data.unsharedBuffer());
    160145}
     
    172157
    173158    m_stopped = true;
    174     m_readyState = ReadyStateClosed;
     159    m_readyState = RTCDataChannelState::Closed;
    175160
    176161    m_handler->close();
     
    180165}
    181166
    182 void RTCDataChannel::didChangeReadyState(ReadyState newState)
    183 {
    184     if (m_stopped || m_readyState == ReadyStateClosed || m_readyState == newState)
     167void RTCDataChannel::didChangeReadyState(RTCDataChannelState newState)
     168{
     169    if (m_stopped || m_readyState == RTCDataChannelState::Closed || m_readyState == newState)
    185170        return;
    186171
     
    188173
    189174    switch (m_readyState) {
    190     case ReadyStateOpen:
     175    case RTCDataChannelState::Open:
    191176        scheduleDispatchEvent(Event::create(eventNames().openEvent, false, false));
    192177        break;
    193     case ReadyStateClosed:
     178    case RTCDataChannelState::Closed:
    194179        scheduleDispatchEvent(Event::create(eventNames().closeEvent, false, false));
    195180        break;
     
    232217}
    233218
    234 void RTCDataChannel::bufferedAmountIsDecreasing()
    235 {
    236     if (m_stopped)
    237         return;
    238 
    239     if (bufferedAmount() <= m_bufferedAmountLowThreshold)
    240         scheduleDispatchEvent(Event::create(eventNames().bufferedAmountLowThresholdEvent, false, false));
     219void RTCDataChannel::bufferedAmountIsDecreasing(size_t amount)
     220{
     221    if (m_stopped)
     222        return;
     223
     224    if (amount <= m_bufferedAmountLowThreshold)
     225        scheduleDispatchEvent(Event::create(eventNames().bufferedamountlowEvent, false, false));
    241226}
    242227
  • TabularUnified trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.h

    r214508 r214627  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    5859
    5960    String label() const { return m_label; }
    60     const AtomicString& readyState() const;
     61    RTCDataChannelState readyState() const {return m_readyState; }
    6162    size_t bufferedAmount() const;
    6263    size_t bufferedAmountLowThreshold() const { return m_bufferedAmountLowThreshold; }
     
    9192    void stop() final;
    9293    const char* activeDOMObjectName() const final { return "RTCDataChannel"; }
    93     bool canSuspendForDocumentSuspension() const final { return m_readyState == ReadyStateClosed; }
     94    bool canSuspendForDocumentSuspension() const final { return m_readyState == RTCDataChannelState::Closed; }
    9495
    9596    // RTCDataChannelHandlerClient API
    96     void didChangeReadyState(ReadyState) final;
     97    void didChangeReadyState(RTCDataChannelState) final;
    9798    void didReceiveStringData(const String&) final;
    9899    void didReceiveRawData(const char*, size_t) final;
    99100    void didDetectError() final;
    100     void bufferedAmountIsDecreasing() final;
     101    void bufferedAmountIsDecreasing(size_t) final;
    101102
    102103    std::unique_ptr<RTCDataChannelHandler> m_handler;
    103104
     105    // FIXME: m_stopped is probably redundant with m_readyState.
    104106    bool m_stopped { false };
    105 
    106     ReadyState m_readyState { ReadyStateConnecting };
     107    RTCDataChannelState m_readyState { RTCDataChannelState::Connecting };
    107108
    108109    enum class BinaryType { Blob, ArrayBuffer };
  • TabularUnified trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.idl

    r214508 r214627  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2627    ActiveDOMObject,
    2728    Conditional=WEB_RTC,
    28     NoInterfaceObject,
     29    EnabledAtRuntime=PeerConnection,
    2930] interface RTCDataChannel : EventTarget {
    30     readonly attribute DOMString label;
     31    // FIXME: Add support for priority attribute.
     32
     33    readonly attribute USVString label;
    3134    readonly attribute boolean ordered;
    3235    readonly attribute unsigned short? maxPacketLifeTime;
    3336    readonly attribute unsigned short? maxRetransmits;
    34     readonly attribute DOMString protocol;
     37    readonly attribute USVString protocol;
    3538    readonly attribute boolean negotiated;
    3639    readonly attribute unsigned short? id;
    37     readonly attribute DOMString readyState;
     40    readonly attribute RTCDataChannelState readyState;
    3841    readonly attribute unsigned long bufferedAmount;
     42    attribute unsigned long bufferedAmountLowThreshold;
    3943
    4044    [SetterMayThrowException] attribute DOMString binaryType;
     
    4347    [MayThrowException] void send(ArrayBufferView data);
    4448    [MayThrowException] void send(Blob data);
    45     [MayThrowException] void send(DOMString data);
     49    [MayThrowException] void send(USVString data);
    4650
    4751    void close();
     
    5155    attribute EventHandler onclose;
    5256    attribute EventHandler onmessage;
     57    attribute EventHandler onbufferedamountlow;
    5358};
     59
     60[
     61    Conditional=WEB_RTC,
     62    EnabledAtRuntime=PeerConnection,
     63    ImplementedAs=RTCDataChannelState
     64] enum RTCDataChannelState {
     65    "connecting",
     66    "open",
     67    "closing",
     68    "closed"
     69};
  • TabularUnified trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.cpp

    r210828 r214627  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3738}
    3839
     40Ref<RTCDataChannelEvent> RTCDataChannelEvent::create(const AtomicString& type, Init&& initializer, IsTrusted isTrusted)
     41{
     42    return adoptRef(*new RTCDataChannelEvent(type, WTFMove(initializer), isTrusted));
     43}
     44
    3945RTCDataChannelEvent::RTCDataChannelEvent(const AtomicString& type, bool canBubble, bool cancelable, Ref<RTCDataChannel>&& channel)
    4046    : Event(type, canBubble, cancelable)
     
    4349}
    4450
    45 RTCDataChannel* RTCDataChannelEvent::channel()
     51RTCDataChannelEvent::RTCDataChannelEvent(const AtomicString& type, Init&& initializer, IsTrusted isTrusted)
     52    : Event(type, initializer, isTrusted)
     53    , m_channel(initializer.channel.releaseNonNull())
    4654{
    47     return m_channel.ptr();
     55}
     56
     57RTCDataChannel& RTCDataChannelEvent::channel()
     58{
     59    return m_channel.get();
    4860}
    4961
  • TabularUnified trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.h

    r208694 r214627  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3334namespace WebCore {
    3435
    35 class RTCDataChannelEvent : public Event {
     36class RTCDataChannelEvent final : public Event {
    3637public:
     38    struct Init : EventInit {
     39        RefPtr<RTCDataChannel> channel;
     40    };
     41
    3742    static Ref<RTCDataChannelEvent> create(const AtomicString& type, bool canBubble, bool cancelable, Ref<RTCDataChannel>&&);
     43    static Ref<RTCDataChannelEvent> create(const AtomicString& type, Init&&, IsTrusted = IsTrusted::No);
    3844
    39     RTCDataChannel* channel();
     45    RTCDataChannel& channel();
    4046
    4147    virtual EventInterface eventInterface() const;
     
    4349private:
    4450    RTCDataChannelEvent(const AtomicString& type, bool canBubble, bool cancelable, Ref<RTCDataChannel>&&);
     51    RTCDataChannelEvent(const AtomicString& type, Init&&, IsTrusted);
    4552
    4653    Ref<RTCDataChannel> m_channel;
  • TabularUnified trunk/Source/WebCore/Modules/mediastream/RTCDataChannelEvent.idl

    r214045 r214627  
    2424 */
    2525
    26 // FIXME 169662: missing Constructor(DOMString type, RTCDataChannelEventInit eventInitDict)
    2726[
    28     NoInterfaceObject,
    2927    Conditional=WEB_RTC,
    30     EnabledAtRuntime=PeerConnection
     28    Constructor(DOMString type, RTCDataChannelEventInit eventInitDict),
     29    EnabledAtRuntime=PeerConnection,
    3130] interface RTCDataChannelEvent : Event {
    3231    readonly attribute RTCDataChannel channel;
    3332};
     33
     34dictionary RTCDataChannelEventInit : EventInit {
     35    required RTCDataChannel channel;
     36};
  • TabularUnified trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl

    r214441 r214627  
    4343    USVString protocol = "";
    4444    boolean negotiated = false;
    45     unsigned short id;
     45    [EnforceRange] unsigned short id;
    4646    // FIXME 169644: missing priority
    4747};
  • TabularUnified trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp

    r211371 r214627  
    6565void LibWebRTCDataChannelHandler::OnStateChange()
    6666{
    67     RTCDataChannel::ReadyState state;
     67    RTCDataChannelState state;
    6868    switch (m_channel->state()) {
    6969    case webrtc::DataChannelInterface::kConnecting:
    70         state = RTCDataChannel::ReadyStateConnecting;
     70        state = RTCDataChannelState::Connecting;
    7171        break;
    7272    case webrtc::DataChannelInterface::kOpen:
    73         state = RTCDataChannel::ReadyStateOpen;
     73        state = RTCDataChannelState::Open;
    7474        break;
    7575    case webrtc::DataChannelInterface::kClosing:
    76         state = RTCDataChannel::ReadyStateClosing;
     76        state = RTCDataChannelState::Closing;
    7777        break;
    7878    case webrtc::DataChannelInterface::kClosed:
    79         state = RTCDataChannel::ReadyStateClosed;
     79        state = RTCDataChannelState::Closed;
    8080        break;
    8181    }
     
    105105        return;
    106106    ASSERT(m_client);
    107     callOnMainThread([protectedClient = makeRef(*m_client)] {
    108         protectedClient->bufferedAmountIsDecreasing();
     107    callOnMainThread([protectedClient = makeRef(*m_client), amount = m_channel->buffered_amount()] {
     108        protectedClient->bufferedAmountIsDecreasing(static_cast<size_t>(amount));
    109109    });
    110110}
  • TabularUnified trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp

    r214421 r214627  
    601601            // FIXME: We should be able to write channel->didChangeReadyState(...)
    602602            RTCDataChannelHandlerClient& client = channel.get();
    603             client.didChangeReadyState(RTCDataChannel::ReadyStateOpen);
     603            client.didChangeReadyState(RTCDataChannelState::Open);
    604604        });
    605605    }
  • TabularUnified trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r214607 r214627  
    14401440                316DCB501E7910A6001B5F87 /* JSRTCSignalingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 316DCB4A1E7910A6001B5F87 /* JSRTCSignalingState.h */; };
    14411441                316DCB8A1E7A6996001B5F87 /* RTCIceTransport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316DCB881E7A6996001B5F87 /* RTCIceTransport.cpp */; };
     1442                316DE7021E83AE1D0084C261 /* RTCDataChannelState.h in Headers */ = {isa = PBXBuildFile; fileRef = 316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */; };
    14421443                316FE0710E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 316FE06D0E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp */; };
    14431444                316FE0720E6CCBEE00BF6088 /* JSCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 316FE06E0E6CCBEE00BF6088 /* JSCSSKeyframeRule.h */; };
     
    89628963                316DCB891E7A6996001B5F87 /* RTCIceTransport.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCIceTransport.idl; sourceTree = "<group>"; };
    89638964                316DCB8E1E7A6C79001B5F87 /* RTCIceTransportState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCIceTransportState.idl; sourceTree = "<group>"; };
     8965                316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCDataChannelState.h; sourceTree = "<group>"; };
    89648966                316FE06D0E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSKeyframeRule.cpp; sourceTree = "<group>"; };
    89658967                316FE06E0E6CCBEE00BF6088 /* JSCSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSKeyframeRule.h; sourceTree = "<group>"; };
     
    1603416036                                07221BA217CF0AD400848E51 /* RTCDataChannelHandler.h */,
    1603516037                                07221BA317CF0AD400848E51 /* RTCDataChannelHandlerClient.h */,
     16038                                316DE7011E83AE1D0084C261 /* RTCDataChannelState.h */,
    1603616039                                07221BA417CF0AD400848E51 /* RTCDTMFSenderHandler.h */,
    1603716040                                07221BA517CF0AD400848E51 /* RTCDTMFSenderHandlerClient.h */,
     
    2680926812                                9B3A8872145632F9003AE8F5 /* DOMDOMSettableTokenList.h in Headers */,
    2681026813                                7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */,
     26814                                316DE7021E83AE1D0084C261 /* RTCDataChannelState.h in Headers */,
    2681126815                                BC1BDF25156C18C7001C1243 /* DOMError.h in Headers */,
    2681226816                                2ED609BD1145B07100C8684E /* DOMFormData.h in Headers */,
  • TabularUnified trunk/Source/WebCore/dom/EventNames.h

    r214293 r214627  
    6868    macro(blur) \
    6969    macro(boundary) \
    70     macro(bufferedAmountLowThreshold) \
     70    macro(bufferedamountlow) \
    7171    macro(cached) \
    7272    macro(cancel) \
  • TabularUnified trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandler.h

    r214421 r214627  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
  • TabularUnified trunk/Source/WebCore/platform/mediastream/RTCDataChannelHandlerClient.h

    r211371 r214627  
    11/*
    22 * Copyright (C) 2012 Google Inc. All rights reserved.
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2728#if ENABLE(WEB_RTC)
    2829
     30#include "RTCDataChannelState.h"
    2931#include <wtf/ThreadSafeRefCounted.h>
    3032#include <wtf/text/WTFString.h>
     
    3436class RTCDataChannelHandlerClient : public ThreadSafeRefCounted<RTCDataChannelHandlerClient> {
    3537public:
    36     enum ReadyState {
    37         ReadyStateConnecting = 0,
    38         ReadyStateOpen = 1,
    39         ReadyStateClosing = 2,
    40         ReadyStateClosed = 3,
    41     };
    42 
    4338    virtual ~RTCDataChannelHandlerClient() { }
    4439
    45     virtual void didChangeReadyState(ReadyState) = 0;
     40    virtual void didChangeReadyState(RTCDataChannelState) = 0;
    4641    virtual void didReceiveStringData(const String&) = 0;
    4742    virtual void didReceiveRawData(const char*, size_t) = 0;
    4843    virtual void didDetectError() = 0;
    49     virtual void bufferedAmountIsDecreasing() = 0;
     44    virtual void bufferedAmountIsDecreasing(size_t) = 0;
    5045};
    5146
  • TabularUnified trunk/Source/WebCore/platform/mediastream/RTCPeerConnectionHandlerClient.h

    r214212 r214627  
    3434#if ENABLE(WEB_RTC)
    3535
     36#include "RTCIceConnectionState.h"
     37#include "RTCIceGatheringState.h"
     38#include "RTCSignalingState.h"
    3639#include <wtf/PassRefPtr.h>
    3740
     
    4447class RTCPeerConnectionHandlerClient {
    4548public:
    46     enum SignalingState {
    47         SignalingStateStable = 1,
    48         SignalingStateHaveLocalOffer = 2,
    49         SignalingStateHaveRemoteOffer = 3,
    50         SignalingStateHaveLocalPrAnswer = 4,
    51         SignalingStateHaveRemotePrAnswer = 5,
    52         SignalingStateClosed = 6,
    53     };
    54 
    55     enum IceConnectionState {
    56         IceConnectionStateNew = 1,
    57         IceConnectionStateChecking = 2,
    58         IceConnectionStateConnected = 3,
    59         IceConnectionStateCompleted = 4,
    60         IceConnectionStateFailed = 5,
    61         IceConnectionStateDisconnected = 6,
    62         IceConnectionStateClosed = 7
    63     };
    64 
    65     enum IceGatheringState {
    66         IceGatheringStateNew = 1,
    67         IceGatheringStateGathering = 2,
    68         IceGatheringStateComplete = 3
    69     };
    70 
    7149    virtual ~RTCPeerConnectionHandlerClient() { }
    7250
    7351    virtual void negotiationNeeded() = 0;
    7452    virtual void didGenerateIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) = 0;
    75     virtual void didChangeSignalingState(SignalingState) = 0;
    76     virtual void didChangeIceGatheringState(IceGatheringState) = 0;
    77     virtual void didChangeIceConnectionState(IceConnectionState) = 0;
     53    virtual void didChangeSignalingState(RTCSignalingState) = 0;
     54    virtual void didChangeIceGatheringState(RTCIceGatheringState) = 0;
     55    virtual void didChangeIceConnectionState(RTCIceConnectionState) = 0;
    7856    virtual void didAddRemoteStream(PassRefPtr<MediaStreamPrivate>) = 0;
    7957    virtual void didRemoveRemoteStream(MediaStreamPrivate*) = 0;
  • TabularUnified trunk/Source/WebCore/platform/mock/RTCDataChannelHandlerMock.cpp

    r208694 r214627  
    11/*
    2  *  Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2526
    2627#include "config.h"
     28#include "RTCDataChannelHandlerMock.h"
    2729
    2830#if ENABLE(WEB_RTC)
    29 
    30 #include "RTCDataChannelHandlerMock.h"
    3131
    3232#include "RTCDataChannelHandlerClient.h"
     
    4747
    4848    m_client = client;
    49     RefPtr<DataChannelStateNotifier> notifier = adoptRef(new DataChannelStateNotifier(m_client, RTCDataChannelHandlerClient::ReadyStateOpen));
    50     m_timerEvents.append(adoptRef(new TimerEvent(this, notifier)));
     49    auto notifier = adoptRef(*new DataChannelStateNotifier(m_client, RTCDataChannelState::Open));
     50    m_timerEvents.append(adoptRef(new TimerEvent(this, WTFMove(notifier))));
    5151}
    5252
     
    6565void RTCDataChannelHandlerMock::close()
    6666{
    67     RefPtr<DataChannelStateNotifier> notifier = adoptRef(new DataChannelStateNotifier(m_client, RTCDataChannelHandlerClient::ReadyStateClosed));
    68     m_timerEvents.append(adoptRef(new TimerEvent(this, notifier)));
     67    auto notifier = adoptRef(*new DataChannelStateNotifier(m_client, RTCDataChannelState::Closed));
     68    m_timerEvents.append(adoptRef(new TimerEvent(this, WTFMove(notifier))));
    6969}
    7070
  • TabularUnified trunk/Source/WebCore/platform/mock/RTCNotifiersMock.cpp

    r198492 r214627  
    11/*
    2  *  Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
     3 * Copyright (C) 2017 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    6869}
    6970
    70 IceConnectionNotifier::IceConnectionNotifier(RTCPeerConnectionHandlerClient* client, RTCPeerConnectionHandlerClient::IceConnectionState connectionState, RTCPeerConnectionHandlerClient::IceGatheringState gatheringState)
     71IceConnectionNotifier::IceConnectionNotifier(RTCPeerConnectionHandlerClient* client, RTCIceConnectionState connectionState, RTCIceGatheringState gatheringState)
    7172    : m_client(client)
    7273    , m_connectionState(connectionState)
     
    8182}
    8283
    83 SignalingStateNotifier::SignalingStateNotifier(RTCPeerConnectionHandlerClient* client, RTCPeerConnectionHandlerClient::SignalingState signalingState)
     84SignalingStateNotifier::SignalingStateNotifier(RTCPeerConnectionHandlerClient* client, RTCSignalingState signalingState)
    8485    : m_client(client)
    8586    , m_signalingState(signalingState)
     
    102103}
    103104
    104 DataChannelStateNotifier::DataChannelStateNotifier(RTCDataChannelHandlerClient* client, RTCDataChannelHandlerClient::ReadyState state)
     105DataChannelStateNotifier::DataChannelStateNotifier(RTCDataChannelHandlerClient* client, RTCDataChannelState state)
    105106    : m_client(client)
    106107    , m_state(state)
  • TabularUnified trunk/Source/WebCore/platform/mock/RTCNotifiersMock.h

    r214212 r214627  
    6868class IceConnectionNotifier : public MockNotifier {
    6969public:
    70     IceConnectionNotifier(RTCPeerConnectionHandlerClient*, RTCPeerConnectionHandlerClient::IceConnectionState, RTCPeerConnectionHandlerClient::IceGatheringState);
     70    IceConnectionNotifier(RTCPeerConnectionHandlerClient*, RTCIceConnectionState, RTCIceGatheringState);
    7171
    7272    void fire() override;
     
    7474private:
    7575    RTCPeerConnectionHandlerClient* m_client;
    76     RTCPeerConnectionHandlerClient::IceConnectionState m_connectionState;
    77     RTCPeerConnectionHandlerClient::IceGatheringState m_gatheringState;
     76    RTCIceConnectionState m_connectionState;
     77    RTCIceGatheringState m_gatheringState;
    7878};
    7979
    8080class SignalingStateNotifier : public MockNotifier {
    8181public:
    82     SignalingStateNotifier(RTCPeerConnectionHandlerClient*, RTCPeerConnectionHandlerClient::SignalingState);
     82    SignalingStateNotifier(RTCPeerConnectionHandlerClient*, RTCSignalingState);
    8383
    8484    void fire() override;
     
    8686private:
    8787    RTCPeerConnectionHandlerClient* m_client;
    88     RTCPeerConnectionHandlerClient::SignalingState m_signalingState;
     88    RTCSignalingState m_signalingState;
    8989};
    9090
     
    101101class DataChannelStateNotifier : public MockNotifier {
    102102public:
    103     DataChannelStateNotifier(RTCDataChannelHandlerClient*, RTCDataChannelHandlerClient::ReadyState);
     103    DataChannelStateNotifier(RTCDataChannelHandlerClient*, RTCDataChannelState);
    104104
    105105    void fire() override;
     
    107107private:
    108108    RTCDataChannelHandlerClient* m_client;
    109     RTCDataChannelHandlerClient::ReadyState m_state;
     109    RTCDataChannelState m_state;
    110110};
    111111
Note: See TracChangeset for help on using the changeset viewer.