auto merge of #1005 : jdm/servo/failfixes, r=metajack

Fixes #1004. I haven't seen the other ones be reported, but I saw often saw `task <unnamed> failed at 'RenderChan.send: render port closed', /home/jdm/sdb/servo/src/components/gfx/render_task.rs:76`, `task <unnamed> failed at 'receiving on closed channel', /home/jdm/sdb/servo/src/compiler/rust/src/libstd/rt/comm.rs:487`, and failed assertions due to layout running after we had begun tearing down the window.
This commit is contained in:
bors-servo 2013-10-01 23:54:50 -07:00
commit 096af85834
5 changed files with 16 additions and 9 deletions

View file

@ -801,7 +801,7 @@ impl Constellation {
fn set_ids(&self, frame_tree: @mut FrameTree) { fn set_ids(&self, frame_tree: @mut FrameTree) {
let (port, chan) = comm::stream(); let (port, chan) = comm::stream();
self.compositor_chan.send(SetIds(frame_tree.to_sendable(), chan, self.chan.clone())); self.compositor_chan.send(SetIds(frame_tree.to_sendable(), chan, self.chan.clone()));
port.recv(); port.try_recv();
for frame in frame_tree.iter() { for frame in frame_tree.iter() {
frame.pipeline.grant_paint_permission(); frame.pipeline.grant_paint_permission();
} }

View file

@ -200,7 +200,7 @@ impl Pipeline {
} }
pub fn grant_paint_permission(&self) { pub fn grant_paint_permission(&self) {
self.render_chan.send(PaintPermissionGranted); self.render_chan.try_send(PaintPermissionGranted);
} }
pub fn revoke_paint_permission(&self) { pub fn revoke_paint_permission(&self) {

View file

@ -4027,7 +4027,7 @@ def finalizeHook(descriptor, hookName, context):
pass pass
else: else:
assert descriptor.nativeIsISupports assert descriptor.nativeIsISupports
release = """let val = JS_GetReservedSlot(obj, 0); release = """let val = JS_GetReservedSlot(obj, dom_object_slot(obj));
let _: @mut %s = cast::transmute(RUST_JSVAL_TO_PRIVATE(val)); let _: @mut %s = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
debug!("%s finalize: %%p", this); debug!("%s finalize: %%p", this);
""" % (descriptor.concreteType, descriptor.concreteType) """ % (descriptor.concreteType, descriptor.concreteType)

View file

@ -121,14 +121,19 @@ pub fn is_dom_proxy(obj: *JSObject) -> bool {
} }
#[fixed_stack_segment] #[fixed_stack_segment]
pub unsafe fn unwrap<T>(obj: *JSObject) -> T { pub unsafe fn dom_object_slot(obj: *JSObject) -> u32 {
let clasp = JS_GetClass(obj); let clasp = JS_GetClass(obj);
let slot = if is_dom_class(clasp) { if is_dom_class(clasp) {
DOM_OBJECT_SLOT DOM_OBJECT_SLOT as u32
} else { } else {
assert!(is_dom_proxy(obj)); assert!(is_dom_proxy(obj));
DOM_PROXY_OBJECT_SLOT DOM_PROXY_OBJECT_SLOT as u32
} as u32; }
}
#[fixed_stack_segment]
pub unsafe fn unwrap<T>(obj: *JSObject) -> T {
let slot = dom_object_slot(obj);
let val = JS_GetReservedSlot(obj, slot); let val = JS_GetReservedSlot(obj, slot);
cast::transmute(RUST_JSVAL_TO_PRIVATE(val)) cast::transmute(RUST_JSVAL_TO_PRIVATE(val))
} }

View file

@ -629,7 +629,9 @@ impl ScriptTask {
} }
} }
fn handle_exit_window_msg(&mut self, _id: PipelineId) -> bool { fn handle_exit_window_msg(&mut self, id: PipelineId) -> bool {
self.handle_exit_pipeline_msg(id);
// TODO(tkuehn): currently there is only one window, // TODO(tkuehn): currently there is only one window,
// so this can afford to be naive and just shut down the // so this can afford to be naive and just shut down the
// compositor. In the future it'll need to be smarter. // compositor. In the future it'll need to be smarter.