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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 #include "platform/peerconnection/RTCOfferOptionsPlatform.h" | 79 #include "platform/peerconnection/RTCOfferOptionsPlatform.h" |
80 #include "public/platform/Platform.h" | 80 #include "public/platform/Platform.h" |
81 #include "public/platform/WebCryptoAlgorithmParams.h" | 81 #include "public/platform/WebCryptoAlgorithmParams.h" |
82 #include "public/platform/WebMediaStream.h" | 82 #include "public/platform/WebMediaStream.h" |
83 #include "public/platform/WebRTCAnswerOptions.h" | 83 #include "public/platform/WebRTCAnswerOptions.h" |
84 #include "public/platform/WebRTCCertificate.h" | 84 #include "public/platform/WebRTCCertificate.h" |
85 #include "public/platform/WebRTCCertificateGenerator.h" | 85 #include "public/platform/WebRTCCertificateGenerator.h" |
86 #include "public/platform/WebRTCConfiguration.h" | 86 #include "public/platform/WebRTCConfiguration.h" |
87 #include "public/platform/WebRTCDataChannelHandler.h" | 87 #include "public/platform/WebRTCDataChannelHandler.h" |
88 #include "public/platform/WebRTCDataChannelInit.h" | 88 #include "public/platform/WebRTCDataChannelInit.h" |
| 89 #include "public/platform/WebRTCError.h" |
89 #include "public/platform/WebRTCICECandidate.h" | 90 #include "public/platform/WebRTCICECandidate.h" |
90 #include "public/platform/WebRTCKeyParams.h" | 91 #include "public/platform/WebRTCKeyParams.h" |
91 #include "public/platform/WebRTCOfferOptions.h" | 92 #include "public/platform/WebRTCOfferOptions.h" |
92 #include "public/platform/WebRTCSessionDescription.h" | 93 #include "public/platform/WebRTCSessionDescription.h" |
93 #include "public/platform/WebRTCSessionDescriptionRequest.h" | 94 #include "public/platform/WebRTCSessionDescriptionRequest.h" |
94 #include "public/platform/WebRTCStatsRequest.h" | 95 #include "public/platform/WebRTCStatsRequest.h" |
95 #include "public/platform/WebRTCVoidRequest.h" | 96 #include "public/platform/WebRTCVoidRequest.h" |
96 #include "wtf/CurrentTime.h" | 97 #include "wtf/CurrentTime.h" |
97 #include "wtf/PtrUtil.h" | 98 #include "wtf/PtrUtil.h" |
98 #include <algorithm> | 99 #include <algorithm> |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 | 783 |
783 RTCSessionDescription* RTCPeerConnection::remoteDescription() { | 784 RTCSessionDescription* RTCPeerConnection::remoteDescription() { |
784 WebRTCSessionDescription webSessionDescription = | 785 WebRTCSessionDescription webSessionDescription = |
785 m_peerHandler->remoteDescription(); | 786 m_peerHandler->remoteDescription(); |
786 if (webSessionDescription.isNull()) | 787 if (webSessionDescription.isNull()) |
787 return nullptr; | 788 return nullptr; |
788 | 789 |
789 return RTCSessionDescription::create(webSessionDescription); | 790 return RTCSessionDescription::create(webSessionDescription); |
790 } | 791 } |
791 | 792 |
792 void RTCPeerConnection::updateIce(ExecutionContext* context, | 793 void RTCPeerConnection::setConfiguration( |
793 const RTCConfiguration& rtcConfiguration, | 794 ExecutionContext* context, |
794 const Dictionary&, | 795 const RTCConfiguration& rtcConfiguration, |
795 ExceptionState& exceptionState) { | 796 ExceptionState& exceptionState) { |
796 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 797 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
797 return; | 798 return; |
798 | 799 |
799 WebRTCConfiguration configuration = | 800 WebRTCConfiguration configuration = |
800 parseConfiguration(context, rtcConfiguration, exceptionState); | 801 parseConfiguration(context, rtcConfiguration, exceptionState); |
801 | 802 |
802 if (exceptionState.hadException()) | 803 if (exceptionState.hadException()) |
803 return; | 804 return; |
804 | 805 |
805 MediaErrorState mediaErrorState; | 806 MediaErrorState mediaErrorState; |
806 if (mediaErrorState.hadException()) { | 807 if (mediaErrorState.hadException()) { |
807 mediaErrorState.raiseException(exceptionState); | 808 mediaErrorState.raiseException(exceptionState); |
808 return; | 809 return; |
809 } | 810 } |
810 | 811 |
811 // TODO(deadbeef): When this changes to setConfiguration, call | 812 WebRTCErrorType error = m_peerHandler->setConfiguration(configuration); |
812 // m_peerHandler->setConfiguration. | 813 if (error != WebRTCErrorType::kNone) { |
813 exceptionState.throwDOMException( | 814 // All errors besides InvalidModification should have been detected above. |
814 SyntaxError, | 815 if (error == WebRTCErrorType::kInvalidModification) { |
815 "Could not update the ICE Agent with the given configuration."); | 816 exceptionState.throwDOMException( |
| 817 InvalidModificationError, |
| 818 "Attempted to modify the PeerConnection's " |
| 819 "configuration in an unsupported way."); |
| 820 } else { |
| 821 exceptionState.throwDOMException( |
| 822 OperationError, |
| 823 "Could not update the PeerConnection with the given configuration."); |
| 824 } |
| 825 } |
816 } | 826 } |
817 | 827 |
818 ScriptPromise RTCPeerConnection::generateCertificate( | 828 ScriptPromise RTCPeerConnection::generateCertificate( |
819 ScriptState* scriptState, | 829 ScriptState* scriptState, |
820 const AlgorithmIdentifier& keygenAlgorithm, | 830 const AlgorithmIdentifier& keygenAlgorithm, |
821 ExceptionState& exceptionState) { | 831 ExceptionState& exceptionState) { |
822 // Normalize |keygenAlgorithm| with WebCrypto, making sure it is a recognized | 832 // Normalize |keygenAlgorithm| with WebCrypto, making sure it is a recognized |
823 // AlgorithmIdentifier. | 833 // AlgorithmIdentifier. |
824 WebCryptoAlgorithm cryptoAlgorithm; | 834 WebCryptoAlgorithm cryptoAlgorithm; |
825 AlgorithmError error; | 835 AlgorithmError error; |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 DEFINE_TRACE(RTCPeerConnection) { | 1482 DEFINE_TRACE(RTCPeerConnection) { |
1473 visitor->trace(m_localStreams); | 1483 visitor->trace(m_localStreams); |
1474 visitor->trace(m_remoteStreams); | 1484 visitor->trace(m_remoteStreams); |
1475 visitor->trace(m_dispatchScheduledEventRunner); | 1485 visitor->trace(m_dispatchScheduledEventRunner); |
1476 visitor->trace(m_scheduledEvents); | 1486 visitor->trace(m_scheduledEvents); |
1477 EventTargetWithInlineData::trace(visitor); | 1487 EventTargetWithInlineData::trace(visitor); |
1478 SuspendableObject::trace(visitor); | 1488 SuspendableObject::trace(visitor); |
1479 } | 1489 } |
1480 | 1490 |
1481 } // namespace blink | 1491 } // namespace blink |
OLD | NEW |