mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
DOM bindings: Autogenerate list of prototypes and binding registration goop.
This commit is contained in:
parent
65f9aefb78
commit
4f24ef1619
12 changed files with 262 additions and 84 deletions
|
@ -2,7 +2,13 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::utils::{WrapperCache};
|
||||
use dom::bindings::utils::{WrapperCache, BindingObject, CacheableWrapper};
|
||||
use dom::bindings::codegen::BlobBinding;
|
||||
use script_task::{task_from_context};
|
||||
|
||||
use js::jsapi::{JSContext, JSObject};
|
||||
|
||||
use std::cast;
|
||||
|
||||
pub struct Blob {
|
||||
wrapper: WrapperCache
|
||||
|
@ -15,3 +21,23 @@ impl Blob {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CacheableWrapper for Blob {
|
||||
fn get_wrappercache(&mut self) -> &mut WrapperCache {
|
||||
unsafe { cast::transmute(&self.wrapper) }
|
||||
}
|
||||
|
||||
fn wrap_object_shared(@mut self, cx: *JSContext, scope: *JSObject) -> *JSObject {
|
||||
let mut unused = false;
|
||||
BlobBinding::Wrap(cx, scope, self, &mut unused)
|
||||
}
|
||||
}
|
||||
|
||||
impl BindingObject for Blob {
|
||||
fn GetParentObject(&self, cx: *JSContext) -> @mut CacheableWrapper {
|
||||
let script_context = task_from_context(cx);
|
||||
unsafe {
|
||||
(*script_context).root_frame.get_ref().window as @mut CacheableWrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue