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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp

Issue 2789883002: setValueCurveAtTime takes sequence<float> for curve (Closed)
Patch Set: Rebaseline test results Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
index 026c7ccd722453dd2508b8de28dc6e05f47f2a4e..2e89cce3bcc90c6fc1935964d655e0b8ad438ac0 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
@@ -202,11 +202,11 @@ AudioParamTimeline::ParamEvent::CreateSetTargetEvent(float value,
std::unique_ptr<AudioParamTimeline::ParamEvent>
AudioParamTimeline::ParamEvent::CreateSetValueCurveEvent(
- const DOMFloat32Array* curve,
+ const Vector<float>& curve,
double time,
double duration) {
- double curve_points = (curve->length() - 1) / duration;
- float end_value = curve->Data()[curve->length() - 1];
+ double curve_points = (curve.size() - 1) / duration;
+ float end_value = curve.Data()[curve.size() - 1];
return WTF::WrapUnique(new ParamEvent(ParamEvent::kSetValueCurve, time,
duration, curve, curve_points,
@@ -361,7 +361,7 @@ AudioParamTimeline::ParamEvent::ParamEvent(ParamEvent::Type type,
AudioParamTimeline::ParamEvent::ParamEvent(ParamEvent::Type type,
double time,
double duration,
- const DOMFloat32Array* curve,
+ const Vector<float>& curve,
double curve_points_per_second,
float curve_end_value)
: type_(type),
@@ -377,11 +377,9 @@ AudioParamTimeline::ParamEvent::ParamEvent(ParamEvent::Type type,
needs_time_clamp_check_(true),
has_default_cancelled_value_(false) {
DCHECK_EQ(type, ParamEvent::kSetValueCurve);
- if (curve) {
- unsigned curve_length = curve->length();
- curve_.Resize(curve->length());
- memcpy(curve_.Data(), curve->Data(), curve_length * sizeof(float));
- }
+ unsigned curve_length = curve.size();
+ curve_.Resize(curve_length);
+ memcpy(curve_.Data(), curve.Data(), curve_length * sizeof(float));
}
// Create CancelValues event
@@ -483,21 +481,21 @@ void AudioParamTimeline::SetTargetAtTime(float target,
}
}
-void AudioParamTimeline::SetValueCurveAtTime(DOMFloat32Array* curve,
+void AudioParamTimeline::SetValueCurveAtTime(const Vector<float>& curve,
double time,
double duration,
ExceptionState& exception_state) {
DCHECK(IsMainThread());
- DCHECK(curve);
if (!IsNonNegativeAudioParamTime(time, exception_state) ||
!IsPositiveAudioParamTime(duration, exception_state, "Duration"))
return;
- if (curve->length() < 2) {
+ if (curve.size() < 2) {
exception_state.ThrowDOMException(
- kInvalidStateError, ExceptionMessages::IndexExceedsMinimumBound(
- "curve length", curve->length(), 2U));
+ kInvalidStateError,
+ ExceptionMessages::IndexExceedsMinimumBound(
+ "curve length", curve.size(), static_cast<size_t>(2)));
return;
}
@@ -508,8 +506,8 @@ void AudioParamTimeline::SetValueCurveAtTime(DOMFloat32Array* curve,
// Insert a setValueAtTime event too to establish an event so that all
// following events will process from the end of the curve instead of the
// beginning.
- InsertEvent(ParamEvent::CreateSetValueEvent(
- curve->Data()[curve->length() - 1], time + duration),
+ InsertEvent(ParamEvent::CreateSetValueEvent(curve.Data()[curve.size() - 1],
+ time + duration),
exception_state);
}
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698