Chromium Code Reviews| 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 doClose(); |
| 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 blink::WebRTCICECandidate& webCandidate) | 618 void RTCPeerConnection::didGenerateICECandidate(const blink::WebRTCICECandidate& webCandidate) |
| 624 { | 619 { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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() | |
|
jiayl
2014/08/15 16:12:38
We should make sure the PC is not already closed e
vrk (LEFT CHROMIUM)
2014/08/16 00:36:25
Good point. I added a few asserts here. Done.
| |
| 706 { | |
| 707 doClose(); | |
| 708 } | |
| 709 | |
| 710 const AtomicString& RTCPeerConnection::interfaceName() const | 710 const AtomicString& RTCPeerConnection::interfaceName() const |
| 711 { | 711 { |
| 712 return EventTargetNames::RTCPeerConnection; | 712 return EventTargetNames::RTCPeerConnection; |
| 713 } | 713 } |
| 714 | 714 |
| 715 ExecutionContext* RTCPeerConnection::executionContext() const | 715 ExecutionContext* RTCPeerConnection::executionContext() const |
| 716 { | 716 { |
| 717 return ActiveDOMObject::executionContext(); | 717 return ActiveDOMObject::executionContext(); |
| 718 } | 718 } |
| 719 | 719 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 } | 760 } |
| 761 | 761 |
| 762 void RTCPeerConnection::changeIceConnectionState(ICEConnectionState iceConnectio nState) | 762 void RTCPeerConnection::changeIceConnectionState(ICEConnectionState iceConnectio nState) |
| 763 { | 763 { |
| 764 if (m_iceConnectionState != ICEConnectionStateClosed && m_iceConnectionState != iceConnectionState) { | 764 if (m_iceConnectionState != ICEConnectionStateClosed && m_iceConnectionState != iceConnectionState) { |
| 765 m_iceConnectionState = iceConnectionState; | 765 m_iceConnectionState = iceConnectionState; |
| 766 scheduleDispatchEvent(Event::create(EventTypeNames::iceconnectionstatech ange)); | 766 scheduleDispatchEvent(Event::create(EventTypeNames::iceconnectionstatech ange)); |
| 767 } | 767 } |
| 768 } | 768 } |
| 769 | 769 |
| 770 void RTCPeerConnection::doClose() | |
| 771 { | |
| 772 m_peerHandler->stop(); | |
| 773 m_closed = true; | |
| 774 | |
| 775 changeIceConnectionState(ICEConnectionStateClosed); | |
| 776 changeIceGatheringState(ICEGatheringStateComplete); | |
| 777 changeSignalingState(SignalingStateClosed); | |
| 778 } | |
| 779 | |
| 770 void RTCPeerConnection::scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event> even t) | 780 void RTCPeerConnection::scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event> even t) |
| 771 { | 781 { |
| 772 m_scheduledEvents.append(event); | 782 m_scheduledEvents.append(event); |
| 773 | 783 |
| 774 m_dispatchScheduledEventRunner.runAsync(); | 784 m_dispatchScheduledEventRunner.runAsync(); |
| 775 } | 785 } |
| 776 | 786 |
| 777 void RTCPeerConnection::dispatchScheduledEvent() | 787 void RTCPeerConnection::dispatchScheduledEvent() |
| 778 { | 788 { |
| 779 if (m_stopped) | 789 if (m_stopped) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 794 visitor->trace(m_localStreams); | 804 visitor->trace(m_localStreams); |
| 795 visitor->trace(m_remoteStreams); | 805 visitor->trace(m_remoteStreams); |
| 796 visitor->trace(m_dataChannels); | 806 visitor->trace(m_dataChannels); |
| 797 #if ENABLE(OILPAN) | 807 #if ENABLE(OILPAN) |
| 798 visitor->trace(m_scheduledEvents); | 808 visitor->trace(m_scheduledEvents); |
| 799 #endif | 809 #endif |
| 800 EventTargetWithInlineData::trace(visitor); | 810 EventTargetWithInlineData::trace(visitor); |
| 801 } | 811 } |
| 802 | 812 |
| 803 } // namespace blink | 813 } // namespace blink |
| OLD | NEW |