mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Support arbitrary protos when wrapping DOM objects with constructors.
This commit is contained in:
parent
d9600ff50f
commit
dbff26bce0
197 changed files with 2028 additions and 586 deletions
|
@ -14,14 +14,14 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
|||
use crate::dom::bindings::error::{Error, Fallible};
|
||||
use crate::dom::bindings::num::Finite;
|
||||
use crate::dom::bindings::refcounted::Trusted;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::window::Window;
|
||||
use crate::task_source::TaskSource;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::{self, IpcReceiver};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::rust::CustomAutoRooterGuard;
|
||||
use js::rust::{CustomAutoRooterGuard, HandleObject};
|
||||
use js::typedarray::{Float32Array, Uint8Array};
|
||||
use servo_media::audio::analyser_node::AnalysisEngine;
|
||||
use servo_media::audio::block::Block;
|
||||
|
@ -89,14 +89,23 @@ impl AnalyserNode {
|
|||
))
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new(
|
||||
window: &Window,
|
||||
context: &BaseAudioContext,
|
||||
options: &AnalyserOptions,
|
||||
) -> Fallible<DomRoot<AnalyserNode>> {
|
||||
Self::new_with_proto(window, None, context, options)
|
||||
}
|
||||
|
||||
#[allow(unrooted_must_root)]
|
||||
pub fn new_with_proto(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
context: &BaseAudioContext,
|
||||
options: &AnalyserOptions,
|
||||
) -> Fallible<DomRoot<AnalyserNode>> {
|
||||
let (node, recv) = AnalyserNode::new_inherited(window, context, options)?;
|
||||
let object = reflect_dom_object(Box::new(node), window);
|
||||
let object = reflect_dom_object2(Box::new(node), window, proto);
|
||||
let (source, canceller) = window
|
||||
.task_manager()
|
||||
.dom_manipulation_task_source_with_canceller();
|
||||
|
@ -122,10 +131,11 @@ impl AnalyserNode {
|
|||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
context: &BaseAudioContext,
|
||||
options: &AnalyserOptions,
|
||||
) -> Fallible<DomRoot<AnalyserNode>> {
|
||||
AnalyserNode::new(window, context, options)
|
||||
AnalyserNode::new_with_proto(window, proto, context, options)
|
||||
}
|
||||
|
||||
pub fn push_block(&self, block: Block) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue