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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.h

Issue 1523213002: Make sure peer connection states are updated properly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 26 matching lines...) Expand all
37 #include "modules/EventTargetModules.h" 37 #include "modules/EventTargetModules.h"
38 #include "modules/crypto/NormalizeAlgorithm.h" 38 #include "modules/crypto/NormalizeAlgorithm.h"
39 #include "modules/mediastream/MediaStream.h" 39 #include "modules/mediastream/MediaStream.h"
40 #include "modules/mediastream/RTCIceCandidate.h" 40 #include "modules/mediastream/RTCIceCandidate.h"
41 #include "platform/AsyncMethodRunner.h" 41 #include "platform/AsyncMethodRunner.h"
42 #include "public/platform/WebMediaConstraints.h" 42 #include "public/platform/WebMediaConstraints.h"
43 #include "public/platform/WebRTCPeerConnectionHandler.h" 43 #include "public/platform/WebRTCPeerConnectionHandler.h"
44 #include "public/platform/WebRTCPeerConnectionHandlerClient.h" 44 #include "public/platform/WebRTCPeerConnectionHandlerClient.h"
45 45
46 namespace blink { 46 namespace blink {
47
48 class ExceptionState; 47 class ExceptionState;
49 class MediaStreamTrack; 48 class MediaStreamTrack;
50 class RTCConfiguration; 49 class RTCConfiguration;
51 class RTCDTMFSender; 50 class RTCDTMFSender;
52 class RTCDataChannel; 51 class RTCDataChannel;
53 class RTCErrorCallback; 52 class RTCErrorCallback;
54 class RTCOfferOptions; 53 class RTCOfferOptions;
55 class RTCSessionDescription; 54 class RTCSessionDescription;
56 class RTCSessionDescriptionCallback; 55 class RTCSessionDescriptionCallback;
57 class RTCStatsCallback; 56 class RTCStatsCallback;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bool hasPendingActivity() const override 148 bool hasPendingActivity() const override
150 { 149 {
151 return !m_closed && !m_stopped; 150 return !m_closed && !m_stopped;
152 } 151 }
153 152
154 // Oilpan: need to eagerly finalize m_peerHandler 153 // Oilpan: need to eagerly finalize m_peerHandler
155 EAGERLY_FINALIZE(); 154 EAGERLY_FINALIZE();
156 DECLARE_VIRTUAL_TRACE(); 155 DECLARE_VIRTUAL_TRACE();
157 156
158 private: 157 private:
158 typedef Function<bool()> BoolFunction;
159 class EventWrapper {
160 public:
161 EventWrapper(PassRefPtrWillBeRawPtr<Event>, PassOwnPtrWillBeRawPtr<BoolF unction>);
162 // Returns true if |m_setupFunction| returns true or it is null.
163 // |m_event| will only be fired if setup() returns true;
164 bool setup();
165
166 RefPtrWillBeMember<Event> m_event;
167
168 private:
169 PassOwnPtrWillBeRawPtr<BoolFunction> m_setupFunction;
170 };
171
159 RTCPeerConnection(ExecutionContext*, RTCConfiguration*, WebMediaConstraints, ExceptionState&); 172 RTCPeerConnection(ExecutionContext*, RTCConfiguration*, WebMediaConstraints, ExceptionState&);
160 173
161 static RTCConfiguration* parseConfiguration(const Dictionary&, ExceptionStat e&); 174 static RTCConfiguration* parseConfiguration(const Dictionary&, ExceptionStat e&);
162 static RTCOfferOptions* parseOfferOptions(const Dictionary&, ExceptionState& ); 175 static RTCOfferOptions* parseOfferOptions(const Dictionary&, ExceptionState& );
163 176
164 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); 177 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>);
178 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>, PassOwnPtrWillBeRa wPtr<BoolFunction>);
165 void dispatchScheduledEvent(); 179 void dispatchScheduledEvent();
166 bool hasLocalStreamWithTrackId(const String& trackId); 180 bool hasLocalStreamWithTrackId(const String& trackId);
167 181
168 void changeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState) ; 182 void changeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState) ;
169 void changeIceGatheringState(WebRTCPeerConnectionHandlerClient::ICEGathering State); 183 void changeIceGatheringState(WebRTCPeerConnectionHandlerClient::ICEGathering State);
184 bool setIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnectionS tate);
pthatcher2 2015/12/15 23:59:20 Can you leave a comment saying something like "set
honghaiz 2015/12/16 00:21:01 Done.
170 void changeIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnecti onState); 185 void changeIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnecti onState);
171 186
172 void closeInternal(); 187 void closeInternal();
173 188
174 SignalingState m_signalingState; 189 SignalingState m_signalingState;
175 ICEGatheringState m_iceGatheringState; 190 ICEGatheringState m_iceGatheringState;
176 ICEConnectionState m_iceConnectionState; 191 ICEConnectionState m_iceConnectionState;
177 192
178 MediaStreamVector m_localStreams; 193 MediaStreamVector m_localStreams;
179 MediaStreamVector m_remoteStreams; 194 MediaStreamVector m_remoteStreams;
180 195
181 HeapVector<Member<RTCDataChannel>> m_dataChannels; 196 HeapVector<Member<RTCDataChannel>> m_dataChannels;
182 197
183 OwnPtr<WebRTCPeerConnectionHandler> m_peerHandler; 198 OwnPtr<WebRTCPeerConnectionHandler> m_peerHandler;
184 199
185 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; 200 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner;
186 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; 201 WillBeHeapVector<EventWrapper> m_scheduledEvents;
187 202
188 bool m_stopped; 203 bool m_stopped;
189 bool m_closed; 204 bool m_closed;
190 }; 205 };
191 206
192 } // namespace blink 207 } // namespace blink
193 208
194 #endif // RTCPeerConnection_h 209 #endif // RTCPeerConnection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698