| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 init.id = value; | 789 init.id = value; |
| 790 if (DictionaryHelper::get(options, "maxRetransmits", value)) | 790 if (DictionaryHelper::get(options, "maxRetransmits", value)) |
| 791 init.maxRetransmits = value; | 791 init.maxRetransmits = value; |
| 792 if (DictionaryHelper::get(options, "maxRetransmitTime", value)) | 792 if (DictionaryHelper::get(options, "maxRetransmitTime", value)) |
| 793 init.maxRetransmitTime = value; | 793 init.maxRetransmitTime = value; |
| 794 | 794 |
| 795 String protocolString; | 795 String protocolString; |
| 796 DictionaryHelper::get(options, "protocol", protocolString); | 796 DictionaryHelper::get(options, "protocol", protocolString); |
| 797 init.protocol = protocolString; | 797 init.protocol = protocolString; |
| 798 | 798 |
| 799 RTCDataChannel* channel = RTCDataChannel::create(executionContext(), this, m
_peerHandler.get(), label, init, exceptionState); | 799 RTCDataChannel* channel = RTCDataChannel::create(executionContext(), m_peerH
andler.get(), label, init, exceptionState); |
| 800 if (exceptionState.hadException()) | 800 if (exceptionState.hadException()) |
| 801 return nullptr; | 801 return nullptr; |
| 802 m_dataChannels.append(channel); | |
| 803 RTCDataChannel::ReadyState handlerState = channel->getHandlerState(); | 802 RTCDataChannel::ReadyState handlerState = channel->getHandlerState(); |
| 804 if (handlerState != RTCDataChannel::ReadyStateConnecting) { | 803 if (handlerState != RTCDataChannel::ReadyStateConnecting) { |
| 805 // There was an early state transition. Don't miss it! | 804 // There was an early state transition. Don't miss it! |
| 806 channel->didChangeReadyState(handlerState); | 805 channel->didChangeReadyState(handlerState); |
| 807 } | 806 } |
| 808 return channel; | 807 return channel; |
| 809 } | 808 } |
| 810 | 809 |
| 811 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId) | 810 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId) |
| 812 { | 811 { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 } | 917 } |
| 919 | 918 |
| 920 void RTCPeerConnection::didAddRemoteDataChannel(WebRTCDataChannelHandler* handle
r) | 919 void RTCPeerConnection::didAddRemoteDataChannel(WebRTCDataChannelHandler* handle
r) |
| 921 { | 920 { |
| 922 ASSERT(!m_closed); | 921 ASSERT(!m_closed); |
| 923 ASSERT(executionContext()->isContextThread()); | 922 ASSERT(executionContext()->isContextThread()); |
| 924 | 923 |
| 925 if (m_signalingState == SignalingStateClosed) | 924 if (m_signalingState == SignalingStateClosed) |
| 926 return; | 925 return; |
| 927 | 926 |
| 928 RTCDataChannel* channel = RTCDataChannel::create(executionContext(), this, a
doptPtr(handler)); | 927 RTCDataChannel* channel = RTCDataChannel::create(executionContext(), adoptPt
r(handler)); |
| 929 m_dataChannels.append(channel); | |
| 930 | |
| 931 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne
l, false, false, channel)); | 928 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne
l, false, false, channel)); |
| 932 } | 929 } |
| 933 | 930 |
| 934 void RTCPeerConnection::releasePeerConnectionHandler() | 931 void RTCPeerConnection::releasePeerConnectionHandler() |
| 935 { | 932 { |
| 936 stop(); | 933 stop(); |
| 937 } | 934 } |
| 938 | 935 |
| 939 void RTCPeerConnection::closePeerConnection() | 936 void RTCPeerConnection::closePeerConnection() |
| 940 { | 937 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 964 | 961 |
| 965 void RTCPeerConnection::stop() | 962 void RTCPeerConnection::stop() |
| 966 { | 963 { |
| 967 if (m_stopped) | 964 if (m_stopped) |
| 968 return; | 965 return; |
| 969 | 966 |
| 970 m_stopped = true; | 967 m_stopped = true; |
| 971 m_iceConnectionState = ICEConnectionStateClosed; | 968 m_iceConnectionState = ICEConnectionStateClosed; |
| 972 m_signalingState = SignalingStateClosed; | 969 m_signalingState = SignalingStateClosed; |
| 973 | 970 |
| 974 HeapVector<Member<RTCDataChannel>>::iterator i = m_dataChannels.begin(); | |
| 975 for (; i != m_dataChannels.end(); ++i) | |
| 976 (*i)->stop(); | |
| 977 m_dataChannels.clear(); | |
| 978 | |
| 979 m_dispatchScheduledEventRunner->stop(); | 971 m_dispatchScheduledEventRunner->stop(); |
| 980 | 972 |
| 981 m_peerHandler.clear(); | 973 m_peerHandler.clear(); |
| 982 } | 974 } |
| 983 | 975 |
| 984 void RTCPeerConnection::changeSignalingState(SignalingState signalingState) | 976 void RTCPeerConnection::changeSignalingState(SignalingState signalingState) |
| 985 { | 977 { |
| 986 if (m_signalingState != SignalingStateClosed && m_signalingState != signalin
gState) { | 978 if (m_signalingState != SignalingStateClosed && m_signalingState != signalin
gState) { |
| 987 m_signalingState = signalingState; | 979 m_signalingState = signalingState; |
| 988 scheduleDispatchEvent(Event::create(EventTypeNames::signalingstatechange
)); | 980 scheduleDispatchEvent(Event::create(EventTypeNames::signalingstatechange
)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 } | 1042 } |
| 1051 } | 1043 } |
| 1052 | 1044 |
| 1053 events.clear(); | 1045 events.clear(); |
| 1054 } | 1046 } |
| 1055 | 1047 |
| 1056 DEFINE_TRACE(RTCPeerConnection) | 1048 DEFINE_TRACE(RTCPeerConnection) |
| 1057 { | 1049 { |
| 1058 visitor->trace(m_localStreams); | 1050 visitor->trace(m_localStreams); |
| 1059 visitor->trace(m_remoteStreams); | 1051 visitor->trace(m_remoteStreams); |
| 1060 visitor->trace(m_dataChannels); | |
| 1061 visitor->trace(m_dispatchScheduledEventRunner); | 1052 visitor->trace(m_dispatchScheduledEventRunner); |
| 1062 visitor->trace(m_scheduledEvents); | 1053 visitor->trace(m_scheduledEvents); |
| 1063 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac
e(visitor); | 1054 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac
e(visitor); |
| 1064 ActiveDOMObject::trace(visitor); | 1055 ActiveDOMObject::trace(visitor); |
| 1065 } | 1056 } |
| 1066 | 1057 |
| 1067 } // namespace blink | 1058 } // namespace blink |
| OLD | NEW |