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

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

Issue 716323002: Use "int" rather than "long" for C++ code interacting with WebIDL's "long". (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
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 20 matching lines...) Expand all
31 #include "core/dom/ExceptionCode.h" 31 #include "core/dom/ExceptionCode.h"
32 #include "core/dom/ExecutionContext.h" 32 #include "core/dom/ExecutionContext.h"
33 #include "modules/mediastream/MediaStreamTrack.h" 33 #include "modules/mediastream/MediaStreamTrack.h"
34 #include "modules/mediastream/RTCDTMFToneChangeEvent.h" 34 #include "modules/mediastream/RTCDTMFToneChangeEvent.h"
35 #include "public/platform/WebMediaStreamTrack.h" 35 #include "public/platform/WebMediaStreamTrack.h"
36 #include "public/platform/WebRTCDTMFSenderHandler.h" 36 #include "public/platform/WebRTCDTMFSenderHandler.h"
37 #include "public/platform/WebRTCPeerConnectionHandler.h" 37 #include "public/platform/WebRTCPeerConnectionHandler.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 static const long minToneDurationMs = 70; 41 static const int minToneDurationMs = 70;
42 static const long defaultToneDurationMs = 100; 42 static const int defaultToneDurationMs = 100;
43 static const long maxToneDurationMs = 6000; 43 static const int maxToneDurationMs = 6000;
44 static const long minInterToneGapMs = 50; 44 static const int minInterToneGapMs = 50;
45 static const long defaultInterToneGapMs = 50; 45 static const int defaultInterToneGapMs = 50;
46 46
47 RTCDTMFSender* RTCDTMFSender::create(ExecutionContext* context, WebRTCPeerConnec tionHandler* peerConnectionHandler, MediaStreamTrack* track, ExceptionState& exc eptionState) 47 RTCDTMFSender* RTCDTMFSender::create(ExecutionContext* context, WebRTCPeerConnec tionHandler* peerConnectionHandler, MediaStreamTrack* track, ExceptionState& exc eptionState)
48 { 48 {
49 OwnPtr<WebRTCDTMFSenderHandler> handler = adoptPtr(peerConnectionHandler->cr eateDTMFSender(track->component())); 49 OwnPtr<WebRTCDTMFSenderHandler> handler = adoptPtr(peerConnectionHandler->cr eateDTMFSender(track->component()));
50 if (!handler) { 50 if (!handler) {
51 exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrac k provided is not an element of a MediaStream that's currently in the local stre ams set."); 51 exceptionState.throwDOMException(NotSupportedError, "The MediaStreamTrac k provided is not an element of a MediaStream that's currently in the local stre ams set.");
52 return nullptr; 52 return nullptr;
53 } 53 }
54 54
55 RTCDTMFSender* dtmfSender = new RTCDTMFSender(context, track, handler.releas e()); 55 RTCDTMFSender* dtmfSender = new RTCDTMFSender(context, track, handler.releas e());
(...skipping 30 matching lines...) Expand all
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& exceptionSta te) 91 void RTCDTMFSender::insertDTMF(const String& tones, ExceptionState& exceptionSta te)
92 { 92 {
93 insertDTMF(tones, defaultToneDurationMs, defaultInterToneGapMs, exceptionSta te); 93 insertDTMF(tones, defaultToneDurationMs, defaultInterToneGapMs, exceptionSta te);
94 } 94 }
95 95
96 void RTCDTMFSender::insertDTMF(const String& tones, long duration, ExceptionStat e& exceptionState) 96 void RTCDTMFSender::insertDTMF(const String& tones, int duration, ExceptionState & exceptionState)
97 { 97 {
98 insertDTMF(tones, duration, defaultInterToneGapMs, exceptionState); 98 insertDTMF(tones, duration, defaultInterToneGapMs, exceptionState);
99 } 99 }
100 100
101 void RTCDTMFSender::insertDTMF(const String& tones, long duration, long interTon eGap, ExceptionState& exceptionState) 101 void RTCDTMFSender::insertDTMF(const String& tones, int duration, int interToneG ap, ExceptionState& exceptionState)
102 { 102 {
103 if (!canInsertDTMF()) { 103 if (!canInsertDTMF()) {
104 exceptionState.throwDOMException(NotSupportedError, "The 'canInsertDTMF' attribute is false: this sender cannot send DTMF."); 104 exceptionState.throwDOMException(NotSupportedError, "The 'canInsertDTMF' attribute is false: this sender cannot send DTMF.");
105 return; 105 return;
106 } 106 }
107 107
108 if (duration > maxToneDurationMs || duration < minToneDurationMs) { 108 if (duration > maxToneDurationMs || duration < minToneDurationMs) {
109 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::indexOu tsideRange("duration", duration, minToneDurationMs, ExceptionMessages::Exclusive Bound, maxToneDurationMs, ExceptionMessages::ExclusiveBound)); 109 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::indexOu tsideRange("duration", duration, minToneDurationMs, ExceptionMessages::Exclusive Bound, maxToneDurationMs, ExceptionMessages::ExclusiveBound));
110 return; 110 return;
111 } 111 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 void RTCDTMFSender::trace(Visitor* visitor) 167 void RTCDTMFSender::trace(Visitor* visitor)
168 { 168 {
169 visitor->trace(m_track); 169 visitor->trace(m_track);
170 visitor->trace(m_scheduledEvents); 170 visitor->trace(m_scheduledEvents);
171 EventTargetWithInlineData::trace(visitor); 171 EventTargetWithInlineData::trace(visitor);
172 } 172 }
173 173
174 } // namespace blink 174 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698