| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/dom/EventTarget.h" | 37 #include "core/dom/EventTarget.h" |
| 38 #include "core/platform/Timer.h" | 38 #include "core/platform/Timer.h" |
| 39 #include "core/platform/mediastream/RTCPeerConnectionHandler.h" | 39 #include "core/platform/mediastream/RTCPeerConnectionHandler.h" |
| 40 #include "core/platform/mediastream/RTCPeerConnectionHandlerClient.h" | 40 #include "core/platform/mediastream/RTCPeerConnectionHandlerClient.h" |
| 41 #include "modules/mediastream/MediaStream.h" | 41 #include "modules/mediastream/MediaStream.h" |
| 42 #include "modules/mediastream/RTCIceCandidate.h" | 42 #include "modules/mediastream/RTCIceCandidate.h" |
| 43 #include "wtf/RefCounted.h" | 43 #include "wtf/RefCounted.h" |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace WebCore { |
| 46 | 46 |
| 47 class ExceptionState; | |
| 48 class MediaConstraints; | 47 class MediaConstraints; |
| 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 RTCSessionDescription; | 53 class RTCSessionDescription; |
| 55 class RTCSessionDescriptionCallback; | 54 class RTCSessionDescriptionCallback; |
| 56 class RTCStatsCallback; | 55 class RTCStatsCallback; |
| 57 class VoidCallback; | 56 class VoidCallback; |
| 58 | 57 |
| 58 typedef int ExceptionCode; |
| 59 |
| 59 class RTCPeerConnection : public RefCounted<RTCPeerConnection>, public ScriptWra
ppable, public RTCPeerConnectionHandlerClient, public EventTarget, public Active
DOMObject { | 60 class RTCPeerConnection : public RefCounted<RTCPeerConnection>, public ScriptWra
ppable, public RTCPeerConnectionHandlerClient, public EventTarget, public Active
DOMObject { |
| 60 public: | 61 public: |
| 61 static PassRefPtr<RTCPeerConnection> create(ScriptExecutionContext*, const D
ictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState&
); | 62 static PassRefPtr<RTCPeerConnection> create(ScriptExecutionContext*, const D
ictionary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionCode&)
; |
| 62 ~RTCPeerConnection(); | 63 ~RTCPeerConnection(); |
| 63 | 64 |
| 64 void createOffer(PassRefPtr<RTCSessionDescriptionCallback>, PassRefPtr<RTCEr
rorCallback>, const Dictionary& mediaConstraints, ExceptionState&); | 65 void createOffer(PassRefPtr<RTCSessionDescriptionCallback>, PassRefPtr<RTCEr
rorCallback>, const Dictionary& mediaConstraints, ExceptionCode&); |
| 65 | 66 |
| 66 void createAnswer(PassRefPtr<RTCSessionDescriptionCallback>, PassRefPtr<RTCE
rrorCallback>, const Dictionary& mediaConstraints, ExceptionState&); | 67 void createAnswer(PassRefPtr<RTCSessionDescriptionCallback>, PassRefPtr<RTCE
rrorCallback>, const Dictionary& mediaConstraints, ExceptionCode&); |
| 67 | 68 |
| 68 void setLocalDescription(PassRefPtr<RTCSessionDescription>, PassRefPtr<VoidC
allback>, PassRefPtr<RTCErrorCallback>, ExceptionState&); | 69 void setLocalDescription(PassRefPtr<RTCSessionDescription>, PassRefPtr<VoidC
allback>, PassRefPtr<RTCErrorCallback>, ExceptionCode&); |
| 69 PassRefPtr<RTCSessionDescription> localDescription(ExceptionState&); | 70 PassRefPtr<RTCSessionDescription> localDescription(ExceptionCode&); |
| 70 | 71 |
| 71 void setRemoteDescription(PassRefPtr<RTCSessionDescription>, PassRefPtr<Void
Callback>, PassRefPtr<RTCErrorCallback>, ExceptionState&); | 72 void setRemoteDescription(PassRefPtr<RTCSessionDescription>, PassRefPtr<Void
Callback>, PassRefPtr<RTCErrorCallback>, ExceptionCode&); |
| 72 PassRefPtr<RTCSessionDescription> remoteDescription(ExceptionState&); | 73 PassRefPtr<RTCSessionDescription> remoteDescription(ExceptionCode&); |
| 73 | 74 |
| 74 String signalingState() const; | 75 String signalingState() const; |
| 75 | 76 |
| 76 void updateIce(const Dictionary& rtcConfiguration, const Dictionary& mediaCo
nstraints, ExceptionState&); | 77 void updateIce(const Dictionary& rtcConfiguration, const Dictionary& mediaCo
nstraints, ExceptionCode&); |
| 77 | 78 |
| 78 void addIceCandidate(RTCIceCandidate*, ExceptionState&); | 79 void addIceCandidate(RTCIceCandidate*, ExceptionCode&); |
| 79 | 80 |
| 80 String iceGatheringState() const; | 81 String iceGatheringState() const; |
| 81 | 82 |
| 82 String iceConnectionState() const; | 83 String iceConnectionState() const; |
| 83 | 84 |
| 84 MediaStreamVector getLocalStreams() const; | 85 MediaStreamVector getLocalStreams() const; |
| 85 | 86 |
| 86 MediaStreamVector getRemoteStreams() const; | 87 MediaStreamVector getRemoteStreams() const; |
| 87 | 88 |
| 88 MediaStream* getStreamById(const String& streamId); | 89 MediaStream* getStreamById(const String& streamId); |
| 89 | 90 |
| 90 void addStream(PassRefPtr<MediaStream>, const Dictionary& mediaConstraints,
ExceptionState&); | 91 void addStream(PassRefPtr<MediaStream>, const Dictionary& mediaConstraints,
ExceptionCode&); |
| 91 | 92 |
| 92 void removeStream(PassRefPtr<MediaStream>, ExceptionState&); | 93 void removeStream(PassRefPtr<MediaStream>, ExceptionCode&); |
| 93 | 94 |
| 94 void getStats(PassRefPtr<RTCStatsCallback> successCallback, PassRefPtr<Media
StreamTrack> selector); | 95 void getStats(PassRefPtr<RTCStatsCallback> successCallback, PassRefPtr<Media
StreamTrack> selector); |
| 95 | 96 |
| 96 PassRefPtr<RTCDataChannel> createDataChannel(String label, const Dictionary&
dataChannelDict, ExceptionState&); | 97 PassRefPtr<RTCDataChannel> createDataChannel(String label, const Dictionary&
dataChannelDict, ExceptionCode&); |
| 97 | 98 |
| 98 PassRefPtr<RTCDTMFSender> createDTMFSender(PassRefPtr<MediaStreamTrack>, Exc
eptionState&); | 99 PassRefPtr<RTCDTMFSender> createDTMFSender(PassRefPtr<MediaStreamTrack>, Exc
eptionCode&); |
| 99 | 100 |
| 100 void close(ExceptionState&); | 101 void close(ExceptionCode&); |
| 101 | 102 |
| 102 DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded); | 103 DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded); |
| 103 DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); | 104 DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); |
| 104 DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange); | 105 DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange); |
| 105 DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); | 106 DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); |
| 106 DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); | 107 DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); |
| 107 DEFINE_ATTRIBUTE_EVENT_LISTENER(iceconnectionstatechange); | 108 DEFINE_ATTRIBUTE_EVENT_LISTENER(iceconnectionstatechange); |
| 108 DEFINE_ATTRIBUTE_EVENT_LISTENER(datachannel); | 109 DEFINE_ATTRIBUTE_EVENT_LISTENER(datachannel); |
| 109 | 110 |
| 110 // RTCPeerConnectionHandlerClient | 111 // RTCPeerConnectionHandlerClient |
| (...skipping 10 matching lines...) Expand all Loading... |
| 121 virtual const AtomicString& interfaceName() const OVERRIDE; | 122 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 122 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; | 123 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; |
| 123 | 124 |
| 124 // ActiveDOMObject | 125 // ActiveDOMObject |
| 125 virtual void stop() OVERRIDE; | 126 virtual void stop() OVERRIDE; |
| 126 | 127 |
| 127 using RefCounted<RTCPeerConnection>::ref; | 128 using RefCounted<RTCPeerConnection>::ref; |
| 128 using RefCounted<RTCPeerConnection>::deref; | 129 using RefCounted<RTCPeerConnection>::deref; |
| 129 | 130 |
| 130 private: | 131 private: |
| 131 RTCPeerConnection(ScriptExecutionContext*, PassRefPtr<RTCConfiguration>, Pas
sRefPtr<MediaConstraints>, ExceptionState&); | 132 RTCPeerConnection(ScriptExecutionContext*, PassRefPtr<RTCConfiguration>, Pas
sRefPtr<MediaConstraints>, ExceptionCode&); |
| 132 | 133 |
| 133 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary& con
figuration, ExceptionState&); | 134 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary& con
figuration, ExceptionCode&); |
| 134 void scheduleDispatchEvent(PassRefPtr<Event>); | 135 void scheduleDispatchEvent(PassRefPtr<Event>); |
| 135 void scheduledEventTimerFired(Timer<RTCPeerConnection>*); | 136 void scheduledEventTimerFired(Timer<RTCPeerConnection>*); |
| 136 bool hasLocalStreamWithTrackId(const String& trackId); | 137 bool hasLocalStreamWithTrackId(const String& trackId); |
| 137 | 138 |
| 138 // EventTarget implementation. | 139 // EventTarget implementation. |
| 139 virtual EventTargetData* eventTargetData(); | 140 virtual EventTargetData* eventTargetData(); |
| 140 virtual EventTargetData* ensureEventTargetData(); | 141 virtual EventTargetData* ensureEventTargetData(); |
| 141 virtual void refEventTarget() { ref(); } | 142 virtual void refEventTarget() { ref(); } |
| 142 virtual void derefEventTarget() { deref(); } | 143 virtual void derefEventTarget() { deref(); } |
| 143 EventTargetData m_eventTargetData; | 144 EventTargetData m_eventTargetData; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 159 | 160 |
| 160 Timer<RTCPeerConnection> m_scheduledEventTimer; | 161 Timer<RTCPeerConnection> m_scheduledEventTimer; |
| 161 Vector<RefPtr<Event> > m_scheduledEvents; | 162 Vector<RefPtr<Event> > m_scheduledEvents; |
| 162 | 163 |
| 163 bool m_stopped; | 164 bool m_stopped; |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 } // namespace WebCore | 167 } // namespace WebCore |
| 167 | 168 |
| 168 #endif // RTCPeerConnection_h | 169 #endif // RTCPeerConnection_h |
| OLD | NEW |