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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class RTCDataChannel; | 50 class RTCDataChannel; |
51 class RTCErrorCallback; | 51 class RTCErrorCallback; |
52 class RTCOfferOptions; | 52 class RTCOfferOptions; |
53 class RTCSessionDescription; | 53 class RTCSessionDescription; |
54 class RTCSessionDescriptionCallback; | 54 class RTCSessionDescriptionCallback; |
55 class RTCStatsCallback; | 55 class RTCStatsCallback; |
56 class VoidCallback; | 56 class VoidCallback; |
57 | 57 |
58 class RTCPeerConnection FINAL | 58 class RTCPeerConnection FINAL |
59 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<RTCPeerCo
nnection> | 59 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<RTCPeerCo
nnection> |
60 , public blink::WebRTCPeerConnectionHandlerClient | 60 , public WebRTCPeerConnectionHandlerClient |
61 , public EventTargetWithInlineData | 61 , public EventTargetWithInlineData |
62 , public ActiveDOMObject { | 62 , public ActiveDOMObject { |
63 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollectedWi
llBeGarbageCollectedFinalized<RTCPeerConnection>); | 63 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollectedWi
llBeGarbageCollectedFinalized<RTCPeerConnection>); |
64 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RTCPeerConnection); | 64 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RTCPeerConnection); |
65 public: | 65 public: |
66 static RTCPeerConnection* create(ExecutionContext*, const Dictionary&, const
Dictionary&, ExceptionState&); | 66 static RTCPeerConnection* create(ExecutionContext*, const Dictionary&, const
Dictionary&, ExceptionState&); |
67 virtual ~RTCPeerConnection(); | 67 virtual ~RTCPeerConnection(); |
68 | 68 |
69 void createOffer(PassOwnPtr<RTCSessionDescriptionCallback>, PassOwnPtr<RTCEr
rorCallback>, const Dictionary&, ExceptionState&); | 69 void createOffer(PassOwnPtr<RTCSessionDescriptionCallback>, PassOwnPtr<RTCEr
rorCallback>, const Dictionary&, ExceptionState&); |
70 | 70 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 bool shouldFireGetStatsCallback() { return !m_stopped; } | 112 bool shouldFireGetStatsCallback() { return !m_stopped; } |
113 | 113 |
114 DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded); | 114 DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded); |
115 DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); | 115 DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); |
116 DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange); | 116 DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange); |
117 DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); | 117 DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); |
118 DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); | 118 DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); |
119 DEFINE_ATTRIBUTE_EVENT_LISTENER(iceconnectionstatechange); | 119 DEFINE_ATTRIBUTE_EVENT_LISTENER(iceconnectionstatechange); |
120 DEFINE_ATTRIBUTE_EVENT_LISTENER(datachannel); | 120 DEFINE_ATTRIBUTE_EVENT_LISTENER(datachannel); |
121 | 121 |
122 // blink::WebRTCPeerConnectionHandlerClient | 122 // WebRTCPeerConnectionHandlerClient |
123 virtual void negotiationNeeded() OVERRIDE; | 123 virtual void negotiationNeeded() OVERRIDE; |
124 virtual void didGenerateICECandidate(const blink::WebRTCICECandidate&) OVERR
IDE; | 124 virtual void didGenerateICECandidate(const WebRTCICECandidate&) OVERRIDE; |
125 virtual void didChangeSignalingState(SignalingState) OVERRIDE; | 125 virtual void didChangeSignalingState(SignalingState) OVERRIDE; |
126 virtual void didChangeICEGatheringState(ICEGatheringState) OVERRIDE; | 126 virtual void didChangeICEGatheringState(ICEGatheringState) OVERRIDE; |
127 virtual void didChangeICEConnectionState(ICEConnectionState) OVERRIDE; | 127 virtual void didChangeICEConnectionState(ICEConnectionState) OVERRIDE; |
128 virtual void didAddRemoteStream(const blink::WebMediaStream&) OVERRIDE; | 128 virtual void didAddRemoteStream(const WebMediaStream&) OVERRIDE; |
129 virtual void didRemoveRemoteStream(const blink::WebMediaStream&) OVERRIDE; | 129 virtual void didRemoveRemoteStream(const WebMediaStream&) OVERRIDE; |
130 virtual void didAddRemoteDataChannel(blink::WebRTCDataChannelHandler*) OVERR
IDE; | 130 virtual void didAddRemoteDataChannel(WebRTCDataChannelHandler*) OVERRIDE; |
131 virtual void releasePeerConnectionHandler() OVERRIDE; | 131 virtual void releasePeerConnectionHandler() OVERRIDE; |
132 | 132 |
133 // EventTarget | 133 // EventTarget |
134 virtual const AtomicString& interfaceName() const OVERRIDE; | 134 virtual const AtomicString& interfaceName() const OVERRIDE; |
135 virtual ExecutionContext* executionContext() const OVERRIDE; | 135 virtual ExecutionContext* executionContext() const OVERRIDE; |
136 | 136 |
137 // ActiveDOMObject | 137 // ActiveDOMObject |
138 virtual void suspend() OVERRIDE; | 138 virtual void suspend() OVERRIDE; |
139 virtual void resume() OVERRIDE; | 139 virtual void resume() OVERRIDE; |
140 virtual void stop() OVERRIDE; | 140 virtual void stop() OVERRIDE; |
141 // We keep the this object alive until either stopped or closed. | 141 // We keep the this object alive until either stopped or closed. |
142 virtual bool hasPendingActivity() const OVERRIDE | 142 virtual bool hasPendingActivity() const OVERRIDE |
143 { | 143 { |
144 return !m_closed && !m_stopped; | 144 return !m_closed && !m_stopped; |
145 } | 145 } |
146 | 146 |
147 virtual void trace(Visitor*) OVERRIDE; | 147 virtual void trace(Visitor*) OVERRIDE; |
148 | 148 |
149 private: | 149 private: |
150 RTCPeerConnection(ExecutionContext*, PassRefPtr<RTCConfiguration>, blink::We
bMediaConstraints, ExceptionState&); | 150 RTCPeerConnection(ExecutionContext*, PassRefPtr<RTCConfiguration>, WebMediaC
onstraints, ExceptionState&); |
151 | 151 |
152 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary&, Ex
ceptionState&); | 152 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary&, Ex
ceptionState&); |
153 static PassRefPtr<RTCOfferOptions> parseOfferOptions(const Dictionary&, Exce
ptionState&); | 153 static PassRefPtr<RTCOfferOptions> parseOfferOptions(const Dictionary&, Exce
ptionState&); |
154 | 154 |
155 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 155 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
156 void dispatchScheduledEvent(); | 156 void dispatchScheduledEvent(); |
157 bool hasLocalStreamWithTrackId(const String& trackId); | 157 bool hasLocalStreamWithTrackId(const String& trackId); |
158 | 158 |
159 void changeSignalingState(blink::WebRTCPeerConnectionHandlerClient::Signalin
gState); | 159 void changeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState)
; |
160 void changeIceGatheringState(blink::WebRTCPeerConnectionHandlerClient::ICEGa
theringState); | 160 void changeIceGatheringState(WebRTCPeerConnectionHandlerClient::ICEGathering
State); |
161 void changeIceConnectionState(blink::WebRTCPeerConnectionHandlerClient::ICEC
onnectionState); | 161 void changeIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnecti
onState); |
162 | 162 |
163 SignalingState m_signalingState; | 163 SignalingState m_signalingState; |
164 ICEGatheringState m_iceGatheringState; | 164 ICEGatheringState m_iceGatheringState; |
165 ICEConnectionState m_iceConnectionState; | 165 ICEConnectionState m_iceConnectionState; |
166 | 166 |
167 MediaStreamVector m_localStreams; | 167 MediaStreamVector m_localStreams; |
168 MediaStreamVector m_remoteStreams; | 168 MediaStreamVector m_remoteStreams; |
169 | 169 |
170 HeapVector<Member<RTCDataChannel> > m_dataChannels; | 170 HeapVector<Member<RTCDataChannel> > m_dataChannels; |
171 | 171 |
172 OwnPtr<blink::WebRTCPeerConnectionHandler> m_peerHandler; | 172 OwnPtr<WebRTCPeerConnectionHandler> m_peerHandler; |
173 | 173 |
174 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; | 174 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; |
175 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; | 175 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; |
176 | 176 |
177 bool m_stopped; | 177 bool m_stopped; |
178 bool m_closed; | 178 bool m_closed; |
179 }; | 179 }; |
180 | 180 |
181 } // namespace blink | 181 } // namespace blink |
182 | 182 |
183 #endif // RTCPeerConnection_h | 183 #endif // RTCPeerConnection_h |
OLD | NEW |