Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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/peerconnection/RTCPeerConnection.h" | 31 #include "modules/peerconnection/RTCPeerConnection.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ArrayValue.h" | |
| 34 #include "bindings/core/v8/ExceptionMessages.h" | 33 #include "bindings/core/v8/ExceptionMessages.h" |
| 35 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
| 36 #include "bindings/core/v8/Microtask.h" | 35 #include "bindings/core/v8/Microtask.h" |
| 37 #include "bindings/core/v8/Nullable.h" | 36 #include "bindings/core/v8/Nullable.h" |
| 38 #include "bindings/core/v8/ScriptPromiseResolver.h" | 37 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 39 #include "bindings/core/v8/ScriptState.h" | 38 #include "bindings/core/v8/ScriptState.h" |
| 40 #include "bindings/core/v8/ScriptValue.h" | 39 #include "bindings/core/v8/ScriptValue.h" |
| 41 #include "bindings/core/v8/V8ThrowException.h" | 40 #include "bindings/core/v8/V8ThrowException.h" |
| 42 #include "bindings/modules/v8/RTCIceCandidateInitOrRTCIceCandidate.h" | 41 #include "bindings/modules/v8/RTCIceCandidateInitOrRTCIceCandidate.h" |
| 43 #include "bindings/modules/v8/V8MediaStreamTrack.h" | 42 #include "bindings/modules/v8/V8MediaStreamTrack.h" |
| 44 #include "bindings/modules/v8/V8RTCCertificate.h" | 43 #include "bindings/modules/v8/V8RTCCertificate.h" |
| 45 #include "core/dom/DOMException.h" | 44 #include "core/dom/DOMException.h" |
| 46 #include "core/dom/DOMTimeStamp.h" | 45 #include "core/dom/DOMTimeStamp.h" |
| 47 #include "core/dom/Document.h" | 46 #include "core/dom/Document.h" |
| 48 #include "core/dom/ExceptionCode.h" | 47 #include "core/dom/ExceptionCode.h" |
| 49 #include "core/dom/ExecutionContext.h" | 48 #include "core/dom/ExecutionContext.h" |
| 50 #include "core/frame/HostsUsingFeatures.h" | 49 #include "core/frame/HostsUsingFeatures.h" |
| 51 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
| 52 #include "core/frame/UseCounter.h" | 51 #include "core/frame/UseCounter.h" |
| 53 #include "core/html/VoidCallback.h" | 52 #include "core/html/VoidCallback.h" |
| 54 #include "core/loader/FrameLoader.h" | 53 #include "core/loader/FrameLoader.h" |
| 55 #include "core/loader/FrameLoaderClient.h" | 54 #include "core/loader/FrameLoaderClient.h" |
| 56 #include "modules/crypto/CryptoResultImpl.h" | 55 #include "modules/crypto/CryptoResultImpl.h" |
| 57 #include "modules/mediastream/MediaConstraintsImpl.h" | 56 #include "modules/mediastream/MediaConstraintsImpl.h" |
| 58 #include "modules/mediastream/MediaStreamEvent.h" | 57 #include "modules/mediastream/MediaStreamEvent.h" |
| 59 #include "modules/peerconnection/RTCAnswerOptions.h" | 58 #include "modules/peerconnection/RTCAnswerOptions.h" |
| 59 #include "modules/peerconnection/RTCConfiguration.h" | |
| 60 #include "modules/peerconnection/RTCDTMFSender.h" | 60 #include "modules/peerconnection/RTCDTMFSender.h" |
| 61 #include "modules/peerconnection/RTCDataChannel.h" | 61 #include "modules/peerconnection/RTCDataChannel.h" |
| 62 #include "modules/peerconnection/RTCDataChannelEvent.h" | 62 #include "modules/peerconnection/RTCDataChannelEvent.h" |
| 63 #include "modules/peerconnection/RTCIceCandidateEvent.h" | 63 #include "modules/peerconnection/RTCIceCandidateEvent.h" |
| 64 #include "modules/peerconnection/RTCIceServer.h" | |
| 64 #include "modules/peerconnection/RTCOfferOptions.h" | 65 #include "modules/peerconnection/RTCOfferOptions.h" |
| 65 #include "modules/peerconnection/RTCPeerConnectionErrorCallback.h" | 66 #include "modules/peerconnection/RTCPeerConnectionErrorCallback.h" |
| 66 #include "modules/peerconnection/RTCSessionDescription.h" | 67 #include "modules/peerconnection/RTCSessionDescription.h" |
| 67 #include "modules/peerconnection/RTCSessionDescriptionCallback.h" | 68 #include "modules/peerconnection/RTCSessionDescriptionCallback.h" |
| 68 #include "modules/peerconnection/RTCSessionDescriptionInit.h" | 69 #include "modules/peerconnection/RTCSessionDescriptionInit.h" |
| 69 #include "modules/peerconnection/RTCSessionDescriptionRequestImpl.h" | 70 #include "modules/peerconnection/RTCSessionDescriptionRequestImpl.h" |
| 70 #include "modules/peerconnection/RTCSessionDescriptionRequestPromiseImpl.h" | 71 #include "modules/peerconnection/RTCSessionDescriptionRequestPromiseImpl.h" |
| 71 #include "modules/peerconnection/RTCStatsCallback.h" | 72 #include "modules/peerconnection/RTCStatsCallback.h" |
| 72 #include "modules/peerconnection/RTCStatsReport.h" | 73 #include "modules/peerconnection/RTCStatsReport.h" |
| 73 #include "modules/peerconnection/RTCStatsRequestImpl.h" | 74 #include "modules/peerconnection/RTCStatsRequestImpl.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 | 211 |
| 211 void onSuccess(std::unique_ptr<WebRTCCertificate> certificate) override { | 212 void onSuccess(std::unique_ptr<WebRTCCertificate> certificate) override { |
| 212 m_resolver->resolve(new RTCCertificate(std::move(certificate))); | 213 m_resolver->resolve(new RTCCertificate(std::move(certificate))); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void onError() override { m_resolver->reject(); } | 216 void onError() override { m_resolver->reject(); } |
| 216 | 217 |
| 217 Persistent<ScriptPromiseResolver> m_resolver; | 218 Persistent<ScriptPromiseResolver> m_resolver; |
| 218 }; | 219 }; |
| 219 | 220 |
| 220 WebRTCConfiguration parseConfiguration(const Dictionary& configuration, | 221 WebRTCConfiguration parseConfiguration(ExecutionContext* context, |
| 222 const RTCConfiguration& configuration, | |
| 221 ExceptionState& exceptionState, | 223 ExceptionState& exceptionState, |
| 222 RtcpMuxPolicy* selectedRtcpMuxPolicy) { | 224 RtcpMuxPolicy* selectedRtcpMuxPolicy) { |
|
hbos_chromium
2016/10/24 11:35:24
nit:
DCHECK(context) or make it ExecutionContext&
foolip
2016/10/24 12:05:26
Done with DCHECKs.
| |
| 223 WebRTCConfiguration rtcConfiguration; | |
| 224 if (configuration.isUndefinedOrNull()) | |
| 225 return WebRTCConfiguration(); | |
| 226 | |
| 227 WebRTCIceTransports iceTransports = WebRTCIceTransports::kAll; | 225 WebRTCIceTransports iceTransports = WebRTCIceTransports::kAll; |
| 228 String iceTransportsString; | 226 String iceTransportsString = configuration.iceTransports(); |
| 229 if (DictionaryHelper::get(configuration, "iceTransports", | 227 if (iceTransportsString == "none") { |
| 230 iceTransportsString)) { | 228 UseCounter::count(context, UseCounter::RTCConfigurationIceTransportsNone); |
| 231 if (iceTransportsString == "none") { | 229 iceTransports = WebRTCIceTransports::kNone; |
| 232 iceTransports = WebRTCIceTransports::kNone; | 230 } else if (iceTransportsString == "relay") { |
| 233 } else if (iceTransportsString == "relay") { | 231 iceTransports = WebRTCIceTransports::kRelay; |
| 234 iceTransports = WebRTCIceTransports::kRelay; | 232 } else { |
| 235 } else if (iceTransportsString != "all") { | 233 DCHECK_EQ(iceTransportsString, "all"); |
| 236 exceptionState.throwTypeError("Malformed RTCIceTransports"); | |
| 237 return WebRTCConfiguration(); | |
| 238 } | |
| 239 } | |
| 240 | |
| 241 ArrayValue iceServers; | |
| 242 bool ok = DictionaryHelper::get(configuration, "iceServers", iceServers); | |
| 243 if (!ok || iceServers.isUndefinedOrNull()) { | |
| 244 exceptionState.throwTypeError("Malformed RTCConfiguration"); | |
| 245 return WebRTCConfiguration(); | |
| 246 } | |
| 247 | |
| 248 size_t numberOfServers; | |
| 249 ok = iceServers.length(numberOfServers); | |
| 250 if (!ok) { | |
| 251 exceptionState.throwTypeError("Malformed RTCConfiguration"); | |
| 252 return WebRTCConfiguration(); | |
| 253 } | 234 } |
| 254 | 235 |
| 255 WebRTCBundlePolicy bundlePolicy = WebRTCBundlePolicy::kBalanced; | 236 WebRTCBundlePolicy bundlePolicy = WebRTCBundlePolicy::kBalanced; |
| 256 String bundlePolicyString; | 237 String bundlePolicyString = configuration.bundlePolicy(); |
| 257 if (DictionaryHelper::get(configuration, "bundlePolicy", | 238 if (bundlePolicyString == "max-compat") { |
| 258 bundlePolicyString)) { | 239 bundlePolicy = WebRTCBundlePolicy::kMaxCompat; |
| 259 if (bundlePolicyString == "max-compat") { | 240 } else if (bundlePolicyString == "max-bundle") { |
| 260 bundlePolicy = WebRTCBundlePolicy::kMaxCompat; | 241 bundlePolicy = WebRTCBundlePolicy::kMaxBundle; |
| 261 } else if (bundlePolicyString == "max-bundle") { | 242 } else { |
| 262 bundlePolicy = WebRTCBundlePolicy::kMaxBundle; | 243 DCHECK_EQ(bundlePolicyString, "balanced"); |
| 263 } else if (bundlePolicyString != "balanced") { | |
| 264 exceptionState.throwTypeError("Malformed RTCBundlePolicy"); | |
| 265 return WebRTCConfiguration(); | |
| 266 } | |
| 267 } | 244 } |
| 268 | 245 |
| 269 // For the histogram value of "WebRTC.PeerConnection.SelectedRtcpMuxPolicy". | 246 // For the histogram value of "WebRTC.PeerConnection.SelectedRtcpMuxPolicy". |
| 270 *selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; | 247 *selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; |
| 271 WebRTCRtcpMuxPolicy rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kNegotiate; | 248 WebRTCRtcpMuxPolicy rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kNegotiate; |
| 272 String rtcpMuxPolicyString; | 249 if (configuration.hasRtcpMuxPolicy()) { |
| 273 if (DictionaryHelper::get(configuration, "rtcpMuxPolicy", | 250 String rtcpMuxPolicyString = configuration.rtcpMuxPolicy(); |
| 274 rtcpMuxPolicyString)) { | |
| 275 if (rtcpMuxPolicyString == "require") { | 251 if (rtcpMuxPolicyString == "require") { |
| 276 *selectedRtcpMuxPolicy = RtcpMuxPolicyRequire; | 252 *selectedRtcpMuxPolicy = RtcpMuxPolicyRequire; |
| 277 rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kRequire; | 253 rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kRequire; |
| 278 } else if (rtcpMuxPolicyString == "negotiate") { | 254 } else { |
| 255 DCHECK_EQ(rtcpMuxPolicyString, "negotiate"); | |
| 279 *selectedRtcpMuxPolicy = RtcpMuxPolicyNegotiate; | 256 *selectedRtcpMuxPolicy = RtcpMuxPolicyNegotiate; |
| 280 rtcpMuxPolicy = WebRTCRtcpMuxPolicy::kNegotiate; | |
| 281 } else { | |
| 282 exceptionState.throwTypeError("Malformed RTCRtcpMuxPolicy"); | |
| 283 return WebRTCConfiguration(); | |
| 284 } | 257 } |
| 285 } | 258 } |
| 286 | 259 |
| 287 rtcConfiguration.iceTransports = iceTransports; | 260 WebRTCConfiguration webConfiguration; |
| 288 rtcConfiguration.bundlePolicy = bundlePolicy; | 261 webConfiguration.iceTransports = iceTransports; |
| 289 rtcConfiguration.rtcpMuxPolicy = rtcpMuxPolicy; | 262 webConfiguration.bundlePolicy = bundlePolicy; |
| 263 webConfiguration.rtcpMuxPolicy = rtcpMuxPolicy; | |
| 290 | 264 |
| 291 for (size_t i = 0; i < numberOfServers; ++i) { | 265 if (configuration.hasIceServers()) { |
| 292 Dictionary iceServer; | 266 Vector<WebRTCIceServer> iceServers; |
| 293 ok = iceServers.get(i, iceServer); | 267 for (const RTCIceServer& iceServer : configuration.iceServers()) { |
| 294 if (!ok) { | 268 Vector<String> urlStrings; |
| 295 exceptionState.throwTypeError("Malformed RTCIceServer"); | 269 if (iceServer.hasURLs()) { |
| 296 return WebRTCConfiguration(); | 270 UseCounter::count(context, UseCounter::RTCIceServerURLs); |
| 297 } | 271 const StringOrStringSequence& urls = iceServer.urls(); |
| 298 | 272 if (urls.isString()) { |
| 299 Vector<String> names; | 273 urlStrings.append(urls.getAsString()); |
| 300 iceServer.getPropertyNames(names); | |
| 301 | |
| 302 Vector<String> urlStrings; | |
| 303 if (names.contains("urls")) { | |
| 304 if (!DictionaryHelper::get(iceServer, "urls", urlStrings) || | |
| 305 !urlStrings.size()) { | |
| 306 String urlString; | |
| 307 if (DictionaryHelper::get(iceServer, "urls", urlString)) { | |
| 308 urlStrings.append(urlString); | |
| 309 } else { | 274 } else { |
| 310 exceptionState.throwTypeError("Malformed RTCIceServer"); | 275 DCHECK(urls.isStringSequence()); |
| 311 return WebRTCConfiguration(); | 276 urlStrings = urls.getAsStringSequence(); |
| 312 } | 277 } |
| 313 } | 278 } else if (iceServer.hasURL()) { |
| 314 } else if (names.contains("url")) { | 279 UseCounter::count(context, UseCounter::RTCIceServerURL); |
| 315 String urlString; | 280 urlStrings.append(iceServer.url()); |
| 316 if (DictionaryHelper::get(iceServer, "url", urlString)) { | |
| 317 urlStrings.append(urlString); | |
| 318 } else { | 281 } else { |
| 319 exceptionState.throwTypeError("Malformed RTCIceServer"); | 282 exceptionState.throwTypeError("Malformed RTCIceServer"); |
| 320 return WebRTCConfiguration(); | 283 return WebRTCConfiguration(); |
| 321 } | 284 } |
| 322 } else { | 285 |
| 323 exceptionState.throwTypeError("Malformed RTCIceServer"); | 286 String username = iceServer.username(); |
| 324 return WebRTCConfiguration(); | 287 String credential = iceServer.credential(); |
| 288 | |
| 289 for (const String& urlString : urlStrings) { | |
| 290 KURL url(KURL(), urlString); | |
| 291 if (!url.isValid() || | |
| 292 !(url.protocolIs("turn") || url.protocolIs("turns") || | |
| 293 url.protocolIs("stun"))) { | |
| 294 exceptionState.throwTypeError("Malformed URL"); | |
| 295 return WebRTCConfiguration(); | |
| 296 } | |
| 297 iceServers.append(WebRTCIceServer{url, username, credential}); | |
|
hbos_chromium
2016/10/24 11:35:24
Add TODO that there should be one WebRTCIceServer
foolip
2016/10/24 12:05:26
The spec has a kind of flattening into a validated
| |
| 298 } | |
| 325 } | 299 } |
| 326 | 300 webConfiguration.iceServers = iceServers; |
| 327 String username, credential; | |
| 328 DictionaryHelper::get(iceServer, "username", username); | |
| 329 DictionaryHelper::get(iceServer, "credential", credential); | |
| 330 | |
| 331 Vector<WebRTCIceServer> iceServers; | |
| 332 for (Vector<String>::iterator iter = urlStrings.begin(); | |
| 333 iter != urlStrings.end(); ++iter) { | |
| 334 KURL url(KURL(), *iter); | |
| 335 if (!url.isValid() || | |
| 336 !(url.protocolIs("turn") || url.protocolIs("turns") || | |
| 337 url.protocolIs("stun"))) { | |
| 338 exceptionState.throwTypeError("Malformed URL"); | |
| 339 return WebRTCConfiguration(); | |
| 340 } | |
| 341 iceServers.append(WebRTCIceServer{url, username, credential}); | |
| 342 } | |
| 343 rtcConfiguration.iceServers = iceServers; | |
| 344 } | 301 } |
| 345 | 302 |
| 346 ArrayValue certificates; | 303 if (configuration.hasCertificates()) { |
| 347 if (DictionaryHelper::get(configuration, "certificates", certificates) && | 304 const HeapVector<Member<RTCCertificate>>& certificates = |
| 348 !certificates.isUndefinedOrNull()) { | 305 configuration.certificates(); |
| 349 size_t numberOfCertificates; | 306 size_t numberOfCertificates = certificates.size(); |
|
hbos_chromium
2016/10/24 11:35:24
nit: remove numberOfCertificates in favor of certi
foolip
2016/10/24 12:05:26
Done.
| |
| 350 certificates.length(numberOfCertificates); | |
| 351 WebVector<std::unique_ptr<WebRTCCertificate>> certificatesCopy( | 307 WebVector<std::unique_ptr<WebRTCCertificate>> certificatesCopy( |
| 352 numberOfCertificates); | 308 numberOfCertificates); |
| 353 for (size_t i = 0; i < numberOfCertificates; ++i) { | 309 for (size_t i = 0; i < numberOfCertificates; ++i) { |
| 354 RTCCertificate* certificate = nullptr; | 310 certificatesCopy[i] = certificates[i]->certificateShallowCopy(); |
| 311 } | |
| 312 webConfiguration.certificates = std::move(certificatesCopy); | |
| 313 } | |
| 355 | 314 |
| 356 Dictionary dictCert; | 315 return webConfiguration; |
| 357 certificates.get(i, dictCert); | |
| 358 v8::Local<v8::Value> valCert = dictCert.v8Value(); | |
| 359 if (!valCert.IsEmpty()) { | |
| 360 certificate = V8RTCCertificate::toImplWithTypeCheck( | |
| 361 configuration.isolate(), valCert); | |
| 362 } | |
| 363 if (!certificate) { | |
| 364 exceptionState.throwTypeError("Malformed sequence<RTCCertificate>"); | |
| 365 return WebRTCConfiguration(); | |
| 366 } | |
| 367 | |
| 368 certificatesCopy[i] = certificate->certificateShallowCopy(); | |
| 369 } | |
| 370 rtcConfiguration.certificates = std::move(certificatesCopy); | |
| 371 } | |
| 372 return rtcConfiguration; | |
| 373 } | 316 } |
| 374 | 317 |
| 375 RTCOfferOptionsPlatform* parseOfferOptions(const Dictionary& options) { | 318 RTCOfferOptionsPlatform* parseOfferOptions(const Dictionary& options) { |
| 376 if (options.isUndefinedOrNull()) | 319 if (options.isUndefinedOrNull()) |
| 377 return 0; | 320 return 0; |
| 378 | 321 |
| 379 Vector<String> propertyNames; | 322 Vector<String> propertyNames; |
| 380 options.getPropertyNames(propertyNames); | 323 options.getPropertyNames(propertyNames); |
| 381 | 324 |
| 382 // Treat |options| as MediaConstraints if it is empty or has "optional" or | 325 // Treat |options| as MediaConstraints if it is empty or has "optional" or |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 445 if (m_setupFunction) { | 388 if (m_setupFunction) { |
| 446 return (*m_setupFunction)(); | 389 return (*m_setupFunction)(); |
| 447 } | 390 } |
| 448 return true; | 391 return true; |
| 449 } | 392 } |
| 450 | 393 |
| 451 DEFINE_TRACE(RTCPeerConnection::EventWrapper) { | 394 DEFINE_TRACE(RTCPeerConnection::EventWrapper) { |
| 452 visitor->trace(m_event); | 395 visitor->trace(m_event); |
| 453 } | 396 } |
| 454 | 397 |
| 455 RTCPeerConnection* RTCPeerConnection::create(ExecutionContext* context, | 398 RTCPeerConnection* RTCPeerConnection::create( |
| 456 const Dictionary& rtcConfiguration, | 399 ExecutionContext* context, |
| 457 const Dictionary& mediaConstraints, | 400 const RTCConfiguration& rtcConfiguration, |
| 458 ExceptionState& exceptionState) { | 401 const Dictionary& mediaConstraints, |
| 402 ExceptionState& exceptionState) { | |
| 459 if (mediaConstraints.isObject()) | 403 if (mediaConstraints.isObject()) |
| 460 UseCounter::count(context, | 404 UseCounter::count(context, |
| 461 UseCounter::RTCPeerConnectionConstructorConstraints); | 405 UseCounter::RTCPeerConnectionConstructorConstraints); |
| 462 else | 406 else |
| 463 UseCounter::count(context, | 407 UseCounter::count(context, |
| 464 UseCounter::RTCPeerConnectionConstructorCompliant); | 408 UseCounter::RTCPeerConnectionConstructorCompliant); |
| 465 | 409 |
| 466 // Record the RtcpMuxPolicy for histogram | 410 // Record the RtcpMuxPolicy for histogram |
| 467 // "WebRTC.PeerConnection.SelectedRtcpMuxPolicy". | 411 // "WebRTC.PeerConnection.SelectedRtcpMuxPolicy". |
| 468 RtcpMuxPolicy selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; | 412 RtcpMuxPolicy selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; |
| 469 WebRTCConfiguration configuration = parseConfiguration( | 413 WebRTCConfiguration configuration = parseConfiguration( |
| 470 rtcConfiguration, exceptionState, &selectedRtcpMuxPolicy); | 414 context, rtcConfiguration, exceptionState, &selectedRtcpMuxPolicy); |
| 471 if (exceptionState.hadException()) | 415 if (exceptionState.hadException()) |
| 472 return 0; | 416 return 0; |
| 473 | 417 |
| 474 // Make sure no certificates have expired. | 418 // Make sure no certificates have expired. |
| 419 // TODO(hbos): Should this be part of parseConfiguration and thus apply to | |
| 420 // updateIce as well? | |
|
hbos_chromium
2016/10/24 11:35:24
Remove TODO comment.
Because I'm lazy.
Kidding. B
foolip
2016/10/24 12:05:25
You're right, https://w3c.github.io/webrtc-pc/#dom
| |
| 475 if (configuration.certificates.size() > 0) { | 421 if (configuration.certificates.size() > 0) { |
| 476 DOMTimeStamp now = convertSecondsToDOMTimeStamp(currentTime()); | 422 DOMTimeStamp now = convertSecondsToDOMTimeStamp(currentTime()); |
| 477 for (const std::unique_ptr<WebRTCCertificate>& certificate : | 423 for (const std::unique_ptr<WebRTCCertificate>& certificate : |
| 478 configuration.certificates) { | 424 configuration.certificates) { |
| 479 DOMTimeStamp expires = certificate->expires(); | 425 DOMTimeStamp expires = certificate->expires(); |
| 480 if (expires <= now) { | 426 if (expires <= now) { |
| 481 // TODO(hbos): Per https://w3c.github.io/webrtc-pc/#operation this | 427 // TODO(hbos): Per https://w3c.github.io/webrtc-pc/#operation this |
| 482 // should throw InvalidAccessError, not InvalidStateError. | 428 // should throw InvalidAccessError, not InvalidStateError. |
| 483 exceptionState.throwDOMException(InvalidStateError, | 429 exceptionState.throwDOMException(InvalidStateError, |
| 484 "Expired certificate(s)."); | 430 "Expired certificate(s)."); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 | 764 |
| 819 RTCSessionDescription* RTCPeerConnection::remoteDescription() { | 765 RTCSessionDescription* RTCPeerConnection::remoteDescription() { |
| 820 WebRTCSessionDescription webSessionDescription = | 766 WebRTCSessionDescription webSessionDescription = |
| 821 m_peerHandler->remoteDescription(); | 767 m_peerHandler->remoteDescription(); |
| 822 if (webSessionDescription.isNull()) | 768 if (webSessionDescription.isNull()) |
| 823 return nullptr; | 769 return nullptr; |
| 824 | 770 |
| 825 return RTCSessionDescription::create(webSessionDescription); | 771 return RTCSessionDescription::create(webSessionDescription); |
| 826 } | 772 } |
| 827 | 773 |
| 828 void RTCPeerConnection::updateIce(const Dictionary& rtcConfiguration, | 774 void RTCPeerConnection::updateIce(ExecutionContext* context, |
|
hbos_chromium
2016/10/24 11:35:24
Note that not only is the name different from the
foolip
2016/10/24 12:05:26
I added [Measure] to updateIce in https://coderevi
| |
| 775 const RTCConfiguration& rtcConfiguration, | |
| 829 const Dictionary& mediaConstraints, | 776 const Dictionary& mediaConstraints, |
| 830 ExceptionState& exceptionState) { | 777 ExceptionState& exceptionState) { |
| 831 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 778 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 832 return; | 779 return; |
| 833 | 780 |
| 834 RtcpMuxPolicy selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; | 781 RtcpMuxPolicy selectedRtcpMuxPolicy = RtcpMuxPolicyDefault; |
| 835 WebRTCConfiguration configuration = parseConfiguration( | 782 WebRTCConfiguration configuration = parseConfiguration( |
| 836 rtcConfiguration, exceptionState, &selectedRtcpMuxPolicy); | 783 context, rtcConfiguration, exceptionState, &selectedRtcpMuxPolicy); |
| 837 | 784 |
| 838 if (exceptionState.hadException()) | 785 if (exceptionState.hadException()) |
| 839 return; | 786 return; |
| 840 | 787 |
| 841 MediaErrorState mediaErrorState; | 788 MediaErrorState mediaErrorState; |
| 842 if (mediaErrorState.hadException()) { | 789 if (mediaErrorState.hadException()) { |
| 843 mediaErrorState.raiseException(exceptionState); | 790 mediaErrorState.raiseException(exceptionState); |
| 844 return; | 791 return; |
| 845 } | 792 } |
| 846 | 793 |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1505 DEFINE_TRACE(RTCPeerConnection) { | 1452 DEFINE_TRACE(RTCPeerConnection) { |
| 1506 visitor->trace(m_localStreams); | 1453 visitor->trace(m_localStreams); |
| 1507 visitor->trace(m_remoteStreams); | 1454 visitor->trace(m_remoteStreams); |
| 1508 visitor->trace(m_dispatchScheduledEventRunner); | 1455 visitor->trace(m_dispatchScheduledEventRunner); |
| 1509 visitor->trace(m_scheduledEvents); | 1456 visitor->trace(m_scheduledEvents); |
| 1510 EventTargetWithInlineData::trace(visitor); | 1457 EventTargetWithInlineData::trace(visitor); |
| 1511 ActiveDOMObject::trace(visitor); | 1458 ActiveDOMObject::trace(visitor); |
| 1512 } | 1459 } |
| 1513 | 1460 |
| 1514 } // namespace blink | 1461 } // namespace blink |
| OLD | NEW |