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

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

Issue 177873002: RTCPeerConnection: remove redundant throwing for callback args. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 RTCPeerConnection::~RTCPeerConnection() 209 RTCPeerConnection::~RTCPeerConnection()
210 { 210 {
211 stop(); 211 stop();
212 } 212 }
213 213
214 void RTCPeerConnection::createOffer(PassOwnPtr<RTCSessionDescriptionCallback> su ccessCallback, PassOwnPtr<RTCErrorCallback> errorCallback, const Dictionary& med iaConstraints, ExceptionState& exceptionState) 214 void RTCPeerConnection::createOffer(PassOwnPtr<RTCSessionDescriptionCallback> su ccessCallback, PassOwnPtr<RTCErrorCallback> errorCallback, const Dictionary& med iaConstraints, ExceptionState& exceptionState)
215 { 215 {
216 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 216 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
217 return; 217 return;
218 218
219 if (!successCallback) { 219 ASSERT(successCallback);
220 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a rgumentNullOrIncorrectType(1, "RTCSessionDescriptionCallback"));
221 return;
222 }
223 220
224 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC onstraints, exceptionState); 221 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC onstraints, exceptionState);
225 if (exceptionState.hadException()) 222 if (exceptionState.hadException())
226 return; 223 return;
227 224
228 RefPtr<RTCSessionDescriptionRequest> request = RTCSessionDescriptionRequestI mpl::create(executionContext(), successCallback, errorCallback); 225 RefPtr<RTCSessionDescriptionRequest> request = RTCSessionDescriptionRequestI mpl::create(executionContext(), successCallback, errorCallback);
229 m_peerHandler->createOffer(request.release(), constraints); 226 m_peerHandler->createOffer(request.release(), constraints);
230 } 227 }
231 228
232 void RTCPeerConnection::createAnswer(PassOwnPtr<RTCSessionDescriptionCallback> s uccessCallback, PassOwnPtr<RTCErrorCallback> errorCallback, const Dictionary& me diaConstraints, ExceptionState& exceptionState) 229 void RTCPeerConnection::createAnswer(PassOwnPtr<RTCSessionDescriptionCallback> s uccessCallback, PassOwnPtr<RTCErrorCallback> errorCallback, const Dictionary& me diaConstraints, ExceptionState& exceptionState)
233 { 230 {
234 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 231 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
235 return; 232 return;
236 233
237 if (!successCallback) { 234 ASSERT(successCallback);
238 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a rgumentNullOrIncorrectType(1, "RTCSessionDescriptionCallback"));
239 return;
240 }
241 235
242 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC onstraints, exceptionState); 236 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC onstraints, exceptionState);
243 if (exceptionState.hadException()) 237 if (exceptionState.hadException())
244 return; 238 return;
245 239
246 RefPtr<RTCSessionDescriptionRequest> request = RTCSessionDescriptionRequestI mpl::create(executionContext(), successCallback, errorCallback); 240 RefPtr<RTCSessionDescriptionRequest> request = RTCSessionDescriptionRequestI mpl::create(executionContext(), successCallback, errorCallback);
247 m_peerHandler->createAnswer(request.release(), constraints); 241 m_peerHandler->createAnswer(request.release(), constraints);
248 } 242 }
249 243
250 void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> pr pSessionDescription, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErr orCallback> errorCallback, ExceptionState& exceptionState) 244 void RTCPeerConnection::setLocalDescription(PassRefPtr<RTCSessionDescription> pr pSessionDescription, PassOwnPtr<VoidCallback> successCallback, PassOwnPtr<RTCErr orCallback> errorCallback, ExceptionState& exceptionState)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 326
333 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, PassOwnPt r<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> errorCallback, Exc eptionState& exceptionState) 327 void RTCPeerConnection::addIceCandidate(RTCIceCandidate* iceCandidate, PassOwnPt r<VoidCallback> successCallback, PassOwnPtr<RTCErrorCallback> errorCallback, Exc eptionState& exceptionState)
334 { 328 {
335 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 329 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
336 return; 330 return;
337 331
338 if (!iceCandidate) { 332 if (!iceCandidate) {
339 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a rgumentNullOrIncorrectType(1, "RTCIceCandidate")); 333 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a rgumentNullOrIncorrectType(1, "RTCIceCandidate"));
340 return; 334 return;
341 } 335 }
342 if (!successCallback) { 336 ASSERT(successCallback);
343 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a rgumentNullOrIncorrectType(2, "Function")); 337 ASSERT(errorCallback);
344 return;
345 }
346 if (!errorCallback) {
347 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a rgumentNullOrIncorrectType(3, "RTCErrorCallback"));
348 return;
349 }
350 338
351 RefPtr<RTCVoidRequest> request = RTCVoidRequestImpl::create(executionContext (), successCallback, errorCallback); 339 RefPtr<RTCVoidRequest> request = RTCVoidRequestImpl::create(executionContext (), successCallback, errorCallback);
352 340
353 bool implemented = m_peerHandler->addICECandidate(request.release(), iceCand idate->webCandidate()); 341 bool implemented = m_peerHandler->addICECandidate(request.release(), iceCand idate->webCandidate());
354 if (!implemented) 342 if (!implemented)
355 exceptionState.throwDOMException(NotSupportedError, "This method is not yet implemented."); 343 exceptionState.throwDOMException(NotSupportedError, "This method is not yet implemented.");
356 } 344 }
357 345
358 String RTCPeerConnection::signalingState() const 346 String RTCPeerConnection::signalingState() const
359 { 347 {
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 events.swap(m_scheduledEvents); 705 events.swap(m_scheduledEvents);
718 706
719 Vector<RefPtr<Event> >::iterator it = events.begin(); 707 Vector<RefPtr<Event> >::iterator it = events.begin();
720 for (; it != events.end(); ++it) 708 for (; it != events.end(); ++it)
721 dispatchEvent((*it).release()); 709 dispatchEvent((*it).release());
722 710
723 events.clear(); 711 events.clear();
724 } 712 }
725 713
726 } // namespace WebCore 714 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698