| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 USING_GARBAGE_COLLECTED_MIXIN(RTCPeerConnection); | 71 USING_GARBAGE_COLLECTED_MIXIN(RTCPeerConnection); |
| 72 USING_PRE_FINALIZER(RTCPeerConnection, dispose); |
| 72 public: | 73 public: |
| 73 // TODO(hbos): Create with expired RTCCertificate should fail, see crbug.com
/565278. | 74 // TODO(hbos): Create with expired RTCCertificate should fail, see crbug.com
/565278. |
| 74 static RTCPeerConnection* create(ExecutionContext*, const Dictionary&, const
Dictionary&, ExceptionState&); | 75 static RTCPeerConnection* create(ExecutionContext*, const Dictionary&, const
Dictionary&, ExceptionState&); |
| 75 ~RTCPeerConnection() override; | 76 ~RTCPeerConnection() override; |
| 76 | 77 |
| 77 ScriptPromise createOffer(ScriptState*, const RTCOfferOptions&); | 78 ScriptPromise createOffer(ScriptState*, const RTCOfferOptions&); |
| 78 ScriptPromise createOffer(ScriptState*, RTCSessionDescriptionCallback*, RTCP
eerConnectionErrorCallback*, const Dictionary&); | 79 ScriptPromise createOffer(ScriptState*, RTCSessionDescriptionCallback*, RTCP
eerConnectionErrorCallback*, const Dictionary&); |
| 79 | 80 |
| 80 ScriptPromise createAnswer(ScriptState*, const RTCAnswerOptions&); | 81 ScriptPromise createAnswer(ScriptState*, const RTCAnswerOptions&); |
| 81 ScriptPromise createAnswer(ScriptState*, RTCSessionDescriptionCallback*, RTC
PeerConnectionErrorCallback*, const Dictionary&); | 82 ScriptPromise createAnswer(ScriptState*, RTCSessionDescriptionCallback*, RTC
PeerConnectionErrorCallback*, const Dictionary&); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void resume() override; | 155 void resume() override; |
| 155 void stop() override; | 156 void stop() override; |
| 156 | 157 |
| 157 // ActiveScriptWrappable | 158 // ActiveScriptWrappable |
| 158 // We keep the this object alive until either stopped or closed. | 159 // We keep the this object alive until either stopped or closed. |
| 159 bool hasPendingActivity() const final | 160 bool hasPendingActivity() const final |
| 160 { | 161 { |
| 161 return !m_closed && !m_stopped; | 162 return !m_closed && !m_stopped; |
| 162 } | 163 } |
| 163 | 164 |
| 164 // Oilpan: need to eagerly finalize m_peerHandler | |
| 165 EAGERLY_FINALIZE(); | |
| 166 DECLARE_VIRTUAL_TRACE(); | 165 DECLARE_VIRTUAL_TRACE(); |
| 167 | 166 |
| 168 private: | 167 private: |
| 169 typedef Function<bool()> BoolFunction; | 168 typedef Function<bool()> BoolFunction; |
| 170 class EventWrapper : public GarbageCollectedFinalized<EventWrapper> { | 169 class EventWrapper : public GarbageCollectedFinalized<EventWrapper> { |
| 171 public: | 170 public: |
| 172 EventWrapper(Event*, PassOwnPtr<BoolFunction>); | 171 EventWrapper(Event*, PassOwnPtr<BoolFunction>); |
| 173 // Returns true if |m_setupFunction| returns true or it is null. | 172 // Returns true if |m_setupFunction| returns true or it is null. |
| 174 // |m_event| will only be fired if setup() returns true; | 173 // |m_event| will only be fired if setup() returns true; |
| 175 bool setup(); | 174 bool setup(); |
| 176 | 175 |
| 177 DECLARE_TRACE(); | 176 DECLARE_TRACE(); |
| 178 | 177 |
| 179 Member<Event> m_event; | 178 Member<Event> m_event; |
| 180 | 179 |
| 181 private: | 180 private: |
| 182 OwnPtr<BoolFunction> m_setupFunction; | 181 OwnPtr<BoolFunction> m_setupFunction; |
| 183 }; | 182 }; |
| 184 | 183 |
| 185 RTCPeerConnection(ExecutionContext*, RTCConfiguration*, WebMediaConstraints,
ExceptionState&); | 184 RTCPeerConnection(ExecutionContext*, RTCConfiguration*, WebMediaConstraints,
ExceptionState&); |
| 185 void dispose(); |
| 186 | 186 |
| 187 void scheduleDispatchEvent(Event*); | 187 void scheduleDispatchEvent(Event*); |
| 188 void scheduleDispatchEvent(Event*, PassOwnPtr<BoolFunction>); | 188 void scheduleDispatchEvent(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. |
| (...skipping 15 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 |