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 requestMayFireNonStatsCallback() { return !m_closed && !m_stopped; } | |
109 bool requestMayFireStatsCallback() { return !m_stopped; } | |
haraken
2014/06/17 11:43:45
Nit: I'd rename these methods to shouldFireDefault
Henrik Grunell
2014/06/17 12:12:21
Done.
| |
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 require a call to close() or stop() before the object can be garbage |
139 // collected. In close(), stop() is called on |m_peer_handler|, after which | |
140 // no events are fired on this object | |
141 // (blink::WebRTCPeerConnectionHandlerClient interface). In stop(), | |
142 // |m_peer_handler| is deleted. Note that async operations such as | |
143 // createOffer or getStats doesn't respond through this object, but through | |
144 // a request object containing the callback. The request object is handed to | |
145 // the client. Hence, we don't need to keep track of if there are still | |
146 // outstandning requests. The request is given a pointer to this object and | |
147 // checks if it should fire the callback before doing so. | |
haraken
2014/06/17 11:43:45
Nit: This comment sounds a bit redundant. Can we j
Henrik Grunell
2014/06/17 12:12:21
Done.
| |
148 virtual bool hasPendingActivity() const OVERRIDE | |
149 { | |
150 return !m_closed && !m_stopped; | |
151 } | |
135 | 152 |
136 virtual void trace(Visitor*) OVERRIDE; | 153 virtual void trace(Visitor*) OVERRIDE; |
137 | 154 |
138 private: | 155 private: |
139 RTCPeerConnection(ExecutionContext*, PassRefPtr<RTCConfiguration>, blink::We bMediaConstraints, ExceptionState&); | 156 RTCPeerConnection(ExecutionContext*, PassRefPtr<RTCConfiguration>, blink::We bMediaConstraints, ExceptionState&); |
140 | 157 |
141 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary& con figuration, ExceptionState&); | 158 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary& con figuration, ExceptionState&); |
142 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 159 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
143 void dispatchScheduledEvent(); | 160 void dispatchScheduledEvent(); |
144 bool hasLocalStreamWithTrackId(const String& trackId); | 161 bool hasLocalStreamWithTrackId(const String& trackId); |
(...skipping 10 matching lines...) Expand all Loading... | |
155 MediaStreamVector m_remoteStreams; | 172 MediaStreamVector m_remoteStreams; |
156 | 173 |
157 WillBeHeapVector<RefPtrWillBeMember<RTCDataChannel> > m_dataChannels; | 174 WillBeHeapVector<RefPtrWillBeMember<RTCDataChannel> > m_dataChannels; |
158 | 175 |
159 OwnPtr<blink::WebRTCPeerConnectionHandler> m_peerHandler; | 176 OwnPtr<blink::WebRTCPeerConnectionHandler> m_peerHandler; |
160 | 177 |
161 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; | 178 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; |
162 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; | 179 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; |
163 | 180 |
164 bool m_stopped; | 181 bool m_stopped; |
182 bool m_closed; | |
165 }; | 183 }; |
166 | 184 |
167 } // namespace WebCore | 185 } // namespace WebCore |
168 | 186 |
169 #endif // RTCPeerConnection_h | 187 #endif // RTCPeerConnection_h |
OLD | NEW |