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