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

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

Issue 472163002: Add method to notify blink when PeerConnection is closed in Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rename Created 6 years, 4 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
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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 if (exceptionState.hadException()) 599 if (exceptionState.hadException())
600 return nullptr; 600 return nullptr;
601 return dtmfSender; 601 return dtmfSender;
602 } 602 }
603 603
604 void RTCPeerConnection::close(ExceptionState& exceptionState) 604 void RTCPeerConnection::close(ExceptionState& exceptionState)
605 { 605 {
606 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState)) 606 if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
607 return; 607 return;
608 608
609 m_peerHandler->stop(); 609 closeInternal();
610 m_closed = true;
611
612 changeIceConnectionState(ICEConnectionStateClosed);
613 changeIceGatheringState(ICEGatheringStateComplete);
614 changeSignalingState(SignalingStateClosed);
615 } 610 }
616 611
617 void RTCPeerConnection::negotiationNeeded() 612 void RTCPeerConnection::negotiationNeeded()
618 { 613 {
619 ASSERT(!m_closed); 614 ASSERT(!m_closed);
620 scheduleDispatchEvent(Event::create(EventTypeNames::negotiationneeded)); 615 scheduleDispatchEvent(Event::create(EventTypeNames::negotiationneeded));
621 } 616 }
622 617
623 void RTCPeerConnection::didGenerateICECandidate(const WebRTCICECandidate& webCan didate) 618 void RTCPeerConnection::didGenerateICECandidate(const WebRTCICECandidate& webCan didate)
624 { 619 {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 m_dataChannels.append(channel); 695 m_dataChannels.append(channel);
701 696
702 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne l, false, false, channel)); 697 scheduleDispatchEvent(RTCDataChannelEvent::create(EventTypeNames::datachanne l, false, false, channel));
703 } 698 }
704 699
705 void RTCPeerConnection::releasePeerConnectionHandler() 700 void RTCPeerConnection::releasePeerConnectionHandler()
706 { 701 {
707 stop(); 702 stop();
708 } 703 }
709 704
705 void RTCPeerConnection::closePeerConnection()
706 {
707 ASSERT(m_signalingState != RTCPeerConnection::SignalingStateClosed);
708 closeInternal();
709 }
710
710 const AtomicString& RTCPeerConnection::interfaceName() const 711 const AtomicString& RTCPeerConnection::interfaceName() const
711 { 712 {
712 return EventTargetNames::RTCPeerConnection; 713 return EventTargetNames::RTCPeerConnection;
713 } 714 }
714 715
715 ExecutionContext* RTCPeerConnection::executionContext() const 716 ExecutionContext* RTCPeerConnection::executionContext() const
716 { 717 {
717 return ActiveDOMObject::executionContext(); 718 return ActiveDOMObject::executionContext();
718 } 719 }
719 720
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 761 }
761 762
762 void RTCPeerConnection::changeIceConnectionState(ICEConnectionState iceConnectio nState) 763 void RTCPeerConnection::changeIceConnectionState(ICEConnectionState iceConnectio nState)
763 { 764 {
764 if (m_iceConnectionState != ICEConnectionStateClosed && m_iceConnectionState != iceConnectionState) { 765 if (m_iceConnectionState != ICEConnectionStateClosed && m_iceConnectionState != iceConnectionState) {
765 m_iceConnectionState = iceConnectionState; 766 m_iceConnectionState = iceConnectionState;
766 scheduleDispatchEvent(Event::create(EventTypeNames::iceconnectionstatech ange)); 767 scheduleDispatchEvent(Event::create(EventTypeNames::iceconnectionstatech ange));
767 } 768 }
768 } 769 }
769 770
771 void RTCPeerConnection::closeInternal()
772 {
773 ASSERT(m_signalingState != RTCPeerConnection::SignalingStateClosed);
774 m_peerHandler->stop();
775 m_closed = true;
776
777 changeIceConnectionState(ICEConnectionStateClosed);
778 changeIceGatheringState(ICEGatheringStateComplete);
779 changeSignalingState(SignalingStateClosed);
780 }
781
770 void RTCPeerConnection::scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event> even t) 782 void RTCPeerConnection::scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event> even t)
771 { 783 {
772 m_scheduledEvents.append(event); 784 m_scheduledEvents.append(event);
773 785
774 m_dispatchScheduledEventRunner.runAsync(); 786 m_dispatchScheduledEventRunner.runAsync();
775 } 787 }
776 788
777 void RTCPeerConnection::dispatchScheduledEvent() 789 void RTCPeerConnection::dispatchScheduledEvent()
778 { 790 {
779 if (m_stopped) 791 if (m_stopped)
(...skipping 14 matching lines...) Expand all
794 visitor->trace(m_localStreams); 806 visitor->trace(m_localStreams);
795 visitor->trace(m_remoteStreams); 807 visitor->trace(m_remoteStreams);
796 visitor->trace(m_dataChannels); 808 visitor->trace(m_dataChannels);
797 #if ENABLE(OILPAN) 809 #if ENABLE(OILPAN)
798 visitor->trace(m_scheduledEvents); 810 visitor->trace(m_scheduledEvents);
799 #endif 811 #endif
800 EventTargetWithInlineData::trace(visitor); 812 EventTargetWithInlineData::trace(visitor);
801 } 813 }
802 814
803 } // namespace blink 815 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/mediastream/RTCPeerConnection.h ('k') | public/platform/WebRTCPeerConnectionHandlerClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698