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

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

Issue 2156063002: Preparation for new Promise-based RTCPeerConnection.getStats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with master Created 4 years, 4 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 22 matching lines...) Expand all
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/Microtask.h" 36 #include "bindings/core/v8/Microtask.h"
37 #include "bindings/core/v8/Nullable.h" 37 #include "bindings/core/v8/Nullable.h"
38 #include "bindings/core/v8/ScriptPromiseResolver.h" 38 #include "bindings/core/v8/ScriptPromiseResolver.h"
39 #include "bindings/core/v8/ScriptState.h" 39 #include "bindings/core/v8/ScriptState.h"
40 #include "bindings/core/v8/ScriptValue.h" 40 #include "bindings/core/v8/ScriptValue.h"
41 #include "bindings/core/v8/V8ThrowException.h" 41 #include "bindings/core/v8/V8ThrowException.h"
42 #include "bindings/modules/v8/RTCIceCandidateInitOrRTCIceCandidate.h" 42 #include "bindings/modules/v8/RTCIceCandidateInitOrRTCIceCandidate.h"
43 #include "bindings/modules/v8/V8MediaStreamTrack.h"
43 #include "bindings/modules/v8/V8RTCCertificate.h" 44 #include "bindings/modules/v8/V8RTCCertificate.h"
44 #include "core/dom/DOMException.h" 45 #include "core/dom/DOMException.h"
45 #include "core/dom/DOMTimeStamp.h" 46 #include "core/dom/DOMTimeStamp.h"
46 #include "core/dom/Document.h" 47 #include "core/dom/Document.h"
47 #include "core/dom/ExceptionCode.h" 48 #include "core/dom/ExceptionCode.h"
48 #include "core/dom/ExecutionContext.h" 49 #include "core/dom/ExecutionContext.h"
49 #include "core/frame/HostsUsingFeatures.h" 50 #include "core/frame/HostsUsingFeatures.h"
50 #include "core/frame/LocalFrame.h" 51 #include "core/frame/LocalFrame.h"
51 #include "core/frame/UseCounter.h" 52 #include "core/frame/UseCounter.h"
52 #include "core/html/VoidCallback.h" 53 #include "core/html/VoidCallback.h"
(...skipping 11 matching lines...) Expand all
64 #include "modules/peerconnection/RTCPeerConnectionErrorCallback.h" 65 #include "modules/peerconnection/RTCPeerConnectionErrorCallback.h"
65 #include "modules/peerconnection/RTCSessionDescription.h" 66 #include "modules/peerconnection/RTCSessionDescription.h"
66 #include "modules/peerconnection/RTCSessionDescriptionCallback.h" 67 #include "modules/peerconnection/RTCSessionDescriptionCallback.h"
67 #include "modules/peerconnection/RTCSessionDescriptionInit.h" 68 #include "modules/peerconnection/RTCSessionDescriptionInit.h"
68 #include "modules/peerconnection/RTCSessionDescriptionRequestImpl.h" 69 #include "modules/peerconnection/RTCSessionDescriptionRequestImpl.h"
69 #include "modules/peerconnection/RTCSessionDescriptionRequestPromiseImpl.h" 70 #include "modules/peerconnection/RTCSessionDescriptionRequestPromiseImpl.h"
70 #include "modules/peerconnection/RTCStatsCallback.h" 71 #include "modules/peerconnection/RTCStatsCallback.h"
71 #include "modules/peerconnection/RTCStatsRequestImpl.h" 72 #include "modules/peerconnection/RTCStatsRequestImpl.h"
72 #include "modules/peerconnection/RTCVoidRequestImpl.h" 73 #include "modules/peerconnection/RTCVoidRequestImpl.h"
73 #include "modules/peerconnection/RTCVoidRequestPromiseImpl.h" 74 #include "modules/peerconnection/RTCVoidRequestPromiseImpl.h"
75 #include "platform/RuntimeEnabledFeatures.h"
74 #include "platform/peerconnection/RTCAnswerOptionsPlatform.h" 76 #include "platform/peerconnection/RTCAnswerOptionsPlatform.h"
75 #include "platform/peerconnection/RTCConfiguration.h" 77 #include "platform/peerconnection/RTCConfiguration.h"
76 #include "platform/peerconnection/RTCOfferOptionsPlatform.h" 78 #include "platform/peerconnection/RTCOfferOptionsPlatform.h"
77 #include "public/platform/Platform.h" 79 #include "public/platform/Platform.h"
78 #include "public/platform/WebCryptoAlgorithmParams.h" 80 #include "public/platform/WebCryptoAlgorithmParams.h"
79 #include "public/platform/WebMediaStream.h" 81 #include "public/platform/WebMediaStream.h"
80 #include "public/platform/WebRTCAnswerOptions.h" 82 #include "public/platform/WebRTCAnswerOptions.h"
81 #include "public/platform/WebRTCCertificate.h" 83 #include "public/platform/WebRTCCertificate.h"
82 #include "public/platform/WebRTCCertificateGenerator.h" 84 #include "public/platform/WebRTCCertificateGenerator.h"
83 #include "public/platform/WebRTCConfiguration.h" 85 #include "public/platform/WebRTCConfiguration.h"
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } 943 }
942 944
943 for (MediaStreamVector::iterator iter = m_remoteStreams.begin(); iter != m_r emoteStreams.end(); ++iter) { 945 for (MediaStreamVector::iterator iter = m_remoteStreams.begin(); iter != m_r emoteStreams.end(); ++iter) {
944 if ((*iter)->id() == streamId) 946 if ((*iter)->id() == streamId)
945 return iter->get(); 947 return iter->get();
946 } 948 }
947 949
948 return 0; 950 return 0;
949 } 951 }
950 952
951 void RTCPeerConnection::getStats(ExecutionContext* context, RTCStatsCallback* su ccessCallback, MediaStreamTrack* selector) 953 ScriptPromise RTCPeerConnection::getStats(ScriptState* scriptState, RTCStatsCall back* successCallback, MediaStreamTrack* selector)
952 { 954 {
955 ExecutionContext* context = scriptState->getExecutionContext();
956 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
957 ScriptPromise promise = resolver->promise();
958
953 UseCounter::count(context, UseCounter::RTCPeerConnectionGetStatsLegacyNonCom pliant); 959 UseCounter::count(context, UseCounter::RTCPeerConnectionGetStatsLegacyNonCom pliant);
954 RTCStatsRequest* statsRequest = RTCStatsRequestImpl::create(getExecutionCont ext(), this, successCallback, selector); 960 RTCStatsRequest* statsRequest = RTCStatsRequestImpl::create(getExecutionCont ext(), this, successCallback, selector);
955 // FIXME: Add passing selector as part of the statsRequest. 961 // FIXME: Add passing selector as part of the statsRequest.
956 m_peerHandler->getStats(statsRequest); 962 m_peerHandler->getStats(statsRequest);
963
964 resolver->resolve();
965 return promise;
966 }
967
968 ScriptPromise RTCPeerConnection::getStats(ScriptState* scriptState, MediaStreamT rack* selector)
969 {
970 ExecutionContext* context = scriptState->getExecutionContext();
971 UseCounter::count(context, UseCounter::RTCPeerConnectionGetStats);
972 // TODO(hbos): Implement new |getStats| function. crbug.com/627816
973 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError, "getStats(optional MediaStreamTrack?) has not been impleme nted yet."));
957 } 974 }
958 975
959 RTCDataChannel* RTCPeerConnection::createDataChannel(String label, const Diction ary& options, ExceptionState& exceptionState) 976 RTCDataChannel* RTCPeerConnection::createDataChannel(String label, const Diction ary& options, ExceptionState& exceptionState)
960 { 977 {
961 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 978 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
962 return nullptr; 979 return nullptr;
963 980
964 WebRTCDataChannelInit init; 981 WebRTCDataChannelInit init;
965 DictionaryHelper::get(options, "ordered", init.ordered); 982 DictionaryHelper::get(options, "ordered", init.ordered);
966 DictionaryHelper::get(options, "negotiated", init.negotiated); 983 DictionaryHelper::get(options, "negotiated", init.negotiated);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 { 1275 {
1259 visitor->trace(m_localStreams); 1276 visitor->trace(m_localStreams);
1260 visitor->trace(m_remoteStreams); 1277 visitor->trace(m_remoteStreams);
1261 visitor->trace(m_dispatchScheduledEventRunner); 1278 visitor->trace(m_dispatchScheduledEventRunner);
1262 visitor->trace(m_scheduledEvents); 1279 visitor->trace(m_scheduledEvents);
1263 EventTargetWithInlineData::trace(visitor); 1280 EventTargetWithInlineData::trace(visitor);
1264 ActiveDOMObject::trace(visitor); 1281 ActiveDOMObject::trace(visitor);
1265 } 1282 }
1266 1283
1267 } // namespace blink 1284 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698