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

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

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
index d55f92cb1be9ce48800ab23a2fc2785b7c136972..5e24ff553bef183865a195ebb96e8bedf887acd7 100644
--- a/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/PeriodicWave.cpp
@@ -81,13 +81,22 @@ PeriodicWave* PeriodicWave::create(BaseAudioContext& context,
return periodicWave;
}
-PeriodicWave* PeriodicWave::create(BaseAudioContext& context,
- DOMFloat32Array* real,
- DOMFloat32Array* imag,
- bool disableNormalization,
- ExceptionState& exceptionState) {
+PeriodicWave* PeriodicWave::create(
+ BaseAudioContext& context,
+ const MaybeShared<DOMFloat32Array>& realMaybeShared,
+ const MaybeShared<DOMFloat32Array>& imagMaybeShared,
+ bool disableNormalization,
+ ExceptionState& exceptionState) {
DCHECK(isMainThread());
+ if (realMaybeShared.isShared() || imagMaybeShared.isShared()) {
+ exceptionState.throwTypeError(
+ "real and imag should not be backed by a SharedArrayBuffer.");
+ return nullptr;
+ }
+ DOMFloat32Array* real = realMaybeShared.viewNotShared();
+ DOMFloat32Array* imag = imagMaybeShared.viewNotShared();
+
return create(context, real->length(), real->data(), imag->length(),
imag->data(), disableNormalization, exceptionState);
}

Powered by Google App Engine
This is Rietveld 408576698