Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: Source/modules/mediastream/RTCDTMFSender.cpp

Issue 21735005: Use "int" instead of "long" for bindings where the WebIDL uses "long". (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/mediastream/RTCDTMFSender.h ('k') | Source/modules/mediastream/RTCDataChannel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 #include "bindings/v8/ExceptionState.h" 29 #include "bindings/v8/ExceptionState.h"
30 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
31 #include "core/dom/ScriptExecutionContext.h" 31 #include "core/dom/ScriptExecutionContext.h"
32 #include "core/platform/mediastream/RTCDTMFSenderHandler.h" 32 #include "core/platform/mediastream/RTCDTMFSenderHandler.h"
33 #include "core/platform/mediastream/RTCPeerConnectionHandler.h" 33 #include "core/platform/mediastream/RTCPeerConnectionHandler.h"
34 #include "modules/mediastream/MediaStreamTrack.h" 34 #include "modules/mediastream/MediaStreamTrack.h"
35 #include "modules/mediastream/RTCDTMFToneChangeEvent.h" 35 #include "modules/mediastream/RTCDTMFToneChangeEvent.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 static const long minToneDurationMs = 70; 39 static const int minToneDurationMs = 70;
40 static const long defaultToneDurationMs = 100; 40 static const int defaultToneDurationMs = 100;
41 static const long maxToneDurationMs = 6000; 41 static const int maxToneDurationMs = 6000;
42 static const long minInterToneGapMs = 50; 42 static const int minInterToneGapMs = 50;
43 static const long defaultInterToneGapMs = 50; 43 static const int defaultInterToneGapMs = 50;
44 44
45 PassRefPtr<RTCDTMFSender> RTCDTMFSender::create(ScriptExecutionContext* context, RTCPeerConnectionHandler* peerConnectionHandler, PassRefPtr<MediaStreamTrack> p rpTrack, ExceptionState& es) 45 PassRefPtr<RTCDTMFSender> RTCDTMFSender::create(ScriptExecutionContext* context, RTCPeerConnectionHandler* peerConnectionHandler, PassRefPtr<MediaStreamTrack> p rpTrack, ExceptionState& es)
46 { 46 {
47 RefPtr<MediaStreamTrack> track = prpTrack; 47 RefPtr<MediaStreamTrack> track = prpTrack;
48 OwnPtr<RTCDTMFSenderHandler> handler = peerConnectionHandler->createDTMFSend er(track->component()); 48 OwnPtr<RTCDTMFSenderHandler> handler = peerConnectionHandler->createDTMFSend er(track->component());
49 if (!handler) { 49 if (!handler) {
50 es.throwDOMException(NotSupportedError); 50 es.throwDOMException(NotSupportedError);
51 return 0; 51 return 0;
52 } 52 }
53 53
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 String RTCDTMFSender::toneBuffer() const 86 String RTCDTMFSender::toneBuffer() const
87 { 87 {
88 return m_handler->currentToneBuffer(); 88 return m_handler->currentToneBuffer();
89 } 89 }
90 90
91 void RTCDTMFSender::insertDTMF(const String& tones, ExceptionState& es) 91 void RTCDTMFSender::insertDTMF(const String& tones, ExceptionState& es)
92 { 92 {
93 insertDTMF(tones, defaultToneDurationMs, defaultInterToneGapMs, es); 93 insertDTMF(tones, defaultToneDurationMs, defaultInterToneGapMs, es);
94 } 94 }
95 95
96 void RTCDTMFSender::insertDTMF(const String& tones, long duration, ExceptionStat e& es) 96 void RTCDTMFSender::insertDTMF(const String& tones, int duration, ExceptionState & es)
97 { 97 {
98 insertDTMF(tones, duration, defaultInterToneGapMs, es); 98 insertDTMF(tones, duration, defaultInterToneGapMs, es);
99 } 99 }
100 100
101 void RTCDTMFSender::insertDTMF(const String& tones, long duration, long interTon eGap, ExceptionState& es) 101 void RTCDTMFSender::insertDTMF(const String& tones, int duration, int interToneG ap, ExceptionState& es)
102 { 102 {
103 if (!canInsertDTMF()) { 103 if (!canInsertDTMF()) {
104 es.throwDOMException(NotSupportedError); 104 es.throwDOMException(NotSupportedError);
105 return; 105 return;
106 } 106 }
107 107
108 if (duration > maxToneDurationMs || duration < minToneDurationMs) { 108 if (duration > maxToneDurationMs || duration < minToneDurationMs) {
109 es.throwDOMException(SyntaxError); 109 es.throwDOMException(SyntaxError);
110 return; 110 return;
111 } 111 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 Vector<RefPtr<Event> > events; 169 Vector<RefPtr<Event> > events;
170 events.swap(m_scheduledEvents); 170 events.swap(m_scheduledEvents);
171 171
172 Vector<RefPtr<Event> >::iterator it = events.begin(); 172 Vector<RefPtr<Event> >::iterator it = events.begin();
173 for (; it != events.end(); ++it) 173 for (; it != events.end(); ++it)
174 dispatchEvent((*it).release()); 174 dispatchEvent((*it).release());
175 } 175 }
176 176
177 } // namespace WebCore 177 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/mediastream/RTCDTMFSender.h ('k') | Source/modules/mediastream/RTCDataChannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698