| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 class RTCSessionDescriptionCallback; | 55 class RTCSessionDescriptionCallback; |
| 56 class RTCStatsCallback; | 56 class RTCStatsCallback; |
| 57 class VoidCallback; | 57 class VoidCallback; |
| 58 | 58 |
| 59 class RTCPeerConnection final | 59 class RTCPeerConnection final |
| 60 : public RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnecti
on> | 60 : public RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnecti
on> |
| 61 , public WebRTCPeerConnectionHandlerClient | 61 , public WebRTCPeerConnectionHandlerClient |
| 62 , public ActiveDOMObject { | 62 , public ActiveDOMObject { |
| 63 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RTCPeerConnection); | 63 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RTCPeerConnection); |
| 64 DEFINE_WRAPPERTYPEINFO(); | 64 DEFINE_WRAPPERTYPEINFO(); |
| 65 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RTCPeerConnection); | 65 USING_GARBAGE_COLLECTED_MIXIN(RTCPeerConnection); |
| 66 public: | 66 public: |
| 67 // TODO(hbos): Create with expired RTCCertificate should fail, see crbug.com
/565278. | 67 // TODO(hbos): Create with expired RTCCertificate should fail, see crbug.com
/565278. |
| 68 static RTCPeerConnection* create(ExecutionContext*, const Dictionary&, const
Dictionary&, ExceptionState&); | 68 static RTCPeerConnection* create(ExecutionContext*, const Dictionary&, const
Dictionary&, ExceptionState&); |
| 69 ~RTCPeerConnection() override; | 69 ~RTCPeerConnection() override; |
| 70 | 70 |
| 71 void createOffer(ExecutionContext*, RTCSessionDescriptionCallback*, RTCError
Callback*, const Dictionary&, ExceptionState&); | 71 void createOffer(ExecutionContext*, RTCSessionDescriptionCallback*, RTCError
Callback*, const Dictionary&, ExceptionState&); |
| 72 | 72 |
| 73 void createAnswer(ExecutionContext*, RTCSessionDescriptionCallback*, RTCErro
rCallback*, const Dictionary&, ExceptionState&); | 73 void createAnswer(ExecutionContext*, RTCSessionDescriptionCallback*, RTCErro
rCallback*, const Dictionary&, ExceptionState&); |
| 74 | 74 |
| 75 void setLocalDescription(ExecutionContext*, RTCSessionDescription*, VoidCall
back*, RTCErrorCallback*, ExceptionState&); | 75 void setLocalDescription(ExecutionContext*, RTCSessionDescription*, VoidCall
back*, RTCErrorCallback*, ExceptionState&); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 | 153 |
| 154 // Oilpan: need to eagerly finalize m_peerHandler | 154 // Oilpan: need to eagerly finalize m_peerHandler |
| 155 EAGERLY_FINALIZE(); | 155 EAGERLY_FINALIZE(); |
| 156 DECLARE_VIRTUAL_TRACE(); | 156 DECLARE_VIRTUAL_TRACE(); |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 typedef Function<bool()> BoolFunction; | 159 typedef Function<bool()> BoolFunction; |
| 160 class EventWrapper : public GarbageCollectedFinalized<EventWrapper> { | 160 class EventWrapper : public GarbageCollectedFinalized<EventWrapper> { |
| 161 public: | 161 public: |
| 162 EventWrapper(PassRefPtrWillBeRawPtr<Event>, PassOwnPtr<BoolFunction>); | 162 EventWrapper(RawPtr<Event>, PassOwnPtr<BoolFunction>); |
| 163 // Returns true if |m_setupFunction| returns true or it is null. | 163 // Returns true if |m_setupFunction| returns true or it is null. |
| 164 // |m_event| will only be fired if setup() returns true; | 164 // |m_event| will only be fired if setup() returns true; |
| 165 bool setup(); | 165 bool setup(); |
| 166 | 166 |
| 167 DECLARE_TRACE(); | 167 DECLARE_TRACE(); |
| 168 | 168 |
| 169 RefPtrWillBeMember<Event> m_event; | 169 Member<Event> m_event; |
| 170 | 170 |
| 171 private: | 171 private: |
| 172 OwnPtr<BoolFunction> m_setupFunction; | 172 OwnPtr<BoolFunction> m_setupFunction; |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 RTCPeerConnection(ExecutionContext*, RTCConfiguration*, WebMediaConstraints,
ExceptionState&); | 175 RTCPeerConnection(ExecutionContext*, RTCConfiguration*, WebMediaConstraints,
ExceptionState&); |
| 176 | 176 |
| 177 static RTCConfiguration* parseConfiguration(const Dictionary&, ExceptionStat
e&); | 177 static RTCConfiguration* parseConfiguration(const Dictionary&, ExceptionStat
e&); |
| 178 static RTCOfferOptions* parseOfferOptions(const Dictionary&, ExceptionState&
); | 178 static RTCOfferOptions* parseOfferOptions(const Dictionary&, ExceptionState&
); |
| 179 | 179 |
| 180 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 180 void scheduleDispatchEvent(RawPtr<Event>); |
| 181 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>, PassOwnPtr<BoolFun
ction>); | 181 void scheduleDispatchEvent(RawPtr<Event>, PassOwnPtr<BoolFunction>); |
| 182 void dispatchScheduledEvent(); | 182 void dispatchScheduledEvent(); |
| 183 bool hasLocalStreamWithTrackId(const String& trackId); | 183 bool hasLocalStreamWithTrackId(const String& trackId); |
| 184 | 184 |
| 185 void changeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState)
; | 185 void changeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState)
; |
| 186 void changeIceGatheringState(WebRTCPeerConnectionHandlerClient::ICEGathering
State); | 186 void changeIceGatheringState(WebRTCPeerConnectionHandlerClient::ICEGathering
State); |
| 187 // Changes the state immediately; does not fire an event. | 187 // Changes the state immediately; does not fire an event. |
| 188 // Returns true if the state was changed. | 188 // Returns true if the state was changed. |
| 189 bool setIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnectionS
tate); | 189 bool setIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnectionS
tate); |
| 190 // Changes the state asynchronously and fires an event immediately after cha
nging the state. | 190 // Changes the state asynchronously and fires an event immediately after cha
nging the state. |
| 191 void changeIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnecti
onState); | 191 void changeIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnecti
onState); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 204 Member<AsyncMethodRunner<RTCPeerConnection>> m_dispatchScheduledEventRunner; | 204 Member<AsyncMethodRunner<RTCPeerConnection>> m_dispatchScheduledEventRunner; |
| 205 HeapVector<Member<EventWrapper>> m_scheduledEvents; | 205 HeapVector<Member<EventWrapper>> m_scheduledEvents; |
| 206 | 206 |
| 207 bool m_stopped; | 207 bool m_stopped; |
| 208 bool m_closed; | 208 bool m_closed; |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 } // namespace blink | 211 } // namespace blink |
| 212 | 212 |
| 213 #endif // RTCPeerConnection_h | 213 #endif // RTCPeerConnection_h |
| OLD | NEW |