| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "core/html/VoidCallback.h" | 57 #include "core/html/VoidCallback.h" |
| 58 #include "core/loader/FrameLoader.h" | 58 #include "core/loader/FrameLoader.h" |
| 59 #include "modules/crypto/CryptoResultImpl.h" | 59 #include "modules/crypto/CryptoResultImpl.h" |
| 60 #include "modules/mediastream/MediaConstraintsImpl.h" | 60 #include "modules/mediastream/MediaConstraintsImpl.h" |
| 61 #include "modules/mediastream/MediaStreamEvent.h" | 61 #include "modules/mediastream/MediaStreamEvent.h" |
| 62 #include "modules/peerconnection/RTCAnswerOptions.h" | 62 #include "modules/peerconnection/RTCAnswerOptions.h" |
| 63 #include "modules/peerconnection/RTCConfiguration.h" | 63 #include "modules/peerconnection/RTCConfiguration.h" |
| 64 #include "modules/peerconnection/RTCDTMFSender.h" | 64 #include "modules/peerconnection/RTCDTMFSender.h" |
| 65 #include "modules/peerconnection/RTCDataChannel.h" | 65 #include "modules/peerconnection/RTCDataChannel.h" |
| 66 #include "modules/peerconnection/RTCDataChannelEvent.h" | 66 #include "modules/peerconnection/RTCDataChannelEvent.h" |
| 67 #include "modules/peerconnection/RTCDataChannelInit.h" |
| 67 #include "modules/peerconnection/RTCIceServer.h" | 68 #include "modules/peerconnection/RTCIceServer.h" |
| 68 #include "modules/peerconnection/RTCOfferOptions.h" | 69 #include "modules/peerconnection/RTCOfferOptions.h" |
| 69 #include "modules/peerconnection/RTCPeerConnectionErrorCallback.h" | 70 #include "modules/peerconnection/RTCPeerConnectionErrorCallback.h" |
| 70 #include "modules/peerconnection/RTCPeerConnectionIceEvent.h" | 71 #include "modules/peerconnection/RTCPeerConnectionIceEvent.h" |
| 71 #include "modules/peerconnection/RTCRtpReceiver.h" | 72 #include "modules/peerconnection/RTCRtpReceiver.h" |
| 72 #include "modules/peerconnection/RTCSessionDescription.h" | 73 #include "modules/peerconnection/RTCSessionDescription.h" |
| 73 #include "modules/peerconnection/RTCSessionDescriptionCallback.h" | 74 #include "modules/peerconnection/RTCSessionDescriptionCallback.h" |
| 74 #include "modules/peerconnection/RTCSessionDescriptionInit.h" | 75 #include "modules/peerconnection/RTCSessionDescriptionInit.h" |
| 75 #include "modules/peerconnection/RTCSessionDescriptionRequestImpl.h" | 76 #include "modules/peerconnection/RTCSessionDescriptionRequestImpl.h" |
| 76 #include "modules/peerconnection/RTCSessionDescriptionRequestPromiseImpl.h" | 77 #include "modules/peerconnection/RTCSessionDescriptionRequestPromiseImpl.h" |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 rtp_receivers_.insert(id, rtp_receiver); | 1208 rtp_receivers_.insert(id, rtp_receiver); |
| 1208 rtp_receivers[i] = rtp_receiver; | 1209 rtp_receivers[i] = rtp_receiver; |
| 1209 } | 1210 } |
| 1210 } | 1211 } |
| 1211 return rtp_receivers; | 1212 return rtp_receivers; |
| 1212 } | 1213 } |
| 1213 | 1214 |
| 1214 RTCDataChannel* RTCPeerConnection::createDataChannel( | 1215 RTCDataChannel* RTCPeerConnection::createDataChannel( |
| 1215 ScriptState* script_state, | 1216 ScriptState* script_state, |
| 1216 String label, | 1217 String label, |
| 1217 const Dictionary& options, | 1218 const RTCDataChannelInit& data_channel_dict, |
| 1218 ExceptionState& exception_state) { | 1219 ExceptionState& exception_state) { |
| 1219 if (ThrowExceptionIfSignalingStateClosed(signaling_state_, exception_state)) | 1220 if (ThrowExceptionIfSignalingStateClosed(signaling_state_, exception_state)) |
| 1220 return nullptr; | 1221 return nullptr; |
| 1221 | 1222 |
| 1222 WebRTCDataChannelInit init; | 1223 WebRTCDataChannelInit init; |
| 1223 DictionaryHelper::Get(options, "ordered", init.ordered); | 1224 init.ordered = data_channel_dict.ordered(); |
| 1224 DictionaryHelper::Get(options, "negotiated", init.negotiated); | |
| 1225 | |
| 1226 unsigned short value = 0; | |
| 1227 ExecutionContext* context = ExecutionContext::From(script_state); | 1225 ExecutionContext* context = ExecutionContext::From(script_state); |
| 1228 if (DictionaryHelper::Get(options, "id", value)) | 1226 if (data_channel_dict.hasMaxRetransmitTime()) { |
| 1229 init.id = value; | |
| 1230 if (DictionaryHelper::Get(options, "maxRetransmits", value)) { | |
| 1231 UseCounter::Count( | |
| 1232 context, UseCounter::kRTCPeerConnectionCreateDataChannelMaxRetransmits); | |
| 1233 init.max_retransmits = value; | |
| 1234 } | |
| 1235 if (DictionaryHelper::Get(options, "maxRetransmitTime", value)) { | |
| 1236 UseCounter::Count( | 1227 UseCounter::Count( |
| 1237 context, | 1228 context, |
| 1238 UseCounter::kRTCPeerConnectionCreateDataChannelMaxRetransmitTime); | 1229 UseCounter::kRTCPeerConnectionCreateDataChannelMaxRetransmitTime); |
| 1239 init.max_retransmit_time = value; | 1230 init.max_retransmit_time = data_channel_dict.maxRetransmitTime(); |
| 1240 } | 1231 } |
| 1241 | 1232 if (data_channel_dict.hasMaxRetransmits()) { |
| 1242 String protocol_string; | 1233 UseCounter::Count( |
| 1243 DictionaryHelper::Get(options, "protocol", protocol_string); | 1234 context, UseCounter::kRTCPeerConnectionCreateDataChannelMaxRetransmits); |
| 1244 init.protocol = protocol_string; | 1235 init.max_retransmits = data_channel_dict.maxRetransmits(); |
| 1236 } |
| 1237 init.protocol = data_channel_dict.protocol(); |
| 1238 init.negotiated = data_channel_dict.negotiated(); |
| 1239 if (data_channel_dict.hasId()) |
| 1240 init.id = data_channel_dict.id(); |
| 1245 | 1241 |
| 1246 RTCDataChannel* channel = RTCDataChannel::Create( | 1242 RTCDataChannel* channel = RTCDataChannel::Create( |
| 1247 GetExecutionContext(), peer_handler_.get(), label, init, exception_state); | 1243 GetExecutionContext(), peer_handler_.get(), label, init, exception_state); |
| 1248 if (exception_state.HadException()) | 1244 if (exception_state.HadException()) |
| 1249 return nullptr; | 1245 return nullptr; |
| 1250 RTCDataChannel::ReadyState handler_state = channel->GetHandlerState(); | 1246 RTCDataChannel::ReadyState handler_state = channel->GetHandlerState(); |
| 1251 if (handler_state != RTCDataChannel::kReadyStateConnecting) { | 1247 if (handler_state != RTCDataChannel::kReadyStateConnecting) { |
| 1252 // There was an early state transition. Don't miss it! | 1248 // There was an early state transition. Don't miss it! |
| 1253 channel->DidChangeReadyState(handler_state); | 1249 channel->DidChangeReadyState(handler_state); |
| 1254 } | 1250 } |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 visitor->Trace(local_streams_); | 1562 visitor->Trace(local_streams_); |
| 1567 visitor->Trace(remote_streams_); | 1563 visitor->Trace(remote_streams_); |
| 1568 visitor->Trace(rtp_receivers_); | 1564 visitor->Trace(rtp_receivers_); |
| 1569 visitor->Trace(dispatch_scheduled_event_runner_); | 1565 visitor->Trace(dispatch_scheduled_event_runner_); |
| 1570 visitor->Trace(scheduled_events_); | 1566 visitor->Trace(scheduled_events_); |
| 1571 EventTargetWithInlineData::Trace(visitor); | 1567 EventTargetWithInlineData::Trace(visitor); |
| 1572 SuspendableObject::Trace(visitor); | 1568 SuspendableObject::Trace(visitor); |
| 1573 } | 1569 } |
| 1574 | 1570 |
| 1575 } // namespace blink | 1571 } // namespace blink |
| OLD | NEW |