OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "public/platform/WebRTCPeerConnectionHandler.h" | 37 #include "public/platform/WebRTCPeerConnectionHandler.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 static const long minToneDurationMs = 70; | 41 static const long minToneDurationMs = 70; |
42 static const long defaultToneDurationMs = 100; | 42 static const long defaultToneDurationMs = 100; |
43 static const long maxToneDurationMs = 6000; | 43 static const long maxToneDurationMs = 6000; |
44 static const long minInterToneGapMs = 50; | 44 static const long minInterToneGapMs = 50; |
45 static const long defaultInterToneGapMs = 50; | 45 static const long defaultInterToneGapMs = 50; |
46 | 46 |
47 PassRefPtr<RTCDTMFSender> RTCDTMFSender::create(ExecutionContext* context, blink
::WebRTCPeerConnectionHandler* peerConnectionHandler, PassRefPtr<MediaStreamTrac
k> prpTrack, ExceptionState& exceptionState) | 47 PassRefPtrWillBeRawPtr<RTCDTMFSender> RTCDTMFSender::create(ExecutionContext* co
ntext, blink::WebRTCPeerConnectionHandler* peerConnectionHandler, PassRefPtrWill
BeRawPtr<MediaStreamTrack> prpTrack, ExceptionState& exceptionState) |
48 { | 48 { |
49 RefPtr<MediaStreamTrack> track = prpTrack; | 49 RefPtrWillBeRawPtr<MediaStreamTrack> track = prpTrack; |
50 OwnPtr<blink::WebRTCDTMFSenderHandler> handler = adoptPtr(peerConnectionHand
ler->createDTMFSender(track->component())); | 50 OwnPtr<blink::WebRTCDTMFSenderHandler> handler = adoptPtr(peerConnectionHand
ler->createDTMFSender(track->component())); |
51 if (!handler) { | 51 if (!handler) { |
52 exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrac
k provided is not an element of a MediaStream that's currently in the local stre
ams set."); | 52 exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrac
k provided is not an element of a MediaStream that's currently in the local stre
ams set."); |
53 return nullptr; | 53 return nullptr; |
54 } | 54 } |
55 | 55 |
56 RefPtr<RTCDTMFSender> dtmfSender = adoptRef(new RTCDTMFSender(context, track
, handler.release())); | 56 RefPtrWillBeRawPtr<RTCDTMFSender> dtmfSender = adoptRefWillBeRefCountedGarba
geCollected(new RTCDTMFSender(context, track, handler.release())); |
57 dtmfSender->suspendIfNeeded(); | 57 dtmfSender->suspendIfNeeded(); |
58 return dtmfSender.release(); | 58 return dtmfSender.release(); |
59 } | 59 } |
60 | 60 |
61 RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, PassRefPtr<MediaStreamTr
ack> track, PassOwnPtr<blink::WebRTCDTMFSenderHandler> handler) | 61 RTCDTMFSender::RTCDTMFSender(ExecutionContext* context, PassRefPtrWillBeRawPtr<M
ediaStreamTrack> track, PassOwnPtr<blink::WebRTCDTMFSenderHandler> handler) |
62 : ActiveDOMObject(context) | 62 : ActiveDOMObject(context) |
63 , m_track(track) | 63 , m_track(track) |
64 , m_duration(defaultToneDurationMs) | 64 , m_duration(defaultToneDurationMs) |
65 , m_interToneGap(defaultInterToneGapMs) | 65 , m_interToneGap(defaultInterToneGapMs) |
66 , m_handler(handler) | 66 , m_handler(handler) |
67 , m_stopped(false) | 67 , m_stopped(false) |
68 , m_scheduledEventTimer(this, &RTCDTMFSender::scheduledEventTimerFired) | 68 , m_scheduledEventTimer(this, &RTCDTMFSender::scheduledEventTimerFired) |
69 { | 69 { |
70 ScriptWrappable::init(this); | 70 ScriptWrappable::init(this); |
71 m_handler->setClient(this); | 71 m_handler->setClient(this); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return; | 159 return; |
160 | 160 |
161 WillBeHeapVector<RefPtrWillBeMember<Event> > events; | 161 WillBeHeapVector<RefPtrWillBeMember<Event> > events; |
162 events.swap(m_scheduledEvents); | 162 events.swap(m_scheduledEvents); |
163 | 163 |
164 WillBeHeapVector<RefPtrWillBeMember<Event> >::iterator it = events.begin(); | 164 WillBeHeapVector<RefPtrWillBeMember<Event> >::iterator it = events.begin(); |
165 for (; it != events.end(); ++it) | 165 for (; it != events.end(); ++it) |
166 dispatchEvent((*it).release()); | 166 dispatchEvent((*it).release()); |
167 } | 167 } |
168 | 168 |
| 169 void RTCDTMFSender::trace(Visitor* visitor) |
| 170 { |
| 171 visitor->trace(m_track); |
| 172 visitor->trace(m_scheduledEvents); |
| 173 } |
| 174 |
169 } // namespace WebCore | 175 } // namespace WebCore |
OLD | NEW |