OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 exceptionState.throwDOMException( | 85 exceptionState.throwDOMException( |
86 InvalidAccessError, | 86 InvalidAccessError, |
87 ExceptionMessages::indexExceedsMinimumBound<unsigned>("curve length", | 87 ExceptionMessages::indexExceedsMinimumBound<unsigned>("curve length", |
88 curveLength, 2)); | 88 curveLength, 2)); |
89 return; | 89 return; |
90 } | 90 } |
91 | 91 |
92 getWaveShaperProcessor()->setCurve(curveData, curveLength); | 92 getWaveShaperProcessor()->setCurve(curveData, curveLength); |
93 } | 93 } |
94 | 94 |
95 void WaveShaperNode::setCurve(DOMFloat32Array* curve, | 95 void WaveShaperNode::setCurve(const MaybeShared<DOMFloat32Array>& maybeShared, |
96 ExceptionState& exceptionState) { | 96 ExceptionState& exceptionState) { |
97 DCHECK(isMainThread()); | 97 DCHECK(isMainThread()); |
98 | 98 |
| 99 if (maybeShared.isShared()) { |
| 100 exceptionState.throwTypeError( |
| 101 "curve should not be backed by a SharedArrayBuffer."); |
| 102 return; |
| 103 } |
| 104 DOMFloat32Array* curve = maybeShared.viewNotShared(); |
| 105 |
99 if (curve) | 106 if (curve) |
100 setCurveImpl(curve->data(), curve->length(), exceptionState); | 107 setCurveImpl(curve->data(), curve->length(), exceptionState); |
101 else | 108 else |
102 setCurveImpl(nullptr, 0, exceptionState); | 109 setCurveImpl(nullptr, 0, exceptionState); |
103 } | 110 } |
104 | 111 |
105 void WaveShaperNode::setCurve(const Vector<float>& curve, | 112 void WaveShaperNode::setCurve(const Vector<float>& curve, |
106 ExceptionState& exceptionState) { | 113 ExceptionState& exceptionState) { |
107 DCHECK(isMainThread()); | 114 DCHECK(isMainThread()); |
108 | 115 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return "2x"; | 159 return "2x"; |
153 case WaveShaperProcessor::OverSample4x: | 160 case WaveShaperProcessor::OverSample4x: |
154 return "4x"; | 161 return "4x"; |
155 default: | 162 default: |
156 ASSERT_NOT_REACHED(); | 163 ASSERT_NOT_REACHED(); |
157 return "none"; | 164 return "none"; |
158 } | 165 } |
159 } | 166 } |
160 | 167 |
161 } // namespace blink | 168 } // namespace blink |
OLD | NEW |