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

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: Added comments 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
haraken 2015/12/17 03:03:20 This is wrong even on non-oilpan... This must be a
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 // Changes the state immediately; does not fire an event.
185 // Returns true if the state was changed.
186 bool setIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnectionS tate);
187 // Changes the state asynchronously and fires an event immediately after cha nging the state.
170 void changeIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnecti onState); 188 void changeIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnecti onState);
171 189
172 void closeInternal(); 190 void closeInternal();
173 191
174 SignalingState m_signalingState; 192 SignalingState m_signalingState;
175 ICEGatheringState m_iceGatheringState; 193 ICEGatheringState m_iceGatheringState;
176 ICEConnectionState m_iceConnectionState; 194 ICEConnectionState m_iceConnectionState;
177 195
178 MediaStreamVector m_localStreams; 196 MediaStreamVector m_localStreams;
179 MediaStreamVector m_remoteStreams; 197 MediaStreamVector m_remoteStreams;
180 198
181 HeapVector<Member<RTCDataChannel>> m_dataChannels; 199 HeapVector<Member<RTCDataChannel>> m_dataChannels;
182 200
183 OwnPtr<WebRTCPeerConnectionHandler> m_peerHandler; 201 OwnPtr<WebRTCPeerConnectionHandler> m_peerHandler;
184 202
185 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; 203 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner;
186 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; 204 WillBeHeapVector<EventWrapper> m_scheduledEvents;
187 205
188 bool m_stopped; 206 bool m_stopped;
189 bool m_closed; 207 bool m_closed;
190 }; 208 };
191 209
192 } // namespace blink 210 } // namespace blink
193 211
194 #endif // RTCPeerConnection_h 212 #endif // RTCPeerConnection_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698