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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void removeStream(PassRefPtrWillBeRawPtr<MediaStream>, ExceptionState&); | 97 void removeStream(PassRefPtrWillBeRawPtr<MediaStream>, ExceptionState&); |
98 | 98 |
99 void getStats(PassOwnPtr<RTCStatsCallback> successCallback, PassRefPtr<Media
StreamTrack> selector); | 99 void getStats(PassOwnPtr<RTCStatsCallback> successCallback, PassRefPtr<Media
StreamTrack> selector); |
100 | 100 |
101 PassRefPtrWillBeRawPtr<RTCDataChannel> createDataChannel(String label, const
Dictionary& dataChannelDict, ExceptionState&); | 101 PassRefPtrWillBeRawPtr<RTCDataChannel> createDataChannel(String label, const
Dictionary& dataChannelDict, ExceptionState&); |
102 | 102 |
103 PassRefPtrWillBeRawPtr<RTCDTMFSender> createDTMFSender(PassRefPtrWillBeRawPt
r<MediaStreamTrack>, ExceptionState&); | 103 PassRefPtrWillBeRawPtr<RTCDTMFSender> createDTMFSender(PassRefPtrWillBeRawPt
r<MediaStreamTrack>, ExceptionState&); |
104 | 104 |
105 void close(ExceptionState&); | 105 void close(ExceptionState&); |
106 | 106 |
| 107 // We allow getStats after close, but not other calls or callbacks. |
| 108 bool shouldFireDefaultCallbacks() { return !m_closed && !m_stopped; } |
| 109 bool shouldFireGetStatsCallback() { return !m_stopped; } |
| 110 |
107 DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded); | 111 DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded); |
108 DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); | 112 DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); |
109 DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange); | 113 DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange); |
110 DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); | 114 DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); |
111 DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); | 115 DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); |
112 DEFINE_ATTRIBUTE_EVENT_LISTENER(iceconnectionstatechange); | 116 DEFINE_ATTRIBUTE_EVENT_LISTENER(iceconnectionstatechange); |
113 DEFINE_ATTRIBUTE_EVENT_LISTENER(datachannel); | 117 DEFINE_ATTRIBUTE_EVENT_LISTENER(datachannel); |
114 | 118 |
115 // blink::WebRTCPeerConnectionHandlerClient | 119 // blink::WebRTCPeerConnectionHandlerClient |
116 virtual void negotiationNeeded() OVERRIDE; | 120 virtual void negotiationNeeded() OVERRIDE; |
117 virtual void didGenerateICECandidate(const blink::WebRTCICECandidate&) OVERR
IDE; | 121 virtual void didGenerateICECandidate(const blink::WebRTCICECandidate&) OVERR
IDE; |
118 virtual void didChangeSignalingState(SignalingState) OVERRIDE; | 122 virtual void didChangeSignalingState(SignalingState) OVERRIDE; |
119 virtual void didChangeICEGatheringState(ICEGatheringState) OVERRIDE; | 123 virtual void didChangeICEGatheringState(ICEGatheringState) OVERRIDE; |
120 virtual void didChangeICEConnectionState(ICEConnectionState) OVERRIDE; | 124 virtual void didChangeICEConnectionState(ICEConnectionState) OVERRIDE; |
121 virtual void didAddRemoteStream(const blink::WebMediaStream&) OVERRIDE; | 125 virtual void didAddRemoteStream(const blink::WebMediaStream&) OVERRIDE; |
122 virtual void didRemoveRemoteStream(const blink::WebMediaStream&) OVERRIDE; | 126 virtual void didRemoveRemoteStream(const blink::WebMediaStream&) OVERRIDE; |
123 virtual void didAddRemoteDataChannel(blink::WebRTCDataChannelHandler*) OVERR
IDE; | 127 virtual void didAddRemoteDataChannel(blink::WebRTCDataChannelHandler*) OVERR
IDE; |
124 virtual void releasePeerConnectionHandler() OVERRIDE; | 128 virtual void releasePeerConnectionHandler() OVERRIDE; |
125 | 129 |
126 // EventTarget | 130 // EventTarget |
127 virtual const AtomicString& interfaceName() const OVERRIDE; | 131 virtual const AtomicString& interfaceName() const OVERRIDE; |
128 virtual ExecutionContext* executionContext() const OVERRIDE; | 132 virtual ExecutionContext* executionContext() const OVERRIDE; |
129 | 133 |
130 // ActiveDOMObject | 134 // ActiveDOMObject |
131 virtual void suspend() OVERRIDE; | 135 virtual void suspend() OVERRIDE; |
132 virtual void resume() OVERRIDE; | 136 virtual void resume() OVERRIDE; |
133 virtual void stop() OVERRIDE; | 137 virtual void stop() OVERRIDE; |
134 virtual bool hasPendingActivity() const OVERRIDE { return !m_stopped; } | 138 // We keep the this object alive until either stopped or closed. |
| 139 virtual bool hasPendingActivity() const OVERRIDE |
| 140 { |
| 141 return !m_closed && !m_stopped; |
| 142 } |
135 | 143 |
136 virtual void trace(Visitor*) OVERRIDE; | 144 virtual void trace(Visitor*) OVERRIDE; |
137 | 145 |
138 private: | 146 private: |
139 RTCPeerConnection(ExecutionContext*, PassRefPtr<RTCConfiguration>, blink::We
bMediaConstraints, ExceptionState&); | 147 RTCPeerConnection(ExecutionContext*, PassRefPtr<RTCConfiguration>, blink::We
bMediaConstraints, ExceptionState&); |
140 | 148 |
141 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary& con
figuration, ExceptionState&); | 149 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary& con
figuration, ExceptionState&); |
142 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 150 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
143 void dispatchScheduledEvent(); | 151 void dispatchScheduledEvent(); |
144 bool hasLocalStreamWithTrackId(const String& trackId); | 152 bool hasLocalStreamWithTrackId(const String& trackId); |
(...skipping 10 matching lines...) Expand all Loading... |
155 MediaStreamVector m_remoteStreams; | 163 MediaStreamVector m_remoteStreams; |
156 | 164 |
157 WillBeHeapVector<RefPtrWillBeMember<RTCDataChannel> > m_dataChannels; | 165 WillBeHeapVector<RefPtrWillBeMember<RTCDataChannel> > m_dataChannels; |
158 | 166 |
159 OwnPtr<blink::WebRTCPeerConnectionHandler> m_peerHandler; | 167 OwnPtr<blink::WebRTCPeerConnectionHandler> m_peerHandler; |
160 | 168 |
161 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; | 169 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; |
162 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; | 170 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; |
163 | 171 |
164 bool m_stopped; | 172 bool m_stopped; |
| 173 bool m_closed; |
165 }; | 174 }; |
166 | 175 |
167 } // namespace WebCore | 176 } // namespace WebCore |
168 | 177 |
169 #endif // RTCPeerConnection_h | 178 #endif // RTCPeerConnection_h |
OLD | NEW |