| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaCon
straints, exceptionState); | 201 RefPtr<MediaConstraints> constraints = MediaConstraintsImpl::create(mediaCon
straints, exceptionState); |
| 202 if (exceptionState.hadException()) | 202 if (exceptionState.hadException()) |
| 203 return; | 203 return; |
| 204 | 204 |
| 205 RefPtr<RTCSessionDescriptionRequestImpl> request = RTCSessionDescriptionRequ
estImpl::create(executionContext(), successCallback, errorCallback); | 205 RefPtr<RTCSessionDescriptionRequestImpl> request = RTCSessionDescriptionRequ
estImpl::create(executionContext(), successCallback, errorCallback); |
| 206 m_peerHandler->createAnswer(request.release(), constraints.release()); | 206 m_peerHandler->createAnswer(request.release(), constraints.release()); |
| 207 } | 207 } |
| 208 | 208 |
| 209 void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> pr
pSessionDescription, PassRefPtr<VoidCallback> successCallback, PassOwnPtr<RTCErr
orCallback> errorCallback, ExceptionState& exceptionState) | 209 void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> pr
pSessionDescription, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErr
orCallback> errorCallback, ExceptionState& exceptionState) |
| 210 { | 210 { |
| 211 if (m_signalingState == SignalingStateClosed) { | 211 if (m_signalingState == SignalingStateClosed) { |
| 212 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); | 212 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 213 return; | 213 return; |
| 214 } | 214 } |
| 215 | 215 |
| 216 RefPtr<RTCSessionDescription> sessionDescription = prpSessionDescription; | 216 RefPtr<RTCSessionDescription> sessionDescription = prpSessionDescription; |
| 217 if (!sessionDescription) { | 217 if (!sessionDescription) { |
| 218 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); | 218 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 219 return; | 219 return; |
| 220 } | 220 } |
| 221 | 221 |
| 222 RefPtr<RTCVoidRequestImpl> request = RTCVoidRequestImpl::create(executionCon
text(), successCallback, errorCallback); | 222 RefPtr<RTCVoidRequestImpl> request = RTCVoidRequestImpl::create(executionCon
text(), successCallback, errorCallback); |
| 223 m_peerHandler->setLocalDescription(request.release(), sessionDescription->we
bSessionDescription()); | 223 m_peerHandler->setLocalDescription(request.release(), sessionDescription->we
bSessionDescription()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 PassRefPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionS
tate& exceptionState) | 226 PassRefPtr<RTCSessionDescription> RTCPeerConnection::localDescription(ExceptionS
tate& exceptionState) |
| 227 { | 227 { |
| 228 blink::WebRTCSessionDescription webSessionDescription = m_peerHandler->local
Description(); | 228 blink::WebRTCSessionDescription webSessionDescription = m_peerHandler->local
Description(); |
| 229 if (webSessionDescription.isNull()) | 229 if (webSessionDescription.isNull()) |
| 230 return 0; | 230 return 0; |
| 231 | 231 |
| 232 RefPtr<RTCSessionDescription> sessionDescription = RTCSessionDescription::cr
eate(webSessionDescription); | 232 RefPtr<RTCSessionDescription> sessionDescription = RTCSessionDescription::cr
eate(webSessionDescription); |
| 233 return sessionDescription.release(); | 233 return sessionDescription.release(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void RTCPeerConnection::setRemoteDescription(PassRefPtr<RTCSessionDescription> p
rpSessionDescription, PassRefPtr<VoidCallback> successCallback, PassOwnPtr<RTCEr
rorCallback> errorCallback, ExceptionState& exceptionState) | 236 void RTCPeerConnection::setRemoteDescription(PassRefPtr<RTCSessionDescription> p
rpSessionDescription, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCEr
rorCallback> errorCallback, ExceptionState& exceptionState) |
| 237 { | 237 { |
| 238 if (m_signalingState == SignalingStateClosed) { | 238 if (m_signalingState == SignalingStateClosed) { |
| 239 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); | 239 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 240 return; | 240 return; |
| 241 } | 241 } |
| 242 | 242 |
| 243 RefPtr<RTCSessionDescription> sessionDescription = prpSessionDescription; | 243 RefPtr<RTCSessionDescription> sessionDescription = prpSessionDescription; |
| 244 if (!sessionDescription) { | 244 if (!sessionDescription) { |
| 245 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); | 245 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 246 return; | 246 return; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 if (!iceCandidate) { | 290 if (!iceCandidate) { |
| 291 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); | 291 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 292 return; | 292 return; |
| 293 } | 293 } |
| 294 | 294 |
| 295 bool valid = m_peerHandler->addIceCandidate(iceCandidate->webCandidate()); | 295 bool valid = m_peerHandler->addIceCandidate(iceCandidate->webCandidate()); |
| 296 if (!valid) | 296 if (!valid) |
| 297 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError); | 297 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError); |
| 298 } | 298 } |
| 299 | 299 |
| 300 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, PassRefPt
r<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> errorCallback, Exc
eptionState& exceptionState) | 300 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, PassOwnPt
r<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> errorCallback, Exc
eptionState& exceptionState) |
| 301 { | 301 { |
| 302 if (m_signalingState == SignalingStateClosed) { | 302 if (m_signalingState == SignalingStateClosed) { |
| 303 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); | 303 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 304 return; | 304 return; |
| 305 } | 305 } |
| 306 | 306 |
| 307 if (!iceCandidate || !successCallback || !errorCallback) { | 307 if (!iceCandidate || !successCallback || !errorCallback) { |
| 308 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); | 308 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 309 return; | 309 return; |
| 310 } | 310 } |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 events.swap(m_scheduledEvents); | 686 events.swap(m_scheduledEvents); |
| 687 | 687 |
| 688 Vector<RefPtr<Event> >::iterator it = events.begin(); | 688 Vector<RefPtr<Event> >::iterator it = events.begin(); |
| 689 for (; it != events.end(); ++it) | 689 for (; it != events.end(); ++it) |
| 690 dispatchEvent((*it).release()); | 690 dispatchEvent((*it).release()); |
| 691 | 691 |
| 692 events.clear(); | 692 events.clear(); |
| 693 } | 693 } |
| 694 | 694 |
| 695 } // namespace WebCore | 695 } // namespace WebCore |
| OLD | NEW |