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

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

Issue 342683002: Oilpan: Use weak processing to stop a closed RTCPeerConnection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed Created 6 years, 6 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 | Annotate | Revision Log
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 for (MediaStreamVector::iterator iter = m_remoteStreams.begin(); iter != m_r emoteStreams.end(); ++iter) { 481 for (MediaStreamVector::iterator iter = m_remoteStreams.begin(); iter != m_r emoteStreams.end(); ++iter) {
483 if ((*iter)->id() == streamId) 482 if ((*iter)->id() == streamId)
484 return iter->get(); 483 return iter->get();
485 } 484 }
486 485
487 return 0; 486 return 0;
488 } 487 }
489 488
490 void RTCPeerConnection::getStats(PassOwnPtr<RTCStatsCallback> successCallback, P assRefPtr<MediaStreamTrack> selector) 489 void RTCPeerConnection::getStats(PassOwnPtr<RTCStatsCallback> successCallback, P assRefPtr<MediaStreamTrack> selector)
491 { 490 {
491 ASSERT(m_peerHandler);
haraken 2014/06/18 09:17:09 What is this ASSERT for?
keishi 2014/06/18 10:48:00 Removed.
492 RefPtr<RTCStatsRequest> statsRequest = RTCStatsRequestImpl::create(execution Context(), this, successCallback, selector); 492 RefPtr<RTCStatsRequest> statsRequest = RTCStatsRequestImpl::create(execution Context(), this, successCallback, selector);
493 // FIXME: Add passing selector as part of the statsRequest. 493 // FIXME: Add passing selector as part of the statsRequest.
494 m_peerHandler->getStats(statsRequest.release()); 494 m_peerHandler->getStats(statsRequest.release());
495 } 495 }
496 496
497 PassRefPtrWillBeRawPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(Stri ng label, const Dictionary& options, ExceptionState& exceptionState) 497 PassRefPtrWillBeRawPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(Stri ng label, const Dictionary& options, ExceptionState& exceptionState)
498 { 498 {
499 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 499 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
500 return nullptr; 500 return nullptr;
501 501
502 blink::WebRTCDataChannelInit init; 502 blink::WebRTCDataChannelInit init;
503 options.get("ordered", init.ordered); 503 options.get("ordered", init.ordered);
504 options.get("negotiated", init.negotiated); 504 options.get("negotiated", init.negotiated);
505 505
506 unsigned short value = 0; 506 unsigned short value = 0;
507 if (options.get("id", value)) 507 if (options.get("id", value))
508 init.id = value; 508 init.id = value;
509 if (options.get("maxRetransmits", value)) 509 if (options.get("maxRetransmits", value))
510 init.maxRetransmits = value; 510 init.maxRetransmits = value;
511 if (options.get("maxRetransmitTime", value)) 511 if (options.get("maxRetransmitTime", value))
512 init.maxRetransmitTime = value; 512 init.maxRetransmitTime = value;
513 513
514 String protocolString; 514 String protocolString;
515 options.get("protocol", protocolString); 515 options.get("protocol", protocolString);
516 init.protocol = protocolString; 516 init.protocol = protocolString;
517 517
518 RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executio nContext(), m_peerHandler.get(), label, init, exceptionState); 518 RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executio nContext(), this, m_peerHandler.get(), label, init, exceptionState);
519 if (exceptionState.hadException()) 519 if (exceptionState.hadException())
520 return nullptr; 520 return nullptr;
521 m_dataChannels.append(channel); 521 m_dataChannels.append(channel);
522 return channel.release(); 522 return channel.release();
523 } 523 }
524 524
525 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId) 525 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId)
526 { 526 {
527 for (MediaStreamVector::iterator iter = m_localStreams.begin(); iter != m_lo calStreams.end(); ++iter) { 527 for (MediaStreamVector::iterator iter = m_localStreams.begin(); iter != m_lo calStreams.end(); ++iter) {
528 if ((*iter)->getTrackById(trackId)) 528 if ((*iter)->getTrackById(trackId))
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } 642 }
643 643
644 void RTCPeerConnection::didAddRemoteDataChannel(blink::WebRTCDataChannelHandler* handler) 644 void RTCPeerConnection::didAddRemoteDataChannel(blink::WebRTCDataChannelHandler* handler)
645 { 645 {
646 ASSERT(!m_closed); 646 ASSERT(!m_closed);
647 ASSERT(executionContext()->isContextThread()); 647 ASSERT(executionContext()->isContextThread());
648 648
649 if (m_signalingState == SignalingStateClosed) 649 if (m_signalingState == SignalingStateClosed)
650 return; 650 return;
651 651
652 RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executio nContext(), adoptPtr(handler)); 652 RefPtrWillBeRawPtr<RTCDataChannel> channel = RTCDataChannel::create(executio nContext(), this, adoptPtr(handler));
653 m_dataChannels.append(channel); 653 m_dataChannels.append(channel);
654 654
655 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne l, false, false, channel.release())); 655 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne l, false, false, channel.release()));
656 } 656 }
657 657
658 void RTCPeerConnection::releasePeerConnectionHandler() 658 void RTCPeerConnection::releasePeerConnectionHandler()
659 { 659 {
660 stop(); 660 stop();
661 } 661 }
662 662
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 void RTCPeerConnection::trace(Visitor* visitor) 745 void RTCPeerConnection::trace(Visitor* visitor)
746 { 746 {
747 visitor->trace(m_localStreams); 747 visitor->trace(m_localStreams);
748 visitor->trace(m_remoteStreams); 748 visitor->trace(m_remoteStreams);
749 visitor->trace(m_dataChannels); 749 visitor->trace(m_dataChannels);
750 visitor->trace(m_scheduledEvents); 750 visitor->trace(m_scheduledEvents);
751 EventTargetWithInlineData::trace(visitor); 751 EventTargetWithInlineData::trace(visitor);
752 } 752 }
753 753
754 } // namespace WebCore 754 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698