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

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

Issue 2656343002: Replace [CallWith=ExecutionContext] with [CallWith=ScriptState] (Closed)
Patch Set: Few more Created 3 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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 RTCSessionDescription* RTCPeerConnection::remoteDescription() { 784 RTCSessionDescription* RTCPeerConnection::remoteDescription() {
785 WebRTCSessionDescription webSessionDescription = 785 WebRTCSessionDescription webSessionDescription =
786 m_peerHandler->remoteDescription(); 786 m_peerHandler->remoteDescription();
787 if (webSessionDescription.isNull()) 787 if (webSessionDescription.isNull())
788 return nullptr; 788 return nullptr;
789 789
790 return RTCSessionDescription::create(webSessionDescription); 790 return RTCSessionDescription::create(webSessionDescription);
791 } 791 }
792 792
793 void RTCPeerConnection::setConfiguration( 793 void RTCPeerConnection::setConfiguration(
794 ExecutionContext* context, 794 ScriptState* scriptState,
795 const RTCConfiguration& rtcConfiguration, 795 const RTCConfiguration& rtcConfiguration,
796 ExceptionState& exceptionState) { 796 ExceptionState& exceptionState) {
797 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 797 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
798 return; 798 return;
799 799
800 WebRTCConfiguration configuration = 800 WebRTCConfiguration configuration = parseConfiguration(
801 parseConfiguration(context, rtcConfiguration, exceptionState); 801 scriptState->getExecutionContext(), rtcConfiguration, exceptionState);
802 802
803 if (exceptionState.hadException()) 803 if (exceptionState.hadException())
804 return; 804 return;
805 805
806 MediaErrorState mediaErrorState; 806 MediaErrorState mediaErrorState;
807 if (mediaErrorState.hadException()) { 807 if (mediaErrorState.hadException()) {
808 mediaErrorState.raiseException(exceptionState); 808 mediaErrorState.raiseException(exceptionState);
809 return; 809 return;
810 } 810 }
811 811
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 case ICEConnectionStateDisconnected: 1054 case ICEConnectionStateDisconnected:
1055 return "disconnected"; 1055 return "disconnected";
1056 case ICEConnectionStateClosed: 1056 case ICEConnectionStateClosed:
1057 return "closed"; 1057 return "closed";
1058 } 1058 }
1059 1059
1060 NOTREACHED(); 1060 NOTREACHED();
1061 return String(); 1061 return String();
1062 } 1062 }
1063 1063
1064 void RTCPeerConnection::addStream(ExecutionContext* context, 1064 void RTCPeerConnection::addStream(ScriptState* scriptState,
1065 MediaStream* stream, 1065 MediaStream* stream,
1066 const Dictionary& mediaConstraints, 1066 const Dictionary& mediaConstraints,
1067 ExceptionState& exceptionState) { 1067 ExceptionState& exceptionState) {
1068 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 1068 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
1069 return; 1069 return;
1070 1070
1071 if (!stream) { 1071 if (!stream) {
1072 exceptionState.throwDOMException( 1072 exceptionState.throwDOMException(
1073 TypeMismatchError, 1073 TypeMismatchError,
1074 ExceptionMessages::argumentNullOrIncorrectType(1, "MediaStream")); 1074 ExceptionMessages::argumentNullOrIncorrectType(1, "MediaStream"));
1075 return; 1075 return;
1076 } 1076 }
1077 1077
1078 if (m_localStreams.contains(stream)) 1078 if (m_localStreams.contains(stream))
1079 return; 1079 return;
1080 1080
1081 MediaErrorState mediaErrorState; 1081 MediaErrorState mediaErrorState;
1082 WebMediaConstraints constraints = 1082 WebMediaConstraints constraints = MediaConstraintsImpl::create(
1083 MediaConstraintsImpl::create(context, mediaConstraints, mediaErrorState); 1083 scriptState->getExecutionContext(), mediaConstraints, mediaErrorState);
1084 if (mediaErrorState.hadException()) { 1084 if (mediaErrorState.hadException()) {
1085 mediaErrorState.raiseException(exceptionState); 1085 mediaErrorState.raiseException(exceptionState);
1086 return; 1086 return;
1087 } 1087 }
1088 1088
1089 m_localStreams.push_back(stream); 1089 m_localStreams.push_back(stream);
1090 1090
1091 bool valid = m_peerHandler->addStream(stream->descriptor(), constraints); 1091 bool valid = m_peerHandler->addStream(stream->descriptor(), constraints);
1092 if (!valid) 1092 if (!valid)
1093 exceptionState.throwDOMException(SyntaxError, 1093 exceptionState.throwDOMException(SyntaxError,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 UseCounter::count(context, UseCounter::RTCPeerConnectionGetStats); 1162 UseCounter::count(context, UseCounter::RTCPeerConnectionGetStats);
1163 1163
1164 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); 1164 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
1165 ScriptPromise promise = resolver->promise(); 1165 ScriptPromise promise = resolver->promise();
1166 m_peerHandler->getStats(WebRTCStatsReportCallbackResolver::create(resolver)); 1166 m_peerHandler->getStats(WebRTCStatsReportCallbackResolver::create(resolver));
1167 1167
1168 return promise; 1168 return promise;
1169 } 1169 }
1170 1170
1171 RTCDataChannel* RTCPeerConnection::createDataChannel( 1171 RTCDataChannel* RTCPeerConnection::createDataChannel(
1172 ExecutionContext* context, 1172 ScriptState* scriptState,
1173 String label, 1173 String label,
1174 const Dictionary& options, 1174 const Dictionary& options,
1175 ExceptionState& exceptionState) { 1175 ExceptionState& exceptionState) {
1176 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 1176 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
1177 return nullptr; 1177 return nullptr;
1178 1178
1179 WebRTCDataChannelInit init; 1179 WebRTCDataChannelInit init;
1180 DictionaryHelper::get(options, "ordered", init.ordered); 1180 DictionaryHelper::get(options, "ordered", init.ordered);
1181 DictionaryHelper::get(options, "negotiated", init.negotiated); 1181 DictionaryHelper::get(options, "negotiated", init.negotiated);
1182 1182
1183 unsigned short value = 0; 1183 unsigned short value = 0;
1184 ExecutionContext* context = scriptState->getExecutionContext();
1184 if (DictionaryHelper::get(options, "id", value)) 1185 if (DictionaryHelper::get(options, "id", value))
1185 init.id = value; 1186 init.id = value;
1186 if (DictionaryHelper::get(options, "maxRetransmits", value)) { 1187 if (DictionaryHelper::get(options, "maxRetransmits", value)) {
1187 UseCounter::count( 1188 UseCounter::count(
1188 context, UseCounter::RTCPeerConnectionCreateDataChannelMaxRetransmits); 1189 context, UseCounter::RTCPeerConnectionCreateDataChannelMaxRetransmits);
1189 init.maxRetransmits = value; 1190 init.maxRetransmits = value;
1190 } 1191 }
1191 if (DictionaryHelper::get(options, "maxRetransmitTime", value)) { 1192 if (DictionaryHelper::get(options, "maxRetransmitTime", value)) {
1192 UseCounter::count( 1193 UseCounter::count(
1193 context, 1194 context,
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 DEFINE_TRACE(RTCPeerConnection) { 1486 DEFINE_TRACE(RTCPeerConnection) {
1486 visitor->trace(m_localStreams); 1487 visitor->trace(m_localStreams);
1487 visitor->trace(m_remoteStreams); 1488 visitor->trace(m_remoteStreams);
1488 visitor->trace(m_dispatchScheduledEventRunner); 1489 visitor->trace(m_dispatchScheduledEventRunner);
1489 visitor->trace(m_scheduledEvents); 1490 visitor->trace(m_scheduledEvents);
1490 EventTargetWithInlineData::trace(visitor); 1491 EventTargetWithInlineData::trace(visitor);
1491 SuspendableObject::trace(visitor); 1492 SuspendableObject::trace(visitor);
1492 } 1493 }
1493 1494
1494 } // namespace blink 1495 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698