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 17 matching lines...) Expand all Loading... | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "modules/mediastream/RTCPeerConnection.h" | 31 #include "modules/mediastream/RTCPeerConnection.h" |
32 | 32 |
33 #include "bindings/core/v8/ArrayValue.h" | 33 #include "bindings/core/v8/ArrayValue.h" |
34 #include "bindings/core/v8/ExceptionMessages.h" | 34 #include "bindings/core/v8/ExceptionMessages.h" |
35 #include "bindings/core/v8/ExceptionState.h" | 35 #include "bindings/core/v8/ExceptionState.h" |
36 #include "bindings/core/v8/Nullable.h" | 36 #include "bindings/core/v8/Nullable.h" |
37 #include "bindings/core/v8/ScriptPromiseResolver.h" | 37 #include "bindings/core/v8/ScriptPromiseResolver.h" |
38 #include "bindings/core/v8/ScriptState.h" | |
39 #include "bindings/core/v8/ScriptValue.h" | |
40 #include "bindings/core/v8/V8ThrowException.h" | |
41 #include "bindings/modules/v8/UnionTypesModules.h" | |
38 #include "bindings/modules/v8/V8RTCCertificate.h" | 42 #include "bindings/modules/v8/V8RTCCertificate.h" |
39 #include "core/dom/Document.h" | 43 #include "core/dom/Document.h" |
40 #include "core/dom/ExceptionCode.h" | 44 #include "core/dom/ExceptionCode.h" |
41 #include "core/dom/ExecutionContext.h" | 45 #include "core/dom/ExecutionContext.h" |
46 #include "core/dom/Microtask.h" | |
42 #include "core/frame/LocalFrame.h" | 47 #include "core/frame/LocalFrame.h" |
43 #include "core/frame/UseCounter.h" | 48 #include "core/frame/UseCounter.h" |
44 #include "core/html/VoidCallback.h" | 49 #include "core/html/VoidCallback.h" |
45 #include "core/loader/FrameLoader.h" | 50 #include "core/loader/FrameLoader.h" |
46 #include "core/loader/FrameLoaderClient.h" | 51 #include "core/loader/FrameLoaderClient.h" |
47 #include "modules/crypto/CryptoResultImpl.h" | 52 #include "modules/crypto/CryptoResultImpl.h" |
48 #include "modules/mediastream/MediaConstraintsImpl.h" | 53 #include "modules/mediastream/MediaConstraintsImpl.h" |
49 #include "modules/mediastream/MediaStreamEvent.h" | 54 #include "modules/mediastream/MediaStreamEvent.h" |
50 #include "modules/mediastream/RTCDTMFSender.h" | 55 #include "modules/mediastream/RTCDTMFSender.h" |
51 #include "modules/mediastream/RTCDataChannel.h" | 56 #include "modules/mediastream/RTCDataChannel.h" |
52 #include "modules/mediastream/RTCDataChannelEvent.h" | 57 #include "modules/mediastream/RTCDataChannelEvent.h" |
53 #include "modules/mediastream/RTCErrorCallback.h" | 58 #include "modules/mediastream/RTCErrorCallback.h" |
54 #include "modules/mediastream/RTCIceCandidateEvent.h" | 59 #include "modules/mediastream/RTCIceCandidateEvent.h" |
55 #include "modules/mediastream/RTCSessionDescription.h" | 60 #include "modules/mediastream/RTCSessionDescription.h" |
56 #include "modules/mediastream/RTCSessionDescriptionCallback.h" | 61 #include "modules/mediastream/RTCSessionDescriptionCallback.h" |
62 #include "modules/mediastream/RTCSessionDescriptionInit.h" | |
57 #include "modules/mediastream/RTCSessionDescriptionRequestImpl.h" | 63 #include "modules/mediastream/RTCSessionDescriptionRequestImpl.h" |
58 #include "modules/mediastream/RTCStatsCallback.h" | 64 #include "modules/mediastream/RTCStatsCallback.h" |
59 #include "modules/mediastream/RTCStatsRequestImpl.h" | 65 #include "modules/mediastream/RTCStatsRequestImpl.h" |
60 #include "modules/mediastream/RTCVoidRequestImpl.h" | 66 #include "modules/mediastream/RTCVoidRequestImpl.h" |
67 #include "modules/mediastream/RTCVoidRequestPromiseImpl.h" | |
68 #include "platform/Timer.h" | |
61 #include "platform/mediastream/RTCConfiguration.h" | 69 #include "platform/mediastream/RTCConfiguration.h" |
62 #include "platform/mediastream/RTCOfferOptions.h" | 70 #include "platform/mediastream/RTCOfferOptions.h" |
63 #include "public/platform/Platform.h" | 71 #include "public/platform/Platform.h" |
64 #include "public/platform/WebCryptoAlgorithmParams.h" | 72 #include "public/platform/WebCryptoAlgorithmParams.h" |
65 #include "public/platform/WebCryptoUtil.h" | 73 #include "public/platform/WebCryptoUtil.h" |
66 #include "public/platform/WebMediaStream.h" | 74 #include "public/platform/WebMediaStream.h" |
67 #include "public/platform/WebRTCCertificate.h" | 75 #include "public/platform/WebRTCCertificate.h" |
68 #include "public/platform/WebRTCCertificateGenerator.h" | 76 #include "public/platform/WebRTCCertificateGenerator.h" |
69 #include "public/platform/WebRTCConfiguration.h" | 77 #include "public/platform/WebRTCConfiguration.h" |
70 #include "public/platform/WebRTCDataChannelHandler.h" | 78 #include "public/platform/WebRTCDataChannelHandler.h" |
71 #include "public/platform/WebRTCDataChannelInit.h" | 79 #include "public/platform/WebRTCDataChannelInit.h" |
72 #include "public/platform/WebRTCICECandidate.h" | 80 #include "public/platform/WebRTCICECandidate.h" |
73 #include "public/platform/WebRTCKeyParams.h" | 81 #include "public/platform/WebRTCKeyParams.h" |
74 #include "public/platform/WebRTCOfferOptions.h" | 82 #include "public/platform/WebRTCOfferOptions.h" |
75 #include "public/platform/WebRTCSessionDescription.h" | 83 #include "public/platform/WebRTCSessionDescription.h" |
76 #include "public/platform/WebRTCSessionDescriptionRequest.h" | 84 #include "public/platform/WebRTCSessionDescriptionRequest.h" |
77 #include "public/platform/WebRTCStatsRequest.h" | 85 #include "public/platform/WebRTCStatsRequest.h" |
78 #include "public/platform/WebRTCVoidRequest.h" | 86 #include "public/platform/WebRTCVoidRequest.h" |
79 | 87 |
80 namespace blink { | 88 namespace blink { |
81 | 89 |
82 namespace { | 90 namespace { |
83 | 91 |
84 static bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingSta te state, ExceptionState& exceptionState) | 92 const char kSignalingStateClosedMsg[] = "The RTCPeerConnection's signalingState is 'closed'."; |
93 const char kDefaultErrorName[] = "AbortError"; | |
94 const char kSessionDescriptionErrorName[] = "InvalidSessionDescription"; | |
95 | |
96 bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingState stat e, ExceptionState& exceptionState) | |
85 { | 97 { |
86 if (state == RTCPeerConnection::SignalingStateClosed) { | 98 if (state == RTCPeerConnection::SignalingStateClosed) { |
87 exceptionState.throwDOMException(InvalidStateError, "The RTCPeerConnecti on's signalingState is 'closed'."); | 99 exceptionState.throwDOMException(InvalidStateError, kSignalingStateClose dMsg); |
88 return true; | 100 return true; |
89 } | 101 } |
90 | 102 |
91 return false; | 103 return false; |
92 } | 104 } |
93 | 105 |
106 | |
107 void asyncCallErrorCallback(RTCErrorCallback* errorCallback, const String& error Msg) | |
108 { | |
109 Microtask::enqueueMicrotask(WTF::bind(&RTCErrorCallback::handleEvent, errorC allback, errorMsg)); | |
110 } | |
111 | |
112 bool callErrorCallbackIfSignalingStateClosed(RTCPeerConnection::SignalingState s tate, RTCErrorCallback* errorCallback) | |
113 { | |
114 if (state == RTCPeerConnection::SignalingStateClosed) { | |
115 if (errorCallback) | |
116 asyncCallErrorCallback(errorCallback, kSignalingStateClosedMsg); | |
117 | |
118 return true; | |
119 } | |
120 | |
121 return false; | |
122 } | |
123 | |
124 bool isIceCandidateMissingSdp(const RTCIceCandidateInitOrRTCIceCandidate& candid ate) | |
125 { | |
126 if (candidate.isRTCIceCandidateInit()) { | |
127 const RTCIceCandidateInit& iceCandidateInit = candidate.getAsRTCIceCandi dateInit(); | |
128 return !iceCandidateInit.hasSdpMid() && !iceCandidateInit.hasSdpMLineInd ex(); | |
129 } | |
130 | |
131 ASSERT(candidate.isRTCIceCandidate()); | |
132 return false; | |
133 } | |
134 | |
135 WebRTCICECandidate convertToWebRTCIceCandidate(const RTCIceCandidateInitOrRTCIce Candidate& candidate) | |
136 { | |
137 if (candidate.isRTCIceCandidateInit()) { | |
138 const RTCIceCandidateInit& iceCandidateInit = candidate.getAsRTCIceCandi dateInit(); | |
139 return WebRTCICECandidate(iceCandidateInit.candidate(), iceCandidateInit .sdpMid(), iceCandidateInit.sdpMLineIndex()); | |
140 } | |
141 | |
142 ASSERT(candidate.isRTCIceCandidate()); | |
143 return candidate.getAsRTCIceCandidate()->webCandidate(); | |
144 } | |
145 | |
94 // Helper class for RTCPeerConnection::generateCertificate. | 146 // Helper class for RTCPeerConnection::generateCertificate. |
95 class WebRTCCertificateObserver : public WebCallbacks<WebRTCCertificate*, void> { | 147 class WebRTCCertificateObserver : public WebCallbacks<WebRTCCertificate*, void> { |
96 public: | 148 public: |
97 // The created observer is responsible for deleting itself after onSuccess/o nError. To avoid memory | 149 // The created observer is responsible for deleting itself after onSuccess/o nError. To avoid memory |
98 // leak the observer should therefore be used in a WebRTCCertificateGenerato r::generateCertificate call | 150 // leak the observer should therefore be used in a WebRTCCertificateGenerato r::generateCertificate call |
99 // which is ensured to invoke one of these. Takes ownership of |resolver|. | 151 // which is ensured to invoke one of these. Takes ownership of |resolver|. |
100 static WebRTCCertificateObserver* create(ScriptPromiseResolver* resolver) | 152 static WebRTCCertificateObserver* create(ScriptPromiseResolver* resolver) |
101 { | 153 { |
102 return new WebRTCCertificateObserver(resolver); | 154 return new WebRTCCertificateObserver(resolver); |
103 } | 155 } |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi aConstraints, mediaErrorState); | 505 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi aConstraints, mediaErrorState); |
454 if (mediaErrorState.hadException()) { | 506 if (mediaErrorState.hadException()) { |
455 mediaErrorState.raiseException(exceptionState); | 507 mediaErrorState.raiseException(exceptionState); |
456 return; | 508 return; |
457 } | 509 } |
458 | 510 |
459 RTCSessionDescriptionRequest* request = RTCSessionDescriptionRequestImpl::cr eate(executionContext(), this, successCallback, errorCallback); | 511 RTCSessionDescriptionRequest* request = RTCSessionDescriptionRequestImpl::cr eate(executionContext(), this, successCallback, errorCallback); |
460 m_peerHandler->createAnswer(request, constraints); | 512 m_peerHandler->createAnswer(request, constraints); |
461 } | 513 } |
462 | 514 |
463 void RTCPeerConnection::setLocalDescription(ExecutionContext* context, RTCSessio nDescription* sessionDescription, VoidCallback* successCallback, RTCErrorCallbac k* errorCallback, ExceptionState& exceptionState) | 515 ScriptPromise RTCPeerConnection::setLocalDescription(ScriptState* scriptState, c onst RTCSessionDescriptionInit& sessionDescriptionInit) |
464 { | 516 { |
517 if (m_signalingState == SignalingStateClosed) | |
518 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, kSignalingStateClosedMsg)); | |
519 | |
520 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; | |
521 ScriptPromise promise = resolver->promise(); | |
522 RTCVoidRequest* request = RTCVoidRequestPromiseImpl::create(this, resolver, kSessionDescriptionErrorName); | |
523 m_peerHandler->setLocalDescription(request, WebRTCSessionDescription(session DescriptionInit.type(), sessionDescriptionInit.sdp())); | |
524 return promise; | |
525 } | |
526 | |
527 ScriptPromise RTCPeerConnection::setLocalDescription(ScriptState* scriptState, R TCSessionDescription* sessionDescription, VoidCallback* successCallback, RTCErro rCallback* errorCallback) | |
528 { | |
529 ExecutionContext* context = scriptState->executionContext(); | |
465 if (successCallback && errorCallback) { | 530 if (successCallback && errorCallback) { |
466 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDescript ionLegacyCompliant); | 531 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDescript ionLegacyCompliant); |
467 } else { | 532 } else { |
468 if (!successCallback) | 533 if (!successCallback) |
469 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDesc riptionLegacyNoSuccessCallback); | 534 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDesc riptionLegacyNoSuccessCallback); |
470 if (!errorCallback) | 535 if (!errorCallback) |
471 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDesc riptionLegacyNoFailureCallback); | 536 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDesc riptionLegacyNoFailureCallback); |
472 } | 537 } |
473 | 538 |
474 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 539 if (callErrorCallbackIfSignalingStateClosed(m_signalingState, errorCallback) ) |
475 return; | 540 return ScriptPromise::cast(scriptState, ScriptValue()); |
yhirano
2016/02/11 01:58:17
ScriptPromise::cast(scriptState, v8::Undefined(scr
Guido Urdaneta
2016/02/11 10:47:08
Done.
| |
476 | 541 |
477 ASSERT(sessionDescription); | 542 ASSERT(sessionDescription); |
478 | 543 |
479 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback); | 544 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback); |
480 m_peerHandler->setLocalDescription(request, sessionDescription->webSessionDe scription()); | 545 m_peerHandler->setLocalDescription(request, sessionDescription->webSessionDe scription()); |
546 return ScriptPromise::cast(scriptState, ScriptValue()); | |
481 } | 547 } |
482 | 548 |
483 RTCSessionDescription* RTCPeerConnection::localDescription() | 549 RTCSessionDescription* RTCPeerConnection::localDescription() |
484 { | 550 { |
485 WebRTCSessionDescription webSessionDescription = m_peerHandler->localDescrip tion(); | 551 WebRTCSessionDescription webSessionDescription = m_peerHandler->localDescrip tion(); |
486 if (webSessionDescription.isNull()) | 552 if (webSessionDescription.isNull()) |
487 return nullptr; | 553 return nullptr; |
488 | 554 |
489 return RTCSessionDescription::create(webSessionDescription); | 555 return RTCSessionDescription::create(webSessionDescription); |
490 } | 556 } |
491 | 557 |
492 void RTCPeerConnection::setRemoteDescription(ExecutionContext* context, RTCSessi onDescription* sessionDescription, VoidCallback* successCallback, RTCErrorCallba ck* errorCallback, ExceptionState& exceptionState) | 558 ScriptPromise RTCPeerConnection::setRemoteDescription(ScriptState* scriptState, const RTCSessionDescriptionInit& sessionDescriptionInit) |
493 { | 559 { |
560 if (m_signalingState == SignalingStateClosed) | |
561 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, kSignalingStateClosedMsg)); | |
562 | |
563 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; | |
564 ScriptPromise promise = resolver->promise(); | |
565 RTCVoidRequest* request = RTCVoidRequestPromiseImpl::create(this, resolver, kSessionDescriptionErrorName); | |
566 m_peerHandler->setRemoteDescription(request, WebRTCSessionDescription(sessio nDescriptionInit.type(), sessionDescriptionInit.sdp())); | |
567 return promise; | |
568 } | |
569 | |
570 ScriptPromise RTCPeerConnection::setRemoteDescription(ScriptState* scriptState, RTCSessionDescription* sessionDescription, VoidCallback* successCallback, RTCErr orCallback* errorCallback) | |
571 { | |
572 ExecutionContext* context = scriptState->executionContext(); | |
494 if (successCallback && errorCallback) { | 573 if (successCallback && errorCallback) { |
495 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDescrip tionLegacyCompliant); | 574 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDescrip tionLegacyCompliant); |
496 } else { | 575 } else { |
497 if (!successCallback) | 576 if (!successCallback) |
498 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDes criptionLegacyNoSuccessCallback); | 577 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDes criptionLegacyNoSuccessCallback); |
499 if (!errorCallback) | 578 if (!errorCallback) |
500 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDes criptionLegacyNoFailureCallback); | 579 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDes criptionLegacyNoFailureCallback); |
501 } | 580 } |
502 | 581 |
503 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 582 if (callErrorCallbackIfSignalingStateClosed(m_signalingState, errorCallback) ) |
504 return; | 583 return ScriptPromise::cast(scriptState, ScriptValue()); |
505 | 584 |
506 ASSERT(sessionDescription); | 585 ASSERT(sessionDescription); |
507 | 586 |
508 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback); | 587 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback); |
509 m_peerHandler->setRemoteDescription(request, sessionDescription->webSessionD escription()); | 588 m_peerHandler->setRemoteDescription(request, sessionDescription->webSessionD escription()); |
589 return ScriptPromise::cast(scriptState, ScriptValue()); | |
510 } | 590 } |
511 | 591 |
512 RTCSessionDescription* RTCPeerConnection::remoteDescription() | 592 RTCSessionDescription* RTCPeerConnection::remoteDescription() |
513 { | 593 { |
514 WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescri ption(); | 594 WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescri ption(); |
515 if (webSessionDescription.isNull()) | 595 if (webSessionDescription.isNull()) |
516 return nullptr; | 596 return nullptr; |
517 | 597 |
518 return RTCSessionDescription::create(webSessionDescription); | 598 return RTCSessionDescription::create(webSessionDescription); |
519 } | 599 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 // The observer will manage its own destruction as well as the resolver's de struction. | 681 // The observer will manage its own destruction as well as the resolver's de struction. |
602 certificateGenerator->generateCertificate( | 682 certificateGenerator->generateCertificate( |
603 keyParams.get(), | 683 keyParams.get(), |
604 toDocument(scriptState->executionContext())->url(), | 684 toDocument(scriptState->executionContext())->url(), |
605 toDocument(scriptState->executionContext())->firstPartyForCookies(), | 685 toDocument(scriptState->executionContext())->firstPartyForCookies(), |
606 certificateObserver); | 686 certificateObserver); |
607 | 687 |
608 return promise; | 688 return promise; |
609 } | 689 } |
610 | 690 |
611 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, Exception State& exceptionState) | 691 ScriptPromise RTCPeerConnection::addIceCandidate(ScriptState* scriptState, const RTCIceCandidateInitOrRTCIceCandidate& candidate) |
612 { | 692 { |
613 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 693 if (m_signalingState == SignalingStateClosed) |
614 return; | 694 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, kSignalingStateClosedMsg)); |
615 | 695 |
616 ASSERT(iceCandidate); | 696 if (isIceCandidateMissingSdp(candidate)) |
697 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(scriptState->isolate(), "Candidate missing values for both sdpMid and sdpMLi neIndex")); | |
617 | 698 |
618 bool valid = m_peerHandler->addICECandidate(iceCandidate->webCandidate()); | 699 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; |
619 if (!valid) | 700 ScriptPromise promise = resolver->promise(); |
620 exceptionState.throwDOMException(SyntaxError, "The ICE candidate could n ot be added."); | 701 RTCVoidRequest* request = RTCVoidRequestPromiseImpl::create(this, resolver, kDefaultErrorName); |
702 WebRTCICECandidate webCandidate = convertToWebRTCIceCandidate(candidate); | |
703 bool implemented = m_peerHandler->addICECandidate(request, webCandidate); | |
704 // TODO(guidou): replace NotSupportedError when error handling in the spec i s finalized. crbug.com/585621 | |
705 if (!implemented) | |
706 resolver->reject(DOMException::create(NotSupportedError, "This method is not yet implemented.")); | |
707 | |
708 return promise; | |
621 } | 709 } |
622 | 710 |
623 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, VoidCallb ack* successCallback, RTCErrorCallback* errorCallback, ExceptionState& exception State) | 711 ScriptPromise RTCPeerConnection::addIceCandidate(ScriptState* scriptState, RTCIc eCandidate* iceCandidate, VoidCallback* successCallback, RTCErrorCallback* error Callback) |
624 { | 712 { |
625 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | |
626 return; | |
627 | |
628 ASSERT(iceCandidate); | 713 ASSERT(iceCandidate); |
629 ASSERT(successCallback); | 714 ASSERT(successCallback); |
630 ASSERT(errorCallback); | 715 ASSERT(errorCallback); |
631 | 716 |
717 if (callErrorCallbackIfSignalingStateClosed(m_signalingState, errorCallback) ) | |
718 return ScriptPromise::cast(scriptState, ScriptValue()); | |
719 | |
632 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback); | 720 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback); |
721 bool implemented = m_peerHandler->addICECandidate(request, iceCandidate->web Candidate()); | |
722 if (!implemented) | |
723 asyncCallErrorCallback(errorCallback, "This method is not yet implemente d."); | |
633 | 724 |
634 bool implemented = m_peerHandler->addICECandidate(request, iceCandidate->web Candidate()); | 725 return ScriptPromise::cast(scriptState, ScriptValue()); |
635 if (!implemented) { | |
636 exceptionState.throwDOMException(NotSupportedError, "This method is not yet implemented."); | |
637 } | |
638 } | 726 } |
639 | 727 |
640 String RTCPeerConnection::signalingState() const | 728 String RTCPeerConnection::signalingState() const |
641 { | 729 { |
642 switch (m_signalingState) { | 730 switch (m_signalingState) { |
643 case SignalingStateStable: | 731 case SignalingStateStable: |
644 return "stable"; | 732 return "stable"; |
645 case SignalingStateHaveLocalOffer: | 733 case SignalingStateHaveLocalOffer: |
646 return "have-local-offer"; | 734 return "have-local-offer"; |
647 case SignalingStateHaveRemoteOffer: | 735 case SignalingStateHaveRemoteOffer: |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1049 { | 1137 { |
1050 visitor->trace(m_localStreams); | 1138 visitor->trace(m_localStreams); |
1051 visitor->trace(m_remoteStreams); | 1139 visitor->trace(m_remoteStreams); |
1052 visitor->trace(m_dispatchScheduledEventRunner); | 1140 visitor->trace(m_dispatchScheduledEventRunner); |
1053 visitor->trace(m_scheduledEvents); | 1141 visitor->trace(m_scheduledEvents); |
1054 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac e(visitor); | 1142 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac e(visitor); |
1055 ActiveDOMObject::trace(visitor); | 1143 ActiveDOMObject::trace(visitor); |
1056 } | 1144 } |
1057 | 1145 |
1058 } // namespace blink | 1146 } // namespace blink |
OLD | NEW |