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

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

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: add some layout tests 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) 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
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(NotShared<DOMFloat32Array> curve,
96 ExceptionState& exceptionState) { 96 ExceptionState& exceptionState) {
97 DCHECK(isMainThread()); 97 DCHECK(isMainThread());
98 98
99 if (curve) 99 if (curve.view())
100 setCurveImpl(curve->data(), curve->length(), exceptionState); 100 setCurveImpl(curve.view()->data(), curve.view()->length(), exceptionState);
101 else 101 else
102 setCurveImpl(nullptr, 0, exceptionState); 102 setCurveImpl(nullptr, 0, exceptionState);
103 } 103 }
104 104
105 void WaveShaperNode::setCurve(const Vector<float>& curve, 105 void WaveShaperNode::setCurve(const Vector<float>& curve,
106 ExceptionState& exceptionState) { 106 ExceptionState& exceptionState) {
107 DCHECK(isMainThread()); 107 DCHECK(isMainThread());
108 108
109 setCurveImpl(curve.data(), curve.size(), exceptionState); 109 setCurveImpl(curve.data(), curve.size(), exceptionState);
110 } 110 }
111 111
112 DOMFloat32Array* WaveShaperNode::curve() { 112 NotShared<DOMFloat32Array> WaveShaperNode::curve() {
113 Vector<float>* curve = getWaveShaperProcessor()->curve(); 113 Vector<float>* curve = getWaveShaperProcessor()->curve();
114 if (!curve) 114 if (!curve)
115 return nullptr; 115 return NotShared<DOMFloat32Array>(nullptr);
116 116
117 unsigned size = curve->size(); 117 unsigned size = curve->size();
118 RefPtr<WTF::Float32Array> newCurve = WTF::Float32Array::create(size); 118 RefPtr<WTF::Float32Array> newCurve = WTF::Float32Array::create(size);
119 119
120 memcpy(newCurve->data(), curve->data(), sizeof(float) * size); 120 memcpy(newCurve->data(), curve->data(), sizeof(float) * size);
121 121
122 return DOMFloat32Array::create(newCurve.release()); 122 return NotShared<DOMFloat32Array>(
123 DOMFloat32Array::create(newCurve.release()));
123 } 124 }
124 125
125 void WaveShaperNode::setOversample(const String& type) { 126 void WaveShaperNode::setOversample(const String& type) {
126 DCHECK(isMainThread()); 127 DCHECK(isMainThread());
127 128
128 // This is to synchronize with the changes made in 129 // This is to synchronize with the changes made in
129 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can 130 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can
130 // initialize() and uninitialize(). 131 // initialize() and uninitialize().
131 BaseAudioContext::AutoLocker contextLocker(context()); 132 BaseAudioContext::AutoLocker contextLocker(context());
132 133
(...skipping 19 matching lines...) Expand all
152 return "2x"; 153 return "2x";
153 case WaveShaperProcessor::OverSample4x: 154 case WaveShaperProcessor::OverSample4x:
154 return "4x"; 155 return "4x";
155 default: 156 default:
156 ASSERT_NOT_REACHED(); 157 ASSERT_NOT_REACHED();
157 return "none"; 158 return "none";
158 } 159 }
159 } 160 }
160 161
161 } // namespace blink 162 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698