mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Introduce CallbackObject::new().
This commit is contained in:
parent
aa93260f1e
commit
11c21d3b1d
1 changed files with 11 additions and 7 deletions
|
@ -33,12 +33,20 @@ pub enum ExceptionHandling {
|
||||||
|
|
||||||
/// A common base class for representing IDL callback function and
|
/// A common base class for representing IDL callback function and
|
||||||
/// callback interface types.
|
/// callback interface types.
|
||||||
#[derive(JSTraceable)]
|
#[derive(Default, JSTraceable)]
|
||||||
struct CallbackObject {
|
struct CallbackObject {
|
||||||
/// The underlying `JSObject`.
|
/// The underlying `JSObject`.
|
||||||
callback: Heap<*mut JSObject>,
|
callback: Heap<*mut JSObject>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CallbackObject {
|
||||||
|
fn new() -> CallbackObject {
|
||||||
|
CallbackObject {
|
||||||
|
callback: Heap::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PartialEq for CallbackObject {
|
impl PartialEq for CallbackObject {
|
||||||
fn eq(&self, other: &CallbackObject) -> bool {
|
fn eq(&self, other: &CallbackObject) -> bool {
|
||||||
self.callback.get() == other.callback.get()
|
self.callback.get() == other.callback.get()
|
||||||
|
@ -66,9 +74,7 @@ impl CallbackFunction {
|
||||||
/// Create a new `CallbackFunction` for this object.
|
/// Create a new `CallbackFunction` for this object.
|
||||||
pub fn new() -> CallbackFunction {
|
pub fn new() -> CallbackFunction {
|
||||||
CallbackFunction {
|
CallbackFunction {
|
||||||
object: CallbackObject {
|
object: CallbackObject::new(),
|
||||||
callback: Heap::default(),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,9 +101,7 @@ impl CallbackInterface {
|
||||||
/// Create a new CallbackInterface object for the given `JSObject`.
|
/// Create a new CallbackInterface object for the given `JSObject`.
|
||||||
pub fn new() -> CallbackInterface {
|
pub fn new() -> CallbackInterface {
|
||||||
CallbackInterface {
|
CallbackInterface {
|
||||||
object: CallbackObject {
|
object: CallbackObject::new(),
|
||||||
callback: Heap::default(),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue