Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp

Issue 1661493002: Add promise-based addIceCandidate, setLocalDescription and setRemoteDescription to RTCPeerConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace "TBD" with "InternalError" Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/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"
42 #include "core/frame/LocalFrame.h" 44 #include "core/frame/LocalFrame.h"
43 #include "core/frame/UseCounter.h" 45 #include "core/frame/UseCounter.h"
44 #include "core/html/VoidCallback.h" 46 #include "core/html/VoidCallback.h"
45 #include "core/loader/FrameLoader.h" 47 #include "core/loader/FrameLoader.h"
46 #include "core/loader/FrameLoaderClient.h" 48 #include "core/loader/FrameLoaderClient.h"
47 #include "modules/crypto/CryptoResultImpl.h" 49 #include "modules/crypto/CryptoResultImpl.h"
48 #include "modules/mediastream/MediaConstraintsImpl.h" 50 #include "modules/mediastream/MediaConstraintsImpl.h"
49 #include "modules/mediastream/MediaStreamEvent.h" 51 #include "modules/mediastream/MediaStreamEvent.h"
50 #include "modules/mediastream/RTCDTMFSender.h" 52 #include "modules/mediastream/RTCDTMFSender.h"
51 #include "modules/mediastream/RTCDataChannel.h" 53 #include "modules/mediastream/RTCDataChannel.h"
52 #include "modules/mediastream/RTCDataChannelEvent.h" 54 #include "modules/mediastream/RTCDataChannelEvent.h"
53 #include "modules/mediastream/RTCErrorCallback.h" 55 #include "modules/mediastream/RTCErrorCallback.h"
54 #include "modules/mediastream/RTCIceCandidateEvent.h" 56 #include "modules/mediastream/RTCIceCandidateEvent.h"
55 #include "modules/mediastream/RTCSessionDescription.h" 57 #include "modules/mediastream/RTCSessionDescription.h"
56 #include "modules/mediastream/RTCSessionDescriptionCallback.h" 58 #include "modules/mediastream/RTCSessionDescriptionCallback.h"
59 #include "modules/mediastream/RTCSessionDescriptionInit.h"
57 #include "modules/mediastream/RTCSessionDescriptionRequestImpl.h" 60 #include "modules/mediastream/RTCSessionDescriptionRequestImpl.h"
58 #include "modules/mediastream/RTCStatsCallback.h" 61 #include "modules/mediastream/RTCStatsCallback.h"
59 #include "modules/mediastream/RTCStatsRequestImpl.h" 62 #include "modules/mediastream/RTCStatsRequestImpl.h"
60 #include "modules/mediastream/RTCVoidRequestImpl.h" 63 #include "modules/mediastream/RTCVoidRequestImpl.h"
64 #include "modules/mediastream/RTCVoidRequestPromiseImpl.h"
61 #include "platform/mediastream/RTCConfiguration.h" 65 #include "platform/mediastream/RTCConfiguration.h"
62 #include "platform/mediastream/RTCOfferOptions.h" 66 #include "platform/mediastream/RTCOfferOptions.h"
63 #include "public/platform/Platform.h" 67 #include "public/platform/Platform.h"
64 #include "public/platform/WebCryptoAlgorithmParams.h" 68 #include "public/platform/WebCryptoAlgorithmParams.h"
65 #include "public/platform/WebCryptoUtil.h" 69 #include "public/platform/WebCryptoUtil.h"
66 #include "public/platform/WebMediaStream.h" 70 #include "public/platform/WebMediaStream.h"
67 #include "public/platform/WebRTCCertificate.h" 71 #include "public/platform/WebRTCCertificate.h"
68 #include "public/platform/WebRTCCertificateGenerator.h" 72 #include "public/platform/WebRTCCertificateGenerator.h"
69 #include "public/platform/WebRTCConfiguration.h" 73 #include "public/platform/WebRTCConfiguration.h"
70 #include "public/platform/WebRTCDataChannelHandler.h" 74 #include "public/platform/WebRTCDataChannelHandler.h"
71 #include "public/platform/WebRTCDataChannelInit.h" 75 #include "public/platform/WebRTCDataChannelInit.h"
72 #include "public/platform/WebRTCICECandidate.h" 76 #include "public/platform/WebRTCICECandidate.h"
73 #include "public/platform/WebRTCKeyParams.h" 77 #include "public/platform/WebRTCKeyParams.h"
74 #include "public/platform/WebRTCOfferOptions.h" 78 #include "public/platform/WebRTCOfferOptions.h"
75 #include "public/platform/WebRTCSessionDescription.h" 79 #include "public/platform/WebRTCSessionDescription.h"
76 #include "public/platform/WebRTCSessionDescriptionRequest.h" 80 #include "public/platform/WebRTCSessionDescriptionRequest.h"
77 #include "public/platform/WebRTCStatsRequest.h" 81 #include "public/platform/WebRTCStatsRequest.h"
78 #include "public/platform/WebRTCVoidRequest.h" 82 #include "public/platform/WebRTCVoidRequest.h"
79 83
80 namespace blink { 84 namespace blink {
81 85
82 namespace { 86 namespace {
83 87
88 const char kSignalingStateClosedMsg[] = "The RTCPeerConnection's signalingState is 'closed'.";
89 const char kDefaultErrorName[] = "InternalError";
philipj_slow 2016/02/09 12:02:03 I see "Ask the DOM team to extend their list with
Guido Urdaneta 2016/02/09 16:51:01 The spec says to use DOMError with error name TBD.
philipj_slow 2016/02/09 18:59:17 Is there a WebIDL issue filed for adding any of th
Guido Urdaneta 2016/02/10 07:05:13 Done. Using DOMException("AbortError") until the w
90 const char kSessionDescriptionErrorName[] = "InvalidSessionDescription";
91
84 static bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingSta te state, ExceptionState& exceptionState) 92 static bool throwExceptionIfSignalingStateClosed(RTCPeerConnection::SignalingSta te state, ExceptionState& exceptionState)
85 { 93 {
86 if (state == RTCPeerConnection::SignalingStateClosed) { 94 if (state == RTCPeerConnection::SignalingStateClosed) {
87 exceptionState.throwDOMException(InvalidStateError, "The RTCPeerConnecti on's signalingState is 'closed'."); 95 exceptionState.throwDOMException(InvalidStateError, kSignalingStateClose dMsg);
88 return true; 96 return true;
89 } 97 }
90 98
91 return false; 99 return false;
92 } 100 }
93 101
102 static bool callErrorCallbackIfSignalingStateClosed(RTCPeerConnection::Signaling State state, RTCErrorCallback* errorCallback)
philipj_slow 2016/02/09 12:02:03 I think you don't need static inside this anonymou
Guido Urdaneta 2016/02/09 16:51:01 Done.
103 {
104 if (state == RTCPeerConnection::SignalingStateClosed) {
105 if (errorCallback)
106 errorCallback->handleEvent(kSignalingStateClosedMsg);
107 return true;
108 }
109
110 return false;
111 }
112
113
philipj_slow 2016/02/09 12:02:03 extra newline
Guido Urdaneta 2016/02/09 16:51:01 Done.
114 bool isIceCandidateMissingSdp(const RTCIceCandidateInitOrRTCIceCandidate& candid ate)
115 {
116 if (candidate.isRTCIceCandidateInit()) {
117 const RTCIceCandidateInit& iceCandidateInit = candidate.getAsRTCIceCandi dateInit();
118 return !iceCandidateInit.hasSdpMid() && !iceCandidateInit.hasSdpMLineInd ex();
119 }
120
121 ASSERT(candidate.isRTCIceCandidate());
122 return false;
123 }
124
125 WebRTCICECandidate ConvertToWebRTCIceCandidate(const RTCIceCandidateInitOrRTCIce Candidate& candidate)
philipj_slow 2016/02/09 12:02:03 Lower-case convertTo
Guido Urdaneta 2016/02/09 16:51:01 Done.
126 {
127 if (candidate.isRTCIceCandidateInit()) {
128 const RTCIceCandidateInit& iceCandidateInit = candidate.getAsRTCIceCandi dateInit();
129 return WebRTCICECandidate(iceCandidateInit.candidate(), iceCandidateInit .sdpMid(), iceCandidateInit.sdpMLineIndex());
130 }
131
132 ASSERT(candidate.isRTCIceCandidate());
133 return candidate.getAsRTCIceCandidate()->webCandidate();
134 }
135
94 // Helper class for RTCPeerConnection::generateCertificate. 136 // Helper class for RTCPeerConnection::generateCertificate.
95 class WebRTCCertificateObserver : public WebCallbacks<WebRTCCertificate*, void> { 137 class WebRTCCertificateObserver : public WebCallbacks<WebRTCCertificate*, void> {
96 public: 138 public:
97 // The created observer is responsible for deleting itself after onSuccess/o nError. To avoid memory 139 // 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 140 // 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|. 141 // which is ensured to invoke one of these. Takes ownership of |resolver|.
100 static WebRTCCertificateObserver* create(ScriptPromiseResolver* resolver) 142 static WebRTCCertificateObserver* create(ScriptPromiseResolver* resolver)
101 { 143 {
102 return new WebRTCCertificateObserver(resolver); 144 return new WebRTCCertificateObserver(resolver);
103 } 145 }
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi aConstraints, mediaErrorState); 495 WebMediaConstraints constraints = MediaConstraintsImpl::create(context, medi aConstraints, mediaErrorState);
454 if (mediaErrorState.hadException()) { 496 if (mediaErrorState.hadException()) {
455 mediaErrorState.raiseException(exceptionState); 497 mediaErrorState.raiseException(exceptionState);
456 return; 498 return;
457 } 499 }
458 500
459 RTCSessionDescriptionRequest* request = RTCSessionDescriptionRequestImpl::cr eate(executionContext(), this, successCallback, errorCallback); 501 RTCSessionDescriptionRequest* request = RTCSessionDescriptionRequestImpl::cr eate(executionContext(), this, successCallback, errorCallback);
460 m_peerHandler->createAnswer(request, constraints); 502 m_peerHandler->createAnswer(request, constraints);
461 } 503 }
462 504
463 void RTCPeerConnection::setLocalDescription(ExecutionContext* context, RTCSessio nDescription* sessionDescription, VoidCallback* successCallback, RTCErrorCallbac k* errorCallback, ExceptionState& exceptionState) 505 ScriptPromise RTCPeerConnection::setLocalDescription(ScriptState* scriptState, c onst RTCSessionDescriptionInit& sessionDescriptionInit)
506 {
507 if (m_signalingState == SignalingStateClosed)
508 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, kSignalingStateClosedMsg));
509
510 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
511 ScriptPromise promise = resolver->promise();
512 RTCVoidRequest* request = RTCVoidRequestPromiseImpl::create(this, resolver, kSessionDescriptionErrorName);
513 m_peerHandler->setLocalDescription(request, WebRTCSessionDescription(session DescriptionInit.type(), sessionDescriptionInit.sdp()));
514 return promise;
515 }
516
517 ScriptPromise RTCPeerConnection::setLocalDescription(ExecutionContext* context, RTCSessionDescription* sessionDescription, VoidCallback* successCallback, RTCErr orCallback* errorCallback)
464 { 518 {
465 if (successCallback && errorCallback) { 519 if (successCallback && errorCallback) {
466 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDescript ionLegacyCompliant); 520 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDescript ionLegacyCompliant);
467 } else { 521 } else {
468 if (!successCallback) 522 if (!successCallback)
469 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDesc riptionLegacyNoSuccessCallback); 523 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDesc riptionLegacyNoSuccessCallback);
470 if (!errorCallback) 524 if (!errorCallback)
471 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDesc riptionLegacyNoFailureCallback); 525 UseCounter::count(context, UseCounter::RTCPeerConnectionSetLocalDesc riptionLegacyNoFailureCallback);
472 } 526 }
473 527
474 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 528 if (callErrorCallbackIfSignalingStateClosed(m_signalingState, errorCallback) )
philipj_slow 2016/02/09 12:02:03 This can synchronously invoke the error callback i
Guido Urdaneta 2016/02/09 16:51:01 Now calling the error callback asynchronously.
philipj_slow 2016/02/09 18:59:17 Thanks, see new comments for more timing fun :)
475 return; 529 return ScriptPromise();
476 530
477 ASSERT(sessionDescription); 531 ASSERT(sessionDescription);
478 532
479 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback); 533 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback);
480 m_peerHandler->setLocalDescription(request, sessionDescription->webSessionDe scription()); 534 m_peerHandler->setLocalDescription(request, sessionDescription->webSessionDe scription());
535 return ScriptPromise();
481 } 536 }
482 537
483 RTCSessionDescription* RTCPeerConnection::localDescription() 538 RTCSessionDescription* RTCPeerConnection::localDescription()
484 { 539 {
485 WebRTCSessionDescription webSessionDescription = m_peerHandler->localDescrip tion(); 540 WebRTCSessionDescription webSessionDescription = m_peerHandler->localDescrip tion();
486 if (webSessionDescription.isNull()) 541 if (webSessionDescription.isNull())
487 return nullptr; 542 return nullptr;
488 543
489 return RTCSessionDescription::create(webSessionDescription); 544 return RTCSessionDescription::create(webSessionDescription);
490 } 545 }
491 546
492 void RTCPeerConnection::setRemoteDescription(ExecutionContext* context, RTCSessi onDescription* sessionDescription, VoidCallback* successCallback, RTCErrorCallba ck* errorCallback, ExceptionState& exceptionState) 547 ScriptPromise RTCPeerConnection::setRemoteDescription(ScriptState* scriptState, const RTCSessionDescriptionInit& sessionDescriptionInit)
548 {
549 if (m_signalingState == SignalingStateClosed)
550 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, kSignalingStateClosedMsg));
551
552 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
553 ScriptPromise promise = resolver->promise();
554 RTCVoidRequest* request = RTCVoidRequestPromiseImpl::create(this, resolver, kSessionDescriptionErrorName);
555 m_peerHandler->setRemoteDescription(request, WebRTCSessionDescription(sessio nDescriptionInit.type(), sessionDescriptionInit.sdp()));
556 return promise;
557 }
558
559 ScriptPromise RTCPeerConnection::setRemoteDescription(ExecutionContext* context, RTCSessionDescription* sessionDescription, VoidCallback* successCallback, RTCEr rorCallback* errorCallback)
493 { 560 {
494 if (successCallback && errorCallback) { 561 if (successCallback && errorCallback) {
495 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDescrip tionLegacyCompliant); 562 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDescrip tionLegacyCompliant);
496 } else { 563 } else {
497 if (!successCallback) 564 if (!successCallback)
498 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDes criptionLegacyNoSuccessCallback); 565 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDes criptionLegacyNoSuccessCallback);
499 if (!errorCallback) 566 if (!errorCallback)
500 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDes criptionLegacyNoFailureCallback); 567 UseCounter::count(context, UseCounter::RTCPeerConnectionSetRemoteDes criptionLegacyNoFailureCallback);
501 } 568 }
502 569
503 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 570 if (callErrorCallbackIfSignalingStateClosed(m_signalingState, errorCallback) )
504 return; 571 return ScriptPromise();
505 572
506 ASSERT(sessionDescription); 573 ASSERT(sessionDescription);
507 574
508 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback); 575 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback);
509 m_peerHandler->setRemoteDescription(request, sessionDescription->webSessionD escription()); 576 m_peerHandler->setRemoteDescription(request, sessionDescription->webSessionD escription());
577 return ScriptPromise();
510 } 578 }
511 579
512 RTCSessionDescription* RTCPeerConnection::remoteDescription() 580 RTCSessionDescription* RTCPeerConnection::remoteDescription()
513 { 581 {
514 WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescri ption(); 582 WebRTCSessionDescription webSessionDescription = m_peerHandler->remoteDescri ption();
515 if (webSessionDescription.isNull()) 583 if (webSessionDescription.isNull())
516 return nullptr; 584 return nullptr;
517 585
518 return RTCSessionDescription::create(webSessionDescription); 586 return RTCSessionDescription::create(webSessionDescription);
519 } 587 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 // The observer will manage its own destruction as well as the resolver's de struction. 669 // The observer will manage its own destruction as well as the resolver's de struction.
602 certificateGenerator->generateCertificate( 670 certificateGenerator->generateCertificate(
603 keyParams.get(), 671 keyParams.get(),
604 toDocument(scriptState->executionContext())->url(), 672 toDocument(scriptState->executionContext())->url(),
605 toDocument(scriptState->executionContext())->firstPartyForCookies(), 673 toDocument(scriptState->executionContext())->firstPartyForCookies(),
606 certificateObserver); 674 certificateObserver);
607 675
608 return promise; 676 return promise;
609 } 677 }
610 678
611 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, Exception State& exceptionState) 679 ScriptPromise RTCPeerConnection::addIceCandidate(ScriptState* scriptState, const RTCIceCandidateInitOrRTCIceCandidate& candidate)
612 { 680 {
613 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 681 if (m_signalingState == SignalingStateClosed)
614 return; 682 return ScriptPromise::rejectWithDOMException(scriptState, DOMException:: create(InvalidStateError, kSignalingStateClosedMsg));
615 683
616 ASSERT(iceCandidate); 684 if (isIceCandidateMissingSdp(candidate))
685 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(scriptState->isolate(), "Candidate missing values for both sdpMid and sdpMLi neIndex"));
617 686
618 bool valid = m_peerHandler->addICECandidate(iceCandidate->webCandidate()); 687 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
619 if (!valid) 688 ScriptPromise promise = resolver->promise();
620 exceptionState.throwDOMException(SyntaxError, "The ICE candidate could n ot be added."); 689 RTCVoidRequest* request = RTCVoidRequestPromiseImpl::create(this, resolver, kDefaultErrorName);
690 WebRTCICECandidate webCandidate = ConvertToWebRTCIceCandidate(candidate);
691 bool implemented = m_peerHandler->addICECandidate(request, webCandidate);
692 if (!implemented)
693 resolver->reject(DOMException::create(NotSupportedError, "This method is not yet implemented."));
philipj_slow 2016/02/09 12:02:03 Can this actually happen? The whole source code is
Guido Urdaneta 2016/02/09 16:51:01 Apparently, it can. https://code.google.com/p/chr
philipj_slow 2016/02/09 18:59:17 OK, it's not obvious from RTCPeerConnectionHandler
Guido Urdaneta 2016/02/10 07:05:13 Done.
694
695 return promise;
621 } 696 }
622 697
623 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, VoidCallb ack* successCallback, RTCErrorCallback* errorCallback, ExceptionState& exception State) 698 ScriptPromise RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, VoidCallback* successCallback, RTCErrorCallback* errorCallback)
624 { 699 {
625 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
626 return;
627
628 ASSERT(iceCandidate); 700 ASSERT(iceCandidate);
629 ASSERT(successCallback); 701 ASSERT(successCallback);
630 ASSERT(errorCallback); 702 ASSERT(errorCallback);
631 703
704 if (callErrorCallbackIfSignalingStateClosed(m_signalingState, errorCallback) )
705 return ScriptPromise();
706
632 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback); 707 RTCVoidRequest* request = RTCVoidRequestImpl::create(executionContext(), thi s, successCallback, errorCallback);
708 bool implemented = m_peerHandler->addICECandidate(request, iceCandidate->web Candidate());
709 if (!implemented)
710 errorCallback->handleEvent("This method is not yet implemented.");
philipj_slow 2016/02/09 12:02:03 This is also a synchronous error callback, but in
Guido Urdaneta 2016/02/09 16:51:01 Now called asynchronously.
633 711
634 bool implemented = m_peerHandler->addICECandidate(request, iceCandidate->web Candidate()); 712 return ScriptPromise();
635 if (!implemented) {
636 exceptionState.throwDOMException(NotSupportedError, "This method is not yet implemented.");
637 }
638 } 713 }
639 714
640 String RTCPeerConnection::signalingState() const 715 String RTCPeerConnection::signalingState() const
641 { 716 {
642 switch (m_signalingState) { 717 switch (m_signalingState) {
643 case SignalingStateStable: 718 case SignalingStateStable:
644 return "stable"; 719 return "stable";
645 case SignalingStateHaveLocalOffer: 720 case SignalingStateHaveLocalOffer:
646 return "have-local-offer"; 721 return "have-local-offer";
647 case SignalingStateHaveRemoteOffer: 722 case SignalingStateHaveRemoteOffer:
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 { 1124 {
1050 visitor->trace(m_localStreams); 1125 visitor->trace(m_localStreams);
1051 visitor->trace(m_remoteStreams); 1126 visitor->trace(m_remoteStreams);
1052 visitor->trace(m_dispatchScheduledEventRunner); 1127 visitor->trace(m_dispatchScheduledEventRunner);
1053 visitor->trace(m_scheduledEvents); 1128 visitor->trace(m_scheduledEvents);
1054 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac e(visitor); 1129 RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnection>::trac e(visitor);
1055 ActiveDOMObject::trace(visitor); 1130 ActiveDOMObject::trace(visitor);
1056 } 1131 }
1057 1132
1058 } // namespace blink 1133 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698