| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 class ScriptState; | 61 class ScriptState; |
| 62 class VoidCallback; | 62 class VoidCallback; |
| 63 | 63 |
| 64 class RTCPeerConnection final | 64 class RTCPeerConnection final |
| 65 : public RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnecti
on> | 65 : public RefCountedGarbageCollectedEventTargetWithInlineData<RTCPeerConnecti
on> |
| 66 , public WebRTCPeerConnectionHandlerClient | 66 , public WebRTCPeerConnectionHandlerClient |
| 67 , public ActiveScriptWrappable | 67 , public ActiveScriptWrappable |
| 68 , public ActiveDOMObject { | 68 , public ActiveDOMObject { |
| 69 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RTCPeerConnection); | 69 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RTCPeerConnection); |
| 70 DEFINE_WRAPPERTYPEINFO(); | 70 DEFINE_WRAPPERTYPEINFO(); |
| 71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RTCPeerConnection); | 71 USING_GARBAGE_COLLECTED_MIXIN(RTCPeerConnection); |
| 72 public: | 72 public: |
| 73 // TODO(hbos): Create with expired RTCCertificate should fail, see crbug.com
/565278. | 73 // TODO(hbos): Create with expired RTCCertificate should fail, see crbug.com
/565278. |
| 74 static RTCPeerConnection* create(ExecutionContext*, const Dictionary&, const
Dictionary&, ExceptionState&); | 74 static RTCPeerConnection* create(ExecutionContext*, const Dictionary&, const
Dictionary&, ExceptionState&); |
| 75 ~RTCPeerConnection() override; | 75 ~RTCPeerConnection() override; |
| 76 | 76 |
| 77 ScriptPromise createOffer(ScriptState*, const RTCOfferOptions&); | 77 ScriptPromise createOffer(ScriptState*, const RTCOfferOptions&); |
| 78 ScriptPromise createOffer(ScriptState*, RTCSessionDescriptionCallback*, RTCP
eerConnectionErrorCallback*, const Dictionary&); | 78 ScriptPromise createOffer(ScriptState*, RTCSessionDescriptionCallback*, RTCP
eerConnectionErrorCallback*, const Dictionary&); |
| 79 | 79 |
| 80 ScriptPromise createAnswer(ScriptState*, const RTCAnswerOptions&); | 80 ScriptPromise createAnswer(ScriptState*, const RTCAnswerOptions&); |
| 81 ScriptPromise createAnswer(ScriptState*, RTCSessionDescriptionCallback*, RTC
PeerConnectionErrorCallback*, const Dictionary&); | 81 ScriptPromise createAnswer(ScriptState*, RTCSessionDescriptionCallback*, RTC
PeerConnectionErrorCallback*, const Dictionary&); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Oilpan: need to eagerly finalize m_peerHandler | 164 // Oilpan: need to eagerly finalize m_peerHandler |
| 165 EAGERLY_FINALIZE(); | 165 EAGERLY_FINALIZE(); |
| 166 DECLARE_VIRTUAL_TRACE(); | 166 DECLARE_VIRTUAL_TRACE(); |
| 167 | 167 |
| 168 private: | 168 private: |
| 169 typedef Function<bool()> BoolFunction; | 169 typedef Function<bool()> BoolFunction; |
| 170 class EventWrapper : public GarbageCollectedFinalized<EventWrapper> { | 170 class EventWrapper : public GarbageCollectedFinalized<EventWrapper> { |
| 171 public: | 171 public: |
| 172 EventWrapper(PassRefPtrWillBeRawPtr<Event>, PassOwnPtr<BoolFunction>); | 172 EventWrapper(RawPtr<Event>, PassOwnPtr<BoolFunction>); |
| 173 // Returns true if |m_setupFunction| returns true or it is null. | 173 // Returns true if |m_setupFunction| returns true or it is null. |
| 174 // |m_event| will only be fired if setup() returns true; | 174 // |m_event| will only be fired if setup() returns true; |
| 175 bool setup(); | 175 bool setup(); |
| 176 | 176 |
| 177 DECLARE_TRACE(); | 177 DECLARE_TRACE(); |
| 178 | 178 |
| 179 RefPtrWillBeMember<Event> m_event; | 179 Member<Event> m_event; |
| 180 | 180 |
| 181 private: | 181 private: |
| 182 OwnPtr<BoolFunction> m_setupFunction; | 182 OwnPtr<BoolFunction> m_setupFunction; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 RTCPeerConnection(ExecutionContext*, RTCConfiguration*, WebMediaConstraints,
ExceptionState&); | 185 RTCPeerConnection(ExecutionContext*, RTCConfiguration*, WebMediaConstraints,
ExceptionState&); |
| 186 | 186 |
| 187 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 187 void scheduleDispatchEvent(RawPtr<Event>); |
| 188 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>, PassOwnPtr<BoolFun
ction>); | 188 void scheduleDispatchEvent(RawPtr<Event>, PassOwnPtr<BoolFunction>); |
| 189 void dispatchScheduledEvent(); | 189 void dispatchScheduledEvent(); |
| 190 bool hasLocalStreamWithTrackId(const String& trackId); | 190 bool hasLocalStreamWithTrackId(const String& trackId); |
| 191 | 191 |
| 192 void changeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState)
; | 192 void changeSignalingState(WebRTCPeerConnectionHandlerClient::SignalingState)
; |
| 193 void changeIceGatheringState(WebRTCPeerConnectionHandlerClient::ICEGathering
State); | 193 void changeIceGatheringState(WebRTCPeerConnectionHandlerClient::ICEGathering
State); |
| 194 // Changes the state immediately; does not fire an event. | 194 // Changes the state immediately; does not fire an event. |
| 195 // Returns true if the state was changed. | 195 // Returns true if the state was changed. |
| 196 bool setIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnectionS
tate); | 196 bool setIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnectionS
tate); |
| 197 // Changes the state asynchronously and fires an event immediately after cha
nging the state. | 197 // Changes the state asynchronously and fires an event immediately after cha
nging the state. |
| 198 void changeIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnecti
onState); | 198 void changeIceConnectionState(WebRTCPeerConnectionHandlerClient::ICEConnecti
onState); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 211 Member<AsyncMethodRunner<RTCPeerConnection>> m_dispatchScheduledEventRunner; | 211 Member<AsyncMethodRunner<RTCPeerConnection>> m_dispatchScheduledEventRunner; |
| 212 HeapVector<Member<EventWrapper>> m_scheduledEvents; | 212 HeapVector<Member<EventWrapper>> m_scheduledEvents; |
| 213 | 213 |
| 214 bool m_stopped; | 214 bool m_stopped; |
| 215 bool m_closed; | 215 bool m_closed; |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 } // namespace blink | 218 } // namespace blink |
| 219 | 219 |
| 220 #endif // RTCPeerConnection_h | 220 #endif // RTCPeerConnection_h |
| OLD | NEW |