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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 document->frame()->loader()->client()->dispatchWillStartUsingPeerConnectionH
andler(m_peerHandler.get()); | 155 document->frame()->loader()->client()->dispatchWillStartUsingPeerConnectionH
andler(m_peerHandler.get()); |
156 | 156 |
157 if (!m_peerHandler->initialize(configuration, constraints)) { | 157 if (!m_peerHandler->initialize(configuration, constraints)) { |
158 ec = NOT_SUPPORTED_ERR; | 158 ec = NOT_SUPPORTED_ERR; |
159 return; | 159 return; |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 RTCPeerConnection::~RTCPeerConnection() | 163 RTCPeerConnection::~RTCPeerConnection() |
164 { | 164 { |
| 165 stop(); |
165 } | 166 } |
166 | 167 |
167 void RTCPeerConnection::createOffer(PassRefPtr<RTCSessionDescriptionCallback> su
ccessCallback, PassRefPtr<RTCErrorCallback> errorCallback, const Dictionary& med
iaConstraints, ExceptionCode& ec) | 168 void RTCPeerConnection::createOffer(PassRefPtr<RTCSessionDescriptionCallback> su
ccessCallback, PassRefPtr<RTCErrorCallback> errorCallback, const Dictionary& med
iaConstraints, ExceptionCode& ec) |
168 { | 169 { |
169 if (m_signalingState == SignalingStateClosed) { | 170 if (m_signalingState == SignalingStateClosed) { |
170 ec = INVALID_STATE_ERR; | 171 ec = INVALID_STATE_ERR; |
171 return; | 172 return; |
172 } | 173 } |
173 | 174 |
174 if (!successCallback) { | 175 if (!successCallback) { |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 return eventNames().interfaceForRTCPeerConnection; | 584 return eventNames().interfaceForRTCPeerConnection; |
584 } | 585 } |
585 | 586 |
586 ScriptExecutionContext* RTCPeerConnection::scriptExecutionContext() const | 587 ScriptExecutionContext* RTCPeerConnection::scriptExecutionContext() const |
587 { | 588 { |
588 return ActiveDOMObject::scriptExecutionContext(); | 589 return ActiveDOMObject::scriptExecutionContext(); |
589 } | 590 } |
590 | 591 |
591 void RTCPeerConnection::stop() | 592 void RTCPeerConnection::stop() |
592 { | 593 { |
| 594 if (m_stopped) |
| 595 return; |
| 596 |
593 m_stopped = true; | 597 m_stopped = true; |
594 m_iceConnectionState = IceConnectionStateClosed; | 598 m_iceConnectionState = IceConnectionStateClosed; |
595 m_signalingState = SignalingStateClosed; | 599 m_signalingState = SignalingStateClosed; |
596 | 600 |
597 Vector<RefPtr<RTCDataChannel> >::iterator i = m_dataChannels.begin(); | 601 Vector<RefPtr<RTCDataChannel> >::iterator i = m_dataChannels.begin(); |
598 for (; i != m_dataChannels.end(); ++i) | 602 for (; i != m_dataChannels.end(); ++i) |
599 (*i)->stop(); | 603 (*i)->stop(); |
600 } | 604 } |
601 | 605 |
602 EventTargetData* RTCPeerConnection::eventTargetData() | 606 EventTargetData* RTCPeerConnection::eventTargetData() |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 Vector<RefPtr<Event> >::iterator it = events.begin(); | 651 Vector<RefPtr<Event> >::iterator it = events.begin(); |
648 for (; it != events.end(); ++it) | 652 for (; it != events.end(); ++it) |
649 dispatchEvent((*it).release()); | 653 dispatchEvent((*it).release()); |
650 | 654 |
651 events.clear(); | 655 events.clear(); |
652 } | 656 } |
653 | 657 |
654 } // namespace WebCore | 658 } // namespace WebCore |
655 | 659 |
656 #endif // ENABLE(MEDIA_STREAM) | 660 #endif // ENABLE(MEDIA_STREAM) |
OLD | NEW |