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
|
||||
/// callback interface types.
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(Default, JSTraceable)]
|
||||
struct CallbackObject {
|
||||
/// The underlying `JSObject`.
|
||||
callback: Heap<*mut JSObject>,
|
||||
}
|
||||
|
||||
impl CallbackObject {
|
||||
fn new() -> CallbackObject {
|
||||
CallbackObject {
|
||||
callback: Heap::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq for CallbackObject {
|
||||
fn eq(&self, other: &CallbackObject) -> bool {
|
||||
self.callback.get() == other.callback.get()
|
||||
|
@ -66,9 +74,7 @@ impl CallbackFunction {
|
|||
/// Create a new `CallbackFunction` for this object.
|
||||
pub fn new() -> CallbackFunction {
|
||||
CallbackFunction {
|
||||
object: CallbackObject {
|
||||
callback: Heap::default(),
|
||||
},
|
||||
object: CallbackObject::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,9 +101,7 @@ impl CallbackInterface {
|
|||
/// Create a new CallbackInterface object for the given `JSObject`.
|
||||
pub fn new() -> CallbackInterface {
|
||||
CallbackInterface {
|
||||
object: CallbackObject {
|
||||
callback: Heap::default(),
|
||||
},
|
||||
object: CallbackObject::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue