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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioParam.cpp

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: update comment, add TODO 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 unified diff | Download patch
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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 ExceptionState& exception_state) { 462 ExceptionState& exception_state) {
463 WarnIfOutsideRange("setTargetAtTime value", target); 463 WarnIfOutsideRange("setTargetAtTime value", target);
464 Handler().Timeline().SetTargetAtTime(target, time, time_constant, 464 Handler().Timeline().SetTargetAtTime(target, time, time_constant,
465 exception_state); 465 exception_state);
466 466
467 // Don't update the histogram here. It's not clear in normal usage if the 467 // Don't update the histogram here. It's not clear in normal usage if the
468 // parameter value will actually reach |target|. 468 // parameter value will actually reach |target|.
469 return this; 469 return this;
470 } 470 }
471 471
472 AudioParam* AudioParam::setValueCurveAtTime(DOMFloat32Array* curve, 472 AudioParam* AudioParam::setValueCurveAtTime(NotShared<DOMFloat32Array> curve,
473 double time, 473 double time,
474 double duration, 474 double duration,
475 ExceptionState& exception_state) { 475 ExceptionState& exception_state) {
476 float* curve_data = curve->Data(); 476 float* curve_data = curve.View()->Data();
477 float min = minValue(); 477 float min = minValue();
478 float max = maxValue(); 478 float max = maxValue();
479 479
480 // First, find any non-finite value in the curve and throw an exception if 480 // First, find any non-finite value in the curve and throw an exception if
481 // there are any. 481 // there are any.
482 for (unsigned k = 0; k < curve->length(); ++k) { 482 for (unsigned k = 0; k < curve.View()->length(); ++k) {
483 float value = curve_data[k]; 483 float value = curve_data[k];
484 484
485 if (!std::isfinite(value)) { 485 if (!std::isfinite(value)) {
486 exception_state.ThrowDOMException( 486 exception_state.ThrowDOMException(
487 kV8TypeError, "The provided float value for the curve at element " + 487 kV8TypeError, "The provided float value for the curve at element " +
488 String::Number(k) + 488 String::Number(k) +
489 " is non-finite: " + String::Number(value)); 489 " is non-finite: " + String::Number(value));
490 return nullptr; 490 return nullptr;
491 } 491 }
492 } 492 }
493 493
494 // Second, find the first value in the curve (if any) that is outside the 494 // Second, find the first value in the curve (if any) that is outside the
495 // nominal range. It's probably not necessary to produce a warning on every 495 // nominal range. It's probably not necessary to produce a warning on every
496 // value outside the nominal range. 496 // value outside the nominal range.
497 for (unsigned k = 0; k < curve->length(); ++k) { 497 for (unsigned k = 0; k < curve.View()->length(); ++k) {
498 float value = curve_data[k]; 498 float value = curve_data[k];
499 499
500 if (value < min || value > max) { 500 if (value < min || value > max) {
501 WarnIfOutsideRange("setValueCurveAtTime value", value); 501 WarnIfOutsideRange("setValueCurveAtTime value", value);
502 break; 502 break;
503 } 503 }
504 } 504 }
505 505
506 Handler().Timeline().SetValueCurveAtTime(curve, time, duration, 506 Handler().Timeline().SetValueCurveAtTime(curve.View(), time, duration,
507 exception_state); 507 exception_state);
508 508
509 // We could update the histogram with every value in the curve, due to 509 // We could update the histogram with every value in the curve, due to
510 // interpolation, we'll probably be missing many values. So we don't update 510 // interpolation, we'll probably be missing many values. So we don't update
511 // the histogram. setValueCurveAtTime is probably a fairly rare method 511 // the histogram. setValueCurveAtTime is probably a fairly rare method
512 // anyway. 512 // anyway.
513 return this; 513 return this;
514 } 514 }
515 515
516 AudioParam* AudioParam::cancelScheduledValues(double start_time, 516 AudioParam* AudioParam::cancelScheduledValues(double start_time,
517 ExceptionState& exception_state) { 517 ExceptionState& exception_state) {
518 Handler().Timeline().CancelScheduledValues(start_time, exception_state); 518 Handler().Timeline().CancelScheduledValues(start_time, exception_state);
519 return this; 519 return this;
520 } 520 }
521 521
522 AudioParam* AudioParam::cancelAndHoldAtTime(double start_time, 522 AudioParam* AudioParam::cancelAndHoldAtTime(double start_time,
523 ExceptionState& exception_state) { 523 ExceptionState& exception_state) {
524 Handler().Timeline().CancelAndHoldAtTime(start_time, exception_state); 524 Handler().Timeline().CancelAndHoldAtTime(start_time, exception_state);
525 return this; 525 return this;
526 } 526 }
527 527
528 } // namespace blink 528 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698