| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return; | 213 return; |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 RTCPeerConnection::~RTCPeerConnection() | 217 RTCPeerConnection::~RTCPeerConnection() |
| 218 { | 218 { |
| 219 // This checks that close() or stop() is called before the destructor. | 219 // This checks that close() or stop() is called before the destructor. |
| 220 // We are assuming that a wrapper is always created when RTCPeerConnection i
s created. | 220 // We are assuming that a wrapper is always created when RTCPeerConnection i
s created. |
| 221 ASSERT(m_closed || m_stopped); | 221 ASSERT(m_closed || m_stopped); |
| 222 | 222 |
| 223 // FIXME: Oilpan: We can't call stop here since it touches m_dataChannels. | 223 #if !ENABLE(OILPAN) |
| 224 // Another way to ensure that data channels are stopped at RTCPeerConnection | |
| 225 // destruction is needed. | |
| 226 stop(); | 224 stop(); |
| 225 #endif |
| 227 } | 226 } |
| 228 | 227 |
| 229 void RTCPeerConnection::createOffer(PassOwnPtr<RTCSessionDescriptionCallback> su
ccessCallback, PassOwnPtr<RTCErrorCallback> errorCallback, const Dictionary& med
iaConstraints, ExceptionState& exceptionState) | 228 void RTCPeerConnection::createOffer(PassOwnPtr<RTCSessionDescriptionCallback> su
ccessCallback, PassOwnPtr<RTCErrorCallback> errorCallback, const Dictionary& med
iaConstraints, ExceptionState& exceptionState) |
| 230 { | 229 { |
| 231 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) | 230 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) |
| 232 return; | 231 return; |
| 233 | 232 |
| 234 ASSERT(successCallback); | 233 ASSERT(successCallback); |
| 235 | 234 |
| 236 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC
onstraints, exceptionState); | 235 blink::WebMediaConstraints constraints = MediaConstraintsImpl::create(mediaC
onstraints, exceptionState); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 init.id = value; | 507 init.id = value; |
| 509 if (options.get("maxRetransmits", value)) | 508 if (options.get("maxRetransmits", value)) |
| 510 init.maxRetransmits = value; | 509 init.maxRetransmits = value; |
| 511 if (options.get("maxRetransmitTime", value)) | 510 if (options.get("maxRetransmitTime", value)) |
| 512 init.maxRetransmitTime = value; | 511 init.maxRetransmitTime = value; |
| 513 | 512 |
| 514 String protocolString; | 513 String protocolString; |
| 515 options.get("protocol", protocolString); | 514 options.get("protocol", protocolString); |
| 516 init.protocol = protocolString; | 515 init.protocol = protocolString; |
| 517 | 516 |
| 518 RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executio
nContext(), m_peerHandler.get(), label, init, exceptionState); | 517 RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executio
nContext(), this, m_peerHandler.get(), label, init, exceptionState); |
| 519 if (exceptionState.hadException()) | 518 if (exceptionState.hadException()) |
| 520 return nullptr; | 519 return nullptr; |
| 521 m_dataChannels.append(channel); | 520 m_dataChannels.append(channel); |
| 522 return channel.release(); | 521 return channel.release(); |
| 523 } | 522 } |
| 524 | 523 |
| 525 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId) | 524 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId) |
| 526 { | 525 { |
| 527 for (MediaStreamVector::iterator iter = m_localStreams.begin(); iter != m_lo
calStreams.end(); ++iter) { | 526 for (MediaStreamVector::iterator iter = m_localStreams.begin(); iter != m_lo
calStreams.end(); ++iter) { |
| 528 if ((*iter)->getTrackById(trackId)) | 527 if ((*iter)->getTrackById(trackId)) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 641 } |
| 643 | 642 |
| 644 void RTCPeerConnection::didAddRemoteDataChannel(blink::WebRTCDataChannelHandler*
handler) | 643 void RTCPeerConnection::didAddRemoteDataChannel(blink::WebRTCDataChannelHandler*
handler) |
| 645 { | 644 { |
| 646 ASSERT(!m_closed); | 645 ASSERT(!m_closed); |
| 647 ASSERT(executionContext()->isContextThread()); | 646 ASSERT(executionContext()->isContextThread()); |
| 648 | 647 |
| 649 if (m_signalingState == SignalingStateClosed) | 648 if (m_signalingState == SignalingStateClosed) |
| 650 return; | 649 return; |
| 651 | 650 |
| 652 RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executio
nContext(), adoptPtr(handler)); | 651 RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executio
nContext(), this, adoptPtr(handler)); |
| 653 m_dataChannels.append(channel); | 652 m_dataChannels.append(channel); |
| 654 | 653 |
| 655 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne
l, false, false, channel.release())); | 654 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne
l, false, false, channel.release())); |
| 656 } | 655 } |
| 657 | 656 |
| 658 void RTCPeerConnection::releasePeerConnectionHandler() | 657 void RTCPeerConnection::releasePeerConnectionHandler() |
| 659 { | 658 { |
| 660 stop(); | 659 stop(); |
| 661 } | 660 } |
| 662 | 661 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 void RTCPeerConnection::trace(Visitor* visitor) | 744 void RTCPeerConnection::trace(Visitor* visitor) |
| 746 { | 745 { |
| 747 visitor->trace(m_localStreams); | 746 visitor->trace(m_localStreams); |
| 748 visitor->trace(m_remoteStreams); | 747 visitor->trace(m_remoteStreams); |
| 749 visitor->trace(m_dataChannels); | 748 visitor->trace(m_dataChannels); |
| 750 visitor->trace(m_scheduledEvents); | 749 visitor->trace(m_scheduledEvents); |
| 751 EventTargetWithInlineData::trace(visitor); | 750 EventTargetWithInlineData::trace(visitor); |
| 752 } | 751 } |
| 753 | 752 |
| 754 } // namespace WebCore | 753 } // namespace WebCore |
| OLD | NEW |