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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class MediaStreamTrack; | 49 class MediaStreamTrack; |
50 class RTCConfiguration; | 50 class RTCConfiguration; |
51 class RTCDTMFSender; | 51 class RTCDTMFSender; |
52 class RTCDataChannel; | 52 class RTCDataChannel; |
53 class RTCErrorCallback; | 53 class RTCErrorCallback; |
54 class RTCSessionDescription; | 54 class RTCSessionDescription; |
55 class RTCSessionDescriptionCallback; | 55 class RTCSessionDescriptionCallback; |
56 class RTCStatsCallback; | 56 class RTCStatsCallback; |
57 class VoidCallback; | 57 class VoidCallback; |
58 | 58 |
59 class RTCPeerConnection FINAL : public RefCounted<RTCPeerConnection>, public Scr
iptWrappable, public blink::WebRTCPeerConnectionHandlerClient, public EventTarge
tWithInlineData, public ActiveDOMObject { | 59 class RTCPeerConnection FINAL : public RefCountedWillBeRefCountedGarbageCollecte
d<RTCPeerConnection>, public ScriptWrappable, public blink::WebRTCPeerConnection
HandlerClient, public EventTargetWithInlineData, public ActiveDOMObject { |
60 REFCOUNTED_EVENT_TARGET(RTCPeerConnection); | 60 DECLARE_GC_INFO; |
| 61 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<R
TCPeerConnection>); |
61 public: | 62 public: |
62 static PassRefPtr<RTCPeerConnection> create(ExecutionContext*, const Diction
ary& rtcConfiguration, const Dictionary& mediaConstraints, ExceptionState&); | 63 static PassRefPtrWillBeRawPtr<RTCPeerConnection> create(ExecutionContext*, c
onst Dictionary& rtcConfiguration, const Dictionary& mediaConstraints, Exception
State&); |
63 virtual ~RTCPeerConnection(); | 64 virtual ~RTCPeerConnection(); |
64 | 65 |
65 void createOffer(PassOwnPtr<RTCSessionDescriptionCallback>, PassOwnPtr<RTCEr
rorCallback>, const Dictionary& mediaConstraints, ExceptionState&); | 66 void createOffer(PassOwnPtr<RTCSessionDescriptionCallback>, PassOwnPtr<RTCEr
rorCallback>, const Dictionary& mediaConstraints, ExceptionState&); |
66 | 67 |
67 void createAnswer(PassOwnPtr<RTCSessionDescriptionCallback>, PassOwnPtr<RTCE
rrorCallback>, const Dictionary& mediaConstraints, ExceptionState&); | 68 void createAnswer(PassOwnPtr<RTCSessionDescriptionCallback>, PassOwnPtr<RTCE
rrorCallback>, const Dictionary& mediaConstraints, ExceptionState&); |
68 | 69 |
69 void setLocalDescription(PassRefPtr<RTCSessionDescription>, PassOwnPtr<VoidC
allback>, PassOwnPtr<RTCErrorCallback>, ExceptionState&); | 70 void setLocalDescription(PassRefPtrWillBeRawPtr<RTCSessionDescription>, Pass
OwnPtr<VoidCallback>, PassOwnPtr<RTCErrorCallback>, ExceptionState&); |
70 PassRefPtr<RTCSessionDescription> localDescription(ExceptionState&); | 71 PassRefPtrWillBeRawPtr<RTCSessionDescription> localDescription(ExceptionStat
e&); |
71 | 72 |
72 void setRemoteDescription(PassRefPtr<RTCSessionDescription>, PassOwnPtr<Void
Callback>, PassOwnPtr<RTCErrorCallback>, ExceptionState&); | 73 void setRemoteDescription(PassRefPtrWillBeRawPtr<RTCSessionDescription>, Pas
sOwnPtr<VoidCallback>, PassOwnPtr<RTCErrorCallback>, ExceptionState&); |
73 PassRefPtr<RTCSessionDescription> remoteDescription(ExceptionState&); | 74 PassRefPtrWillBeRawPtr<RTCSessionDescription> remoteDescription(ExceptionSta
te&); |
74 | 75 |
75 String signalingState() const; | 76 String signalingState() const; |
76 | 77 |
77 void updateIce(const Dictionary& rtcConfiguration, const Dictionary& mediaCo
nstraints, ExceptionState&); | 78 void updateIce(const Dictionary& rtcConfiguration, const Dictionary& mediaCo
nstraints, ExceptionState&); |
78 | 79 |
79 // DEPRECATED | 80 // DEPRECATED |
80 void addIceCandidate(RTCIceCandidate*, ExceptionState&); | 81 void addIceCandidate(RTCIceCandidate*, ExceptionState&); |
81 | 82 |
82 void addIceCandidate(RTCIceCandidate*, PassOwnPtr<VoidCallback>, PassOwnPtr<
RTCErrorCallback>, ExceptionState&); | 83 void addIceCandidate(RTCIceCandidate*, PassOwnPtr<VoidCallback>, PassOwnPtr<
RTCErrorCallback>, ExceptionState&); |
83 | 84 |
84 String iceGatheringState() const; | 85 String iceGatheringState() const; |
85 | 86 |
86 String iceConnectionState() const; | 87 String iceConnectionState() const; |
87 | 88 |
88 MediaStreamVector getLocalStreams() const; | 89 MediaStreamVector getLocalStreams() const; |
89 | 90 |
90 MediaStreamVector getRemoteStreams() const; | 91 MediaStreamVector getRemoteStreams() const; |
91 | 92 |
92 MediaStream* getStreamById(const String& streamId); | 93 MediaStream* getStreamById(const String& streamId); |
93 | 94 |
94 void addStream(PassRefPtr<MediaStream>, const Dictionary& mediaConstraints,
ExceptionState&); | 95 void addStream(PassRefPtrWillBeRawPtr<MediaStream>, const Dictionary& mediaC
onstraints, ExceptionState&); |
95 | 96 |
96 void removeStream(PassRefPtr<MediaStream>, ExceptionState&); | 97 void removeStream(PassRefPtrWillBeRawPtr<MediaStream>, ExceptionState&); |
97 | 98 |
98 void getStats(PassOwnPtr<RTCStatsCallback> successCallback, PassRefPtr<Media
StreamTrack> selector); | 99 void getStats(PassOwnPtr<RTCStatsCallback> successCallback, PassRefPtr<Media
StreamTrack> selector); |
99 | 100 |
100 PassRefPtr<RTCDataChannel> createDataChannel(String label, const Dictionary&
dataChannelDict, ExceptionState&); | 101 PassRefPtrWillBeRawPtr<RTCDataChannel> createDataChannel(String label, const
Dictionary& dataChannelDict, ExceptionState&); |
101 | 102 |
102 PassRefPtr<RTCDTMFSender> createDTMFSender(PassRefPtr<MediaStreamTrack>, Exc
eptionState&); | 103 PassRefPtrWillBeRawPtr<RTCDTMFSender> createDTMFSender(PassRefPtrWillBeRawPt
r<MediaStreamTrack>, ExceptionState&); |
103 | 104 |
104 void close(ExceptionState&); | 105 void close(ExceptionState&); |
105 | 106 |
106 DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded); | 107 DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded); |
107 DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); | 108 DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); |
108 DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange); | 109 DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange); |
109 DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); | 110 DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); |
110 DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); | 111 DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); |
111 DEFINE_ATTRIBUTE_EVENT_LISTENER(iceconnectionstatechange); | 112 DEFINE_ATTRIBUTE_EVENT_LISTENER(iceconnectionstatechange); |
112 DEFINE_ATTRIBUTE_EVENT_LISTENER(datachannel); | 113 DEFINE_ATTRIBUTE_EVENT_LISTENER(datachannel); |
(...skipping 11 matching lines...) Expand all Loading... |
124 // EventTarget | 125 // EventTarget |
125 virtual const AtomicString& interfaceName() const OVERRIDE; | 126 virtual const AtomicString& interfaceName() const OVERRIDE; |
126 virtual ExecutionContext* executionContext() const OVERRIDE; | 127 virtual ExecutionContext* executionContext() const OVERRIDE; |
127 | 128 |
128 // ActiveDOMObject | 129 // ActiveDOMObject |
129 virtual void suspend() OVERRIDE; | 130 virtual void suspend() OVERRIDE; |
130 virtual void resume() OVERRIDE; | 131 virtual void resume() OVERRIDE; |
131 virtual void stop() OVERRIDE; | 132 virtual void stop() OVERRIDE; |
132 virtual bool hasPendingActivity() const OVERRIDE { return !m_stopped; } | 133 virtual bool hasPendingActivity() const OVERRIDE { return !m_stopped; } |
133 | 134 |
| 135 void trace(Visitor*); |
| 136 |
134 private: | 137 private: |
135 RTCPeerConnection(ExecutionContext*, PassRefPtr<RTCConfiguration>, blink::We
bMediaConstraints, ExceptionState&); | 138 RTCPeerConnection(ExecutionContext*, PassRefPtr<RTCConfiguration>, blink::We
bMediaConstraints, ExceptionState&); |
136 | 139 |
137 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary& con
figuration, ExceptionState&); | 140 static PassRefPtr<RTCConfiguration> parseConfiguration(const Dictionary& con
figuration, ExceptionState&); |
138 void scheduleDispatchEvent(PassRefPtr<Event>); | 141 void scheduleDispatchEvent(PassRefPtr<Event>); |
139 void dispatchScheduledEvent(); | 142 void dispatchScheduledEvent(); |
140 bool hasLocalStreamWithTrackId(const String& trackId); | 143 bool hasLocalStreamWithTrackId(const String& trackId); |
141 | 144 |
142 void changeSignalingState(blink::WebRTCPeerConnectionHandlerClient::Signalin
gState); | 145 void changeSignalingState(blink::WebRTCPeerConnectionHandlerClient::Signalin
gState); |
143 void changeIceGatheringState(blink::WebRTCPeerConnectionHandlerClient::ICEGa
theringState); | 146 void changeIceGatheringState(blink::WebRTCPeerConnectionHandlerClient::ICEGa
theringState); |
144 void changeIceConnectionState(blink::WebRTCPeerConnectionHandlerClient::ICEC
onnectionState); | 147 void changeIceConnectionState(blink::WebRTCPeerConnectionHandlerClient::ICEC
onnectionState); |
145 | 148 |
146 SignalingState m_signalingState; | 149 SignalingState m_signalingState; |
147 ICEGatheringState m_iceGatheringState; | 150 ICEGatheringState m_iceGatheringState; |
148 ICEConnectionState m_iceConnectionState; | 151 ICEConnectionState m_iceConnectionState; |
149 | 152 |
150 MediaStreamVector m_localStreams; | 153 MediaStreamVector m_localStreams; |
151 MediaStreamVector m_remoteStreams; | 154 MediaStreamVector m_remoteStreams; |
152 | 155 |
153 Vector<RefPtr<RTCDataChannel> > m_dataChannels; | 156 WillBeHeapVector<RefPtrWillBeMember<RTCDataChannel> > m_dataChannels; |
154 | 157 |
155 OwnPtr<blink::WebRTCPeerConnectionHandler> m_peerHandler; | 158 OwnPtr<blink::WebRTCPeerConnectionHandler> m_peerHandler; |
156 | 159 |
157 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; | 160 AsyncMethodRunner<RTCPeerConnection> m_dispatchScheduledEventRunner; |
158 Vector<RefPtr<Event> > m_scheduledEvents; | 161 Vector<RefPtr<Event> > m_scheduledEvents; |
159 | 162 |
160 bool m_stopped; | 163 bool m_stopped; |
161 }; | 164 }; |
162 | 165 |
163 } // namespace WebCore | 166 } // namespace WebCore |
164 | 167 |
165 #endif // RTCPeerConnection_h | 168 #endif // RTCPeerConnection_h |
OLD | NEW |