mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-25 19:25:43 +00:00
Bug 1542931 serialize AudioWorkletNodeOptions r=padenot
Depends on D34478 Differential Revision: https://phabricator.services.mozilla.com/D34479 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
53e03975c9
commit
4891262c8d
@ -80,6 +80,27 @@ already_AddRefed<AudioWorkletNode> AudioWorkletNode::Constructor(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 7. Let optionsSerialization be the result of StructuredSerialize(options).
|
||||
*/
|
||||
JSContext* cx = aGlobal.Context();
|
||||
JS::Rooted<JS::Value> optionsVal(cx);
|
||||
if (NS_WARN_IF(!ToJSValue(cx, aOptions, &optionsVal))) {
|
||||
aRv.NoteJSContextException(cx);
|
||||
return nullptr;
|
||||
}
|
||||
// StructuredCloneHolder does not have a move constructor. Instead allocate
|
||||
// memory so that the pointer can be passed to the rendering thread.
|
||||
UniquePtr<StructuredCloneHolder> optionsSerialization =
|
||||
MakeUnique<StructuredCloneHolder>(
|
||||
StructuredCloneHolder::CloningSupported,
|
||||
StructuredCloneHolder::TransferringNotSupported,
|
||||
JS::StructuredCloneScope::SameProcessDifferentThread);
|
||||
optionsSerialization->Write(cx, optionsVal, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return audioWorkletNode.forget();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user