| 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(), m_peerH
andler.get(), label, init, exceptionState); | 799 RTCDataChannel* channel = RTCDataChannel::create(executionContext(), this, m
_peerHandler.get(), label, init, exceptionState); |
| 800 if (exceptionState.hadException()) | 800 if (exceptionState.hadException()) |
| 801 return nullptr; | 801 return nullptr; |
| 802 m_dataChannels.append(channel); |
| 802 RTCDataChannel::ReadyState handlerState = channel->getHandlerState(); | 803 RTCDataChannel::ReadyState handlerState = channel->getHandlerState(); |
| 803 if (handlerState != RTCDataChannel::ReadyStateConnecting) { | 804 if (handlerState != RTCDataChannel::ReadyStateConnecting) { |
| 804 // There was an early state transition. Don't miss it! | 805 // There was an early state transition. Don't miss it! |
| 805 channel->didChangeReadyState(handlerState); | 806 channel->didChangeReadyState(handlerState); |
| 806 } | 807 } |
| 807 return channel; | 808 return channel; |
| 808 } | 809 } |
| 809 | 810 |
| 810 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId) | 811 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId) |
| 811 { | 812 { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 } | 918 } |
| 918 | 919 |
| 919 void RTCPeerConnection::didAddRemoteDataChannel(WebRTCDataChannelHandler* handle
r) | 920 void RTCPeerConnection::didAddRemoteDataChannel(WebRTCDataChannelHandler* handle
r) |
| 920 { | 921 { |
| 921 ASSERT(!m_closed); | 922 ASSERT(!m_closed); |
| 922 ASSERT(executionContext()->isContextThread()); | 923 ASSERT(executionContext()->isContextThread()); |
| 923 | 924 |
| 924 if (m_signalingState == SignalingStateClosed) | 925 if (m_signalingState == SignalingStateClosed) |
| 925 return; | 926 return; |
| 926 | 927 |
| 927 RTCDataChannel* channel = RTCDataChannel::create(executionContext(), adoptPt
r(handler)); | 928 RTCDataChannel* channel = RTCDataChannel::create(executionContext(), this, a
doptPtr(handler)); |
| 929 m_dataChannels.append(channel); |
| 930 |
| 928 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne
l, false, false, channel)); | 931 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne
l, false, false, channel)); |
| 929 } | 932 } |
| 930 | 933 |
| 931 void RTCPeerConnection::releasePeerConnectionHandler() | 934 void RTCPeerConnection::releasePeerConnectionHandler() |
| 932 { | 935 { |
| 933 stop(); | 936 stop(); |
| 934 } | 937 } |
| 935 | 938 |
| 936 void RTCPeerConnection::closePeerConnection() | 939 void RTCPeerConnection::closePeerConnection() |
| 937 { | 940 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 961 | 964 |
| 962 void RTCPeerConnection::stop() | 965 void RTCPeerConnection::stop() |
| 963 { | 966 { |
| 964 if (m_stopped) | 967 if (m_stopped) |
| 965 return; | 968 return; |
| 966 | 969 |
| 967 m_stopped = true; | 970 m_stopped = true; |
| 968 m_iceConnectionState = ICEConnectionStateClosed; | 971 m_iceConnectionState = ICEConnectionStateClosed; |
| 969 m_signalingState = SignalingStateClosed; | 972 m_signalingState = SignalingStateClosed; |
| 970 | 973 |
| 974 HeapVector<Member<RTCDataChannel>>::iterator i = m_dataChannels.begin(); |
| 975 for (; i != m_dataChannels.end(); ++i) |
| 976 (*i)->stop(); |
| 977 m_dataChannels.clear(); |
| 978 |
| 971 m_dispatchScheduledEventRunner->stop(); | 979 m_dispatchScheduledEventRunner->stop(); |
| 972 | 980 |
| 973 m_peerHandler.clear(); | 981 m_peerHandler.clear(); |
| 974 } | 982 } |
| 975 | 983 |
| 976 void RTCPeerConnection::changeSignalingState(SignalingState signalingState) | 984 void RTCPeerConnection::changeSignalingState(SignalingState signalingState) |
| 977 { | 985 { |
| 978 if (m_signalingState != SignalingStateClosed && m_signalingState != signalin
gState) { | 986 if (m_signalingState != SignalingStateClosed && m_signalingState != signalin
gState) { |
| 979 m_signalingState = signalingState; | 987 m_signalingState = signalingState; |
| 980 scheduleDispatchEvent(Event::create(EventTypeNames::signalingstatechange
)); | 988 scheduleDispatchEvent(Event::create(EventTypeNames::signalingstatechange
)); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 } | 1050 } |
| 1043 } | 1051 } |
| 1044 | 1052 |
| 1045 events.clear(); | 1053 events.clear(); |
| 1046 } | 1054 } |
| 1047 | 1055 |
| 1048 DEFINE_TRACE(RTCPeerConnection) | 1056 DEFINE_TRACE(RTCPeerConnection) |
| 1049 { | 1057 { |
| 1050 visitor->trace(m_localStreams); | 1058 visitor->trace(m_localStreams); |
| 1051 visitor->trace(m_remoteStreams); | 1059 visitor->trace(m_remoteStreams); |
| 1060 visitor->trace(m_dataChannels); |
| 1052 visitor->trace(m_dispatchScheduledEventRunner); | 1061 visitor->trace(m_dispatchScheduledEventRunner); |
| 1053 visitor->trace(m_scheduledEvents); | 1062 visitor->trace(m_scheduledEvents); |
| 1054 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac
e(visitor); | 1063 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac
e(visitor); |
| 1055 ActiveDOMObject::trace(visitor); | 1064 ActiveDOMObject::trace(visitor); |
| 1056 } | 1065 } |
| 1057 | 1066 |
| 1058 } // namespace blink | 1067 } // namespace blink |
| OLD | NEW |