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

Side by Side Diff: Source/modules/webaudio/AnalyserNode.cpp

Issue 173753002: Drop redundant 'ExceptionMessages::failedToXXX' calls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaseline. Created 6 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // (resulting in inputBus == outputBus). Otherwise, do an up-mix to stereo. 67 // (resulting in inputBus == outputBus). Otherwise, do an up-mix to stereo.
68 if (inputBus != outputBus) 68 if (inputBus != outputBus)
69 outputBus->copyFrom(*inputBus); 69 outputBus->copyFrom(*inputBus);
70 } 70 }
71 71
72 void AnalyserNode::setFftSize(unsigned size, ExceptionState& exceptionState) 72 void AnalyserNode::setFftSize(unsigned size, ExceptionState& exceptionState)
73 { 73 {
74 if (!m_analyser.setFftSize(size)) { 74 if (!m_analyser.setFftSize(size)) {
75 exceptionState.throwDOMException( 75 exceptionState.throwDOMException(
76 IndexSizeError, 76 IndexSizeError,
77 ExceptionMessages::failedToSet( 77 (size < RealtimeAnalyser::MinFFTSize || size > RealtimeAnalyser::Max FFTSize) ?
78 "fftSize", 78 ExceptionMessages::indexOutsideRange("FTT size", size, RealtimeA nalyser::MinFFTSize, ExceptionMessages::InclusiveBound, RealtimeAnalyser::MaxFFT Size, ExceptionMessages::InclusiveBound)
aandrey 2014/02/25 10:14:51 FTT -> FFT
79 "AnalyserNode", 79 : ("The value provided (" + String::number(size) + " is not a po wer of two."));
aandrey 2014/02/25 10:14:51 " is -> ") is
80 "FFT size (" + String::number(size)
81 + ") must be a power of two between "
82 + String::number(RealtimeAnalyser::MinFFTSize) + " and "
83 + String::number(RealtimeAnalyser::MaxFFTSize) + ", inclusive")) ;
84 } 80 }
85 } 81 }
86 82
87 void AnalyserNode::setMinDecibels(float k, ExceptionState& exceptionState) 83 void AnalyserNode::setMinDecibels(float k, ExceptionState& exceptionState)
88 { 84 {
89 if (k <= maxDecibels()) { 85 if (k <= maxDecibels()) {
90 m_analyser.setMinDecibels(k); 86 m_analyser.setMinDecibels(k);
91 } else { 87 } else {
92 exceptionState.throwDOMException( 88 exceptionState.throwDOMException(
93 IndexSizeError, 89 IndexSizeError,
94 ExceptionMessages::failedToSet( 90 ExceptionMessages::indexExceedsMaximumBound("minDecibels", k, maxDec ibels()));
95 "minDecibels",
96 "AnalyserNode",
97 "minDecibels (" + String::number(k)
98 + ") must be less than or equal maxDecibels (" + String::number( maxDecibels())
99 + ")."));
100 } 91 }
101 } 92 }
102 93
103 void AnalyserNode::setMaxDecibels(float k, ExceptionState& exceptionState) 94 void AnalyserNode::setMaxDecibels(float k, ExceptionState& exceptionState)
104 { 95 {
105 if (k >= minDecibels()) { 96 if (k >= minDecibels()) {
106 m_analyser.setMaxDecibels(k); 97 m_analyser.setMaxDecibels(k);
107 } else { 98 } else {
108 exceptionState.throwDOMException( 99 exceptionState.throwDOMException(
109 IndexSizeError, 100 IndexSizeError,
110 ExceptionMessages::failedToSet( 101 ExceptionMessages::indexExceedsMinimumBound("maxDecibels", k, minDec ibels()));
111 "maxDecibels",
112 "AnalyserNode",
113 "maxDecibels (" + String::number(k)
114 + ") must be greater than or equal minDecibels (" + String::numb er(minDecibels())
115 + ")."));
116 } 102 }
117 } 103 }
118 104
119 void AnalyserNode::setSmoothingTimeConstant(float k, ExceptionState& exceptionSt ate) 105 void AnalyserNode::setSmoothingTimeConstant(float k, ExceptionState& exceptionSt ate)
120 { 106 {
121 if (k >= 0 && k <= 1) { 107 if (k >= 0 && k <= 1) {
122 m_analyser.setSmoothingTimeConstant(k); 108 m_analyser.setSmoothingTimeConstant(k);
123 } else { 109 } else {
124 exceptionState.throwDOMException( 110 exceptionState.throwDOMException(
125 IndexSizeError, 111 IndexSizeError,
126 ExceptionMessages::failedToSet( 112 ExceptionMessages::indexOutsideRange("smoothing value", k, 0.0f, Exc eptionMessages::InclusiveBound, 1.0f, ExceptionMessages::InclusiveBound));
127 "smoothingTimeConstant",
128 "AnalyserNode",
129 "smoothing value (" + String::number(k)
130 + ") must be between 0 and 1, inclusive."));
131 } 113 }
132 } 114 }
133 115
134 } // namespace WebCore 116 } // namespace WebCore
135 117
136 #endif // ENABLE(WEB_AUDIO) 118 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/core/html/track/vtt/VTTCue.cpp ('k') | Source/modules/webaudio/DefaultAudioDestinationNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698