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