| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 public: | 393 public: |
| 394 // Takes ownership of |resolver|. | 394 // Takes ownership of |resolver|. |
| 395 static std::unique_ptr<WebRTCStatsReportCallback> Create( | 395 static std::unique_ptr<WebRTCStatsReportCallback> Create( |
| 396 ScriptPromiseResolver* resolver) { | 396 ScriptPromiseResolver* resolver) { |
| 397 return std::unique_ptr<WebRTCStatsReportCallback>( | 397 return std::unique_ptr<WebRTCStatsReportCallback>( |
| 398 new WebRTCStatsReportCallbackResolver(resolver)); | 398 new WebRTCStatsReportCallbackResolver(resolver)); |
| 399 } | 399 } |
| 400 | 400 |
| 401 ~WebRTCStatsReportCallbackResolver() override { | 401 ~WebRTCStatsReportCallbackResolver() override { |
| 402 DCHECK( | 402 DCHECK( |
| 403 resolver_->GetScriptState()->GetExecutionContext()->IsContextThread()); | 403 ExecutionContext::From(resolver_->GetScriptState())->IsContextThread()); |
| 404 } | 404 } |
| 405 | 405 |
| 406 private: | 406 private: |
| 407 WebRTCStatsReportCallbackResolver(ScriptPromiseResolver* resolver) | 407 WebRTCStatsReportCallbackResolver(ScriptPromiseResolver* resolver) |
| 408 : resolver_(resolver) {} | 408 : resolver_(resolver) {} |
| 409 | 409 |
| 410 void OnStatsDelivered(std::unique_ptr<WebRTCStatsReport> report) override { | 410 void OnStatsDelivered(std::unique_ptr<WebRTCStatsReport> report) override { |
| 411 DCHECK( | 411 DCHECK( |
| 412 resolver_->GetScriptState()->GetExecutionContext()->IsContextThread()); | 412 ExecutionContext::From(resolver_->GetScriptState())->IsContextThread()); |
| 413 resolver_->Resolve(new RTCStatsReport(std::move(report))); | 413 resolver_->Resolve(new RTCStatsReport(std::move(report))); |
| 414 } | 414 } |
| 415 | 415 |
| 416 Persistent<ScriptPromiseResolver> resolver_; | 416 Persistent<ScriptPromiseResolver> resolver_; |
| 417 }; | 417 }; |
| 418 | 418 |
| 419 } // namespace | 419 } // namespace |
| 420 | 420 |
| 421 RTCPeerConnection::EventWrapper::EventWrapper( | 421 RTCPeerConnection::EventWrapper::EventWrapper( |
| 422 Event* event, | 422 Event* event, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 if (signaling_state_ == kSignalingStateClosed) | 557 if (signaling_state_ == kSignalingStateClosed) |
| 558 return ScriptPromise::RejectWithDOMException( | 558 return ScriptPromise::RejectWithDOMException( |
| 559 script_state, | 559 script_state, |
| 560 DOMException::Create(kInvalidStateError, kSignalingStateClosedMessage)); | 560 DOMException::Create(kInvalidStateError, kSignalingStateClosedMessage)); |
| 561 | 561 |
| 562 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); | 562 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); |
| 563 ScriptPromise promise = resolver->Promise(); | 563 ScriptPromise promise = resolver->Promise(); |
| 564 RTCSessionDescriptionRequest* request = | 564 RTCSessionDescriptionRequest* request = |
| 565 RTCSessionDescriptionRequestPromiseImpl::Create(this, resolver); | 565 RTCSessionDescriptionRequestPromiseImpl::Create(this, resolver); |
| 566 if (options.hasOfferToReceiveAudio() || options.hasOfferToReceiveVideo()) { | 566 if (options.hasOfferToReceiveAudio() || options.hasOfferToReceiveVideo()) { |
| 567 ExecutionContext* context = script_state->GetExecutionContext(); | 567 ExecutionContext* context = ExecutionContext::From(script_state); |
| 568 UseCounter::Count( | 568 UseCounter::Count( |
| 569 context, | 569 context, |
| 570 UseCounter::kRTCPeerConnectionCreateOfferOptionsOfferToReceive); | 570 UseCounter::kRTCPeerConnectionCreateOfferOptionsOfferToReceive); |
| 571 } | 571 } |
| 572 peer_handler_->CreateOffer(request, ConvertToWebRTCOfferOptions(options)); | 572 peer_handler_->CreateOffer(request, ConvertToWebRTCOfferOptions(options)); |
| 573 return promise; | 573 return promise; |
| 574 } | 574 } |
| 575 | 575 |
| 576 ScriptPromise RTCPeerConnection::createOffer( | 576 ScriptPromise RTCPeerConnection::createOffer( |
| 577 ScriptState* script_state, | 577 ScriptState* script_state, |
| 578 RTCSessionDescriptionCallback* success_callback, | 578 RTCSessionDescriptionCallback* success_callback, |
| 579 RTCPeerConnectionErrorCallback* error_callback, | 579 RTCPeerConnectionErrorCallback* error_callback, |
| 580 const Dictionary& rtc_offer_options, | 580 const Dictionary& rtc_offer_options, |
| 581 ExceptionState& exception_state) { | 581 ExceptionState& exception_state) { |
| 582 DCHECK(success_callback); | 582 DCHECK(success_callback); |
| 583 DCHECK(error_callback); | 583 DCHECK(error_callback); |
| 584 ExecutionContext* context = script_state->GetExecutionContext(); | 584 ExecutionContext* context = ExecutionContext::From(script_state); |
| 585 UseCounter::Count( | 585 UseCounter::Count( |
| 586 context, UseCounter::kRTCPeerConnectionCreateOfferLegacyFailureCallback); | 586 context, UseCounter::kRTCPeerConnectionCreateOfferLegacyFailureCallback); |
| 587 if (CallErrorCallbackIfSignalingStateClosed(signaling_state_, error_callback)) | 587 if (CallErrorCallbackIfSignalingStateClosed(signaling_state_, error_callback)) |
| 588 return ScriptPromise::CastUndefined(script_state); | 588 return ScriptPromise::CastUndefined(script_state); |
| 589 | 589 |
| 590 RTCOfferOptionsPlatform* offer_options = | 590 RTCOfferOptionsPlatform* offer_options = |
| 591 ParseOfferOptions(rtc_offer_options, exception_state); | 591 ParseOfferOptions(rtc_offer_options, exception_state); |
| 592 if (exception_state.HadException()) | 592 if (exception_state.HadException()) |
| 593 return ScriptPromise(); | 593 return ScriptPromise(); |
| 594 RTCSessionDescriptionRequest* request = | 594 RTCSessionDescriptionRequest* request = |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 return promise; | 647 return promise; |
| 648 } | 648 } |
| 649 | 649 |
| 650 ScriptPromise RTCPeerConnection::createAnswer( | 650 ScriptPromise RTCPeerConnection::createAnswer( |
| 651 ScriptState* script_state, | 651 ScriptState* script_state, |
| 652 RTCSessionDescriptionCallback* success_callback, | 652 RTCSessionDescriptionCallback* success_callback, |
| 653 RTCPeerConnectionErrorCallback* error_callback, | 653 RTCPeerConnectionErrorCallback* error_callback, |
| 654 const Dictionary& media_constraints) { | 654 const Dictionary& media_constraints) { |
| 655 DCHECK(success_callback); | 655 DCHECK(success_callback); |
| 656 DCHECK(error_callback); | 656 DCHECK(error_callback); |
| 657 ExecutionContext* context = script_state->GetExecutionContext(); | 657 ExecutionContext* context = ExecutionContext::From(script_state); |
| 658 UseCounter::Count( | 658 UseCounter::Count( |
| 659 context, UseCounter::kRTCPeerConnectionCreateAnswerLegacyFailureCallback); | 659 context, UseCounter::kRTCPeerConnectionCreateAnswerLegacyFailureCallback); |
| 660 if (media_constraints.IsObject()) | 660 if (media_constraints.IsObject()) |
| 661 UseCounter::Count( | 661 UseCounter::Count( |
| 662 context, UseCounter::kRTCPeerConnectionCreateAnswerLegacyConstraints); | 662 context, UseCounter::kRTCPeerConnectionCreateAnswerLegacyConstraints); |
| 663 else | 663 else |
| 664 UseCounter::Count( | 664 UseCounter::Count( |
| 665 context, UseCounter::kRTCPeerConnectionCreateAnswerLegacyCompliant); | 665 context, UseCounter::kRTCPeerConnectionCreateAnswerLegacyCompliant); |
| 666 | 666 |
| 667 if (CallErrorCallbackIfSignalingStateClosed(signaling_state_, error_callback)) | 667 if (CallErrorCallbackIfSignalingStateClosed(signaling_state_, error_callback)) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 request, WebRTCSessionDescription(session_description_init.type(), | 702 request, WebRTCSessionDescription(session_description_init.type(), |
| 703 session_description_init.sdp())); | 703 session_description_init.sdp())); |
| 704 return promise; | 704 return promise; |
| 705 } | 705 } |
| 706 | 706 |
| 707 ScriptPromise RTCPeerConnection::setLocalDescription( | 707 ScriptPromise RTCPeerConnection::setLocalDescription( |
| 708 ScriptState* script_state, | 708 ScriptState* script_state, |
| 709 const RTCSessionDescriptionInit& session_description_init, | 709 const RTCSessionDescriptionInit& session_description_init, |
| 710 VoidCallback* success_callback, | 710 VoidCallback* success_callback, |
| 711 RTCPeerConnectionErrorCallback* error_callback) { | 711 RTCPeerConnectionErrorCallback* error_callback) { |
| 712 ExecutionContext* context = script_state->GetExecutionContext(); | 712 ExecutionContext* context = ExecutionContext::From(script_state); |
| 713 if (success_callback && error_callback) { | 713 if (success_callback && error_callback) { |
| 714 UseCounter::Count( | 714 UseCounter::Count( |
| 715 context, | 715 context, |
| 716 UseCounter::kRTCPeerConnectionSetLocalDescriptionLegacyCompliant); | 716 UseCounter::kRTCPeerConnectionSetLocalDescriptionLegacyCompliant); |
| 717 } else { | 717 } else { |
| 718 if (!success_callback) | 718 if (!success_callback) |
| 719 UseCounter::Count( | 719 UseCounter::Count( |
| 720 context, | 720 context, |
| 721 UseCounter:: | 721 UseCounter:: |
| 722 kRTCPeerConnectionSetLocalDescriptionLegacyNoSuccessCallback); | 722 kRTCPeerConnectionSetLocalDescriptionLegacyNoSuccessCallback); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 request, WebRTCSessionDescription(session_description_init.type(), | 762 request, WebRTCSessionDescription(session_description_init.type(), |
| 763 session_description_init.sdp())); | 763 session_description_init.sdp())); |
| 764 return promise; | 764 return promise; |
| 765 } | 765 } |
| 766 | 766 |
| 767 ScriptPromise RTCPeerConnection::setRemoteDescription( | 767 ScriptPromise RTCPeerConnection::setRemoteDescription( |
| 768 ScriptState* script_state, | 768 ScriptState* script_state, |
| 769 const RTCSessionDescriptionInit& session_description_init, | 769 const RTCSessionDescriptionInit& session_description_init, |
| 770 VoidCallback* success_callback, | 770 VoidCallback* success_callback, |
| 771 RTCPeerConnectionErrorCallback* error_callback) { | 771 RTCPeerConnectionErrorCallback* error_callback) { |
| 772 ExecutionContext* context = script_state->GetExecutionContext(); | 772 ExecutionContext* context = ExecutionContext::From(script_state); |
| 773 if (success_callback && error_callback) { | 773 if (success_callback && error_callback) { |
| 774 UseCounter::Count( | 774 UseCounter::Count( |
| 775 context, | 775 context, |
| 776 UseCounter::kRTCPeerConnectionSetRemoteDescriptionLegacyCompliant); | 776 UseCounter::kRTCPeerConnectionSetRemoteDescriptionLegacyCompliant); |
| 777 } else { | 777 } else { |
| 778 if (!success_callback) | 778 if (!success_callback) |
| 779 UseCounter::Count( | 779 UseCounter::Count( |
| 780 context, | 780 context, |
| 781 UseCounter:: | 781 UseCounter:: |
| 782 kRTCPeerConnectionSetRemoteDescriptionLegacyNoSuccessCallback); | 782 kRTCPeerConnectionSetRemoteDescriptionLegacyNoSuccessCallback); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 808 } | 808 } |
| 809 | 809 |
| 810 void RTCPeerConnection::setConfiguration( | 810 void RTCPeerConnection::setConfiguration( |
| 811 ScriptState* script_state, | 811 ScriptState* script_state, |
| 812 const RTCConfiguration& rtc_configuration, | 812 const RTCConfiguration& rtc_configuration, |
| 813 ExceptionState& exception_state) { | 813 ExceptionState& exception_state) { |
| 814 if (ThrowExceptionIfSignalingStateClosed(signaling_state_, exception_state)) | 814 if (ThrowExceptionIfSignalingStateClosed(signaling_state_, exception_state)) |
| 815 return; | 815 return; |
| 816 | 816 |
| 817 WebRTCConfiguration configuration = ParseConfiguration( | 817 WebRTCConfiguration configuration = ParseConfiguration( |
| 818 script_state->GetExecutionContext(), rtc_configuration, exception_state); | 818 ExecutionContext::From(script_state), rtc_configuration, exception_state); |
| 819 | 819 |
| 820 if (exception_state.HadException()) | 820 if (exception_state.HadException()) |
| 821 return; | 821 return; |
| 822 | 822 |
| 823 MediaErrorState media_error_state; | 823 MediaErrorState media_error_state; |
| 824 if (media_error_state.HadException()) { | 824 if (media_error_state.HadException()) { |
| 825 media_error_state.RaiseException(exception_state); | 825 media_error_state.RaiseException(exception_state); |
| 826 return; | 826 return; |
| 827 } | 827 } |
| 828 | 828 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 return ScriptPromise::Reject( | 975 return ScriptPromise::Reject( |
| 976 script_state, | 976 script_state, |
| 977 V8ThrowException::CreateTypeError( | 977 V8ThrowException::CreateTypeError( |
| 978 script_state->GetIsolate(), | 978 script_state->GetIsolate(), |
| 979 "Candidate missing values for both sdpMid and sdpMLineIndex")); | 979 "Candidate missing values for both sdpMid and sdpMLineIndex")); |
| 980 | 980 |
| 981 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); | 981 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); |
| 982 ScriptPromise promise = resolver->Promise(); | 982 ScriptPromise promise = resolver->Promise(); |
| 983 RTCVoidRequest* request = RTCVoidRequestPromiseImpl::Create(this, resolver); | 983 RTCVoidRequest* request = RTCVoidRequestPromiseImpl::Create(this, resolver); |
| 984 WebRTCICECandidate web_candidate = ConvertToWebRTCIceCandidate( | 984 WebRTCICECandidate web_candidate = ConvertToWebRTCIceCandidate( |
| 985 script_state->GetExecutionContext(), candidate); | 985 ExecutionContext::From(script_state), candidate); |
| 986 bool implemented = peer_handler_->AddICECandidate(request, web_candidate); | 986 bool implemented = peer_handler_->AddICECandidate(request, web_candidate); |
| 987 if (!implemented) | 987 if (!implemented) |
| 988 resolver->Reject(DOMException::Create( | 988 resolver->Reject(DOMException::Create( |
| 989 kOperationError, "This operation could not be completed.")); | 989 kOperationError, "This operation could not be completed.")); |
| 990 | 990 |
| 991 return promise; | 991 return promise; |
| 992 } | 992 } |
| 993 | 993 |
| 994 ScriptPromise RTCPeerConnection::addIceCandidate( | 994 ScriptPromise RTCPeerConnection::addIceCandidate( |
| 995 ScriptState* script_state, | 995 ScriptState* script_state, |
| 996 const RTCIceCandidateInitOrRTCIceCandidate& candidate, | 996 const RTCIceCandidateInitOrRTCIceCandidate& candidate, |
| 997 VoidCallback* success_callback, | 997 VoidCallback* success_callback, |
| 998 RTCPeerConnectionErrorCallback* error_callback) { | 998 RTCPeerConnectionErrorCallback* error_callback) { |
| 999 DCHECK(success_callback); | 999 DCHECK(success_callback); |
| 1000 DCHECK(error_callback); | 1000 DCHECK(error_callback); |
| 1001 | 1001 |
| 1002 if (CallErrorCallbackIfSignalingStateClosed(signaling_state_, error_callback)) | 1002 if (CallErrorCallbackIfSignalingStateClosed(signaling_state_, error_callback)) |
| 1003 return ScriptPromise::CastUndefined(script_state); | 1003 return ScriptPromise::CastUndefined(script_state); |
| 1004 | 1004 |
| 1005 if (IsIceCandidateMissingSdp(candidate)) | 1005 if (IsIceCandidateMissingSdp(candidate)) |
| 1006 return ScriptPromise::Reject( | 1006 return ScriptPromise::Reject( |
| 1007 script_state, | 1007 script_state, |
| 1008 V8ThrowException::CreateTypeError( | 1008 V8ThrowException::CreateTypeError( |
| 1009 script_state->GetIsolate(), | 1009 script_state->GetIsolate(), |
| 1010 "Candidate missing values for both sdpMid and sdpMLineIndex")); | 1010 "Candidate missing values for both sdpMid and sdpMLineIndex")); |
| 1011 | 1011 |
| 1012 RTCVoidRequest* request = RTCVoidRequestImpl::Create( | 1012 RTCVoidRequest* request = RTCVoidRequestImpl::Create( |
| 1013 GetExecutionContext(), this, success_callback, error_callback); | 1013 GetExecutionContext(), this, success_callback, error_callback); |
| 1014 WebRTCICECandidate web_candidate = ConvertToWebRTCIceCandidate( | 1014 WebRTCICECandidate web_candidate = ConvertToWebRTCIceCandidate( |
| 1015 script_state->GetExecutionContext(), candidate); | 1015 ExecutionContext::From(script_state), candidate); |
| 1016 bool implemented = peer_handler_->AddICECandidate(request, web_candidate); | 1016 bool implemented = peer_handler_->AddICECandidate(request, web_candidate); |
| 1017 if (!implemented) | 1017 if (!implemented) |
| 1018 AsyncCallErrorCallback( | 1018 AsyncCallErrorCallback( |
| 1019 error_callback, | 1019 error_callback, |
| 1020 DOMException::Create(kOperationError, | 1020 DOMException::Create(kOperationError, |
| 1021 "This operation could not be completed.")); | 1021 "This operation could not be completed.")); |
| 1022 | 1022 |
| 1023 return ScriptPromise::CastUndefined(script_state); | 1023 return ScriptPromise::CastUndefined(script_state); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 kTypeMismatchError, | 1091 kTypeMismatchError, |
| 1092 ExceptionMessages::ArgumentNullOrIncorrectType(1, "MediaStream")); | 1092 ExceptionMessages::ArgumentNullOrIncorrectType(1, "MediaStream")); |
| 1093 return; | 1093 return; |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 if (local_streams_.Contains(stream)) | 1096 if (local_streams_.Contains(stream)) |
| 1097 return; | 1097 return; |
| 1098 | 1098 |
| 1099 MediaErrorState media_error_state; | 1099 MediaErrorState media_error_state; |
| 1100 WebMediaConstraints constraints = | 1100 WebMediaConstraints constraints = |
| 1101 MediaConstraintsImpl::Create(script_state->GetExecutionContext(), | 1101 MediaConstraintsImpl::Create(ExecutionContext::From(script_state), |
| 1102 media_constraints, media_error_state); | 1102 media_constraints, media_error_state); |
| 1103 if (media_error_state.HadException()) { | 1103 if (media_error_state.HadException()) { |
| 1104 media_error_state.RaiseException(exception_state); | 1104 media_error_state.RaiseException(exception_state); |
| 1105 return; | 1105 return; |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 local_streams_.push_back(stream); | 1108 local_streams_.push_back(stream); |
| 1109 | 1109 |
| 1110 bool valid = peer_handler_->AddStream(stream->Descriptor(), constraints); | 1110 bool valid = peer_handler_->AddStream(stream->Descriptor(), constraints); |
| 1111 if (!valid) | 1111 if (!valid) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 if ((*iter)->id() == stream_id) | 1154 if ((*iter)->id() == stream_id) |
| 1155 return iter->Get(); | 1155 return iter->Get(); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 return 0; | 1158 return 0; |
| 1159 } | 1159 } |
| 1160 | 1160 |
| 1161 ScriptPromise RTCPeerConnection::getStats(ScriptState* script_state, | 1161 ScriptPromise RTCPeerConnection::getStats(ScriptState* script_state, |
| 1162 RTCStatsCallback* success_callback, | 1162 RTCStatsCallback* success_callback, |
| 1163 MediaStreamTrack* selector) { | 1163 MediaStreamTrack* selector) { |
| 1164 ExecutionContext* context = script_state->GetExecutionContext(); | 1164 ExecutionContext* context = ExecutionContext::From(script_state); |
| 1165 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); | 1165 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); |
| 1166 ScriptPromise promise = resolver->Promise(); | 1166 ScriptPromise promise = resolver->Promise(); |
| 1167 | 1167 |
| 1168 UseCounter::Count(context, | 1168 UseCounter::Count(context, |
| 1169 UseCounter::kRTCPeerConnectionGetStatsLegacyNonCompliant); | 1169 UseCounter::kRTCPeerConnectionGetStatsLegacyNonCompliant); |
| 1170 RTCStatsRequest* stats_request = RTCStatsRequestImpl::Create( | 1170 RTCStatsRequest* stats_request = RTCStatsRequestImpl::Create( |
| 1171 GetExecutionContext(), this, success_callback, selector); | 1171 GetExecutionContext(), this, success_callback, selector); |
| 1172 // FIXME: Add passing selector as part of the statsRequest. | 1172 // FIXME: Add passing selector as part of the statsRequest. |
| 1173 peer_handler_->GetStats(stats_request); | 1173 peer_handler_->GetStats(stats_request); |
| 1174 | 1174 |
| 1175 resolver->Resolve(); | 1175 resolver->Resolve(); |
| 1176 return promise; | 1176 return promise; |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 ScriptPromise RTCPeerConnection::getStats(ScriptState* script_state) { | 1179 ScriptPromise RTCPeerConnection::getStats(ScriptState* script_state) { |
| 1180 ExecutionContext* context = script_state->GetExecutionContext(); | 1180 ExecutionContext* context = ExecutionContext::From(script_state); |
| 1181 UseCounter::Count(context, UseCounter::kRTCPeerConnectionGetStats); | 1181 UseCounter::Count(context, UseCounter::kRTCPeerConnectionGetStats); |
| 1182 | 1182 |
| 1183 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); | 1183 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); |
| 1184 ScriptPromise promise = resolver->Promise(); | 1184 ScriptPromise promise = resolver->Promise(); |
| 1185 peer_handler_->GetStats(WebRTCStatsReportCallbackResolver::Create(resolver)); | 1185 peer_handler_->GetStats(WebRTCStatsReportCallbackResolver::Create(resolver)); |
| 1186 | 1186 |
| 1187 return promise; | 1187 return promise; |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 HeapVector<Member<RTCRtpReceiver>> RTCPeerConnection::getReceivers() { | 1190 HeapVector<Member<RTCRtpReceiver>> RTCPeerConnection::getReceivers() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1217 const Dictionary& options, | 1217 const Dictionary& options, |
| 1218 ExceptionState& exception_state) { | 1218 ExceptionState& exception_state) { |
| 1219 if (ThrowExceptionIfSignalingStateClosed(signaling_state_, exception_state)) | 1219 if (ThrowExceptionIfSignalingStateClosed(signaling_state_, exception_state)) |
| 1220 return nullptr; | 1220 return nullptr; |
| 1221 | 1221 |
| 1222 WebRTCDataChannelInit init; | 1222 WebRTCDataChannelInit init; |
| 1223 DictionaryHelper::Get(options, "ordered", init.ordered); | 1223 DictionaryHelper::Get(options, "ordered", init.ordered); |
| 1224 DictionaryHelper::Get(options, "negotiated", init.negotiated); | 1224 DictionaryHelper::Get(options, "negotiated", init.negotiated); |
| 1225 | 1225 |
| 1226 unsigned short value = 0; | 1226 unsigned short value = 0; |
| 1227 ExecutionContext* context = script_state->GetExecutionContext(); | 1227 ExecutionContext* context = ExecutionContext::From(script_state); |
| 1228 if (DictionaryHelper::Get(options, "id", value)) | 1228 if (DictionaryHelper::Get(options, "id", value)) |
| 1229 init.id = value; | 1229 init.id = value; |
| 1230 if (DictionaryHelper::Get(options, "maxRetransmits", value)) { | 1230 if (DictionaryHelper::Get(options, "maxRetransmits", value)) { |
| 1231 UseCounter::Count( | 1231 UseCounter::Count( |
| 1232 context, UseCounter::kRTCPeerConnectionCreateDataChannelMaxRetransmits); | 1232 context, UseCounter::kRTCPeerConnectionCreateDataChannelMaxRetransmits); |
| 1233 init.max_retransmits = value; | 1233 init.max_retransmits = value; |
| 1234 } | 1234 } |
| 1235 if (DictionaryHelper::Get(options, "maxRetransmitTime", value)) { | 1235 if (DictionaryHelper::Get(options, "maxRetransmitTime", value)) { |
| 1236 UseCounter::Count( | 1236 UseCounter::Count( |
| 1237 context, | 1237 context, |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 visitor->Trace(local_streams_); | 1566 visitor->Trace(local_streams_); |
| 1567 visitor->Trace(remote_streams_); | 1567 visitor->Trace(remote_streams_); |
| 1568 visitor->Trace(rtp_receivers_); | 1568 visitor->Trace(rtp_receivers_); |
| 1569 visitor->Trace(dispatch_scheduled_event_runner_); | 1569 visitor->Trace(dispatch_scheduled_event_runner_); |
| 1570 visitor->Trace(scheduled_events_); | 1570 visitor->Trace(scheduled_events_); |
| 1571 EventTargetWithInlineData::Trace(visitor); | 1571 EventTargetWithInlineData::Trace(visitor); |
| 1572 SuspendableObject::Trace(visitor); | 1572 SuspendableObject::Trace(visitor); |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 } // namespace blink | 1575 } // namespace blink |
| OLD | NEW |