aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/gfx/render_task.rs
diff options
context:
space:
mode:
authorKeegan McAllister <kmcallister@mozilla.com>2014-02-11 16:15:19 -0800
committerKeegan McAllister <kmcallister@mozilla.com>2014-02-12 18:07:32 -0800
commit36b8f6398448b7f75705edc10061dde9402fe7af (patch)
treeadb3da36e07346910d3d3c28492f9427ae2e7868 /src/components/gfx/render_task.rs
parent68cc30c1dfe8ae8ceb2dc9f3ea3e5836119acc4f (diff)
downloadservo-36b8f6398448b7f75705edc10061dde9402fe7af.tar.gz
servo-36b8f6398448b7f75705edc10061dde9402fe7af.zip
Restore failure handling
We probably leak some threads and resources, e.g. when the script task crashes and doesn't get a chance to send layout data back to layout to be deallocated. Not tested with iframes yet.
Diffstat (limited to 'src/components/gfx/render_task.rs')
-rw-r--r--src/components/gfx/render_task.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/components/gfx/render_task.rs b/src/components/gfx/render_task.rs
index eb7ab90ef37..297c4f5517a 100644
--- a/src/components/gfx/render_task.rs
+++ b/src/components/gfx/render_task.rs
@@ -15,12 +15,14 @@ use layers;
use servo_msg::compositor_msg::{Epoch, IdleRenderState, LayerBuffer, LayerBufferSet};
use servo_msg::compositor_msg::{RenderListener, RenderingRenderState};
use servo_msg::constellation_msg::{ConstellationChan, PipelineId, RendererReadyMsg};
+use servo_msg::constellation_msg::{Failure, FailureMsg};
use servo_msg::platform::surface::NativeSurfaceAzureMethods;
use servo_util::time::{ProfilerChan, profile};
use servo_util::time;
-use servo_util::task::spawn_named;
+use servo_util::task::send_on_failure;
use std::comm::{Chan, Port, SharedChan};
+use std::task;
use extra::arc::Arc;
use buffer_map::BufferMap;
@@ -41,7 +43,7 @@ pub enum Msg<T> {
UnusedBufferMsg(~[~LayerBuffer]),
PaintPermissionGranted,
PaintPermissionRevoked,
- ExitMsg(Chan<()>),
+ ExitMsg(Option<Chan<()>>),
}
/// A request from the compositor to the renderer for tiles that need to be (re)displayed.
@@ -143,10 +145,14 @@ impl<C: RenderListener + Send,T:Send+Freeze> RenderTask<C,T> {
port: Port<Msg<T>>,
compositor: C,
constellation_chan: ConstellationChan,
+ failure_msg: Failure,
opts: Opts,
profiler_chan: ProfilerChan,
shutdown_chan: Chan<()>) {
- spawn_named("RenderTask", proc() {
+ let mut builder = task::task();
+ send_on_failure(&mut builder, FailureMsg(failure_msg), (*constellation_chan).clone());
+ builder.name("RenderTask");
+ builder.spawn(proc() {
{ // Ensures RenderTask and graphics context are destroyed before shutdown msg
let native_graphics_context = compositor.get_graphics_metadata().map(
@@ -237,7 +243,7 @@ impl<C: RenderListener + Send,T:Send+Freeze> RenderTask<C,T> {
}
ExitMsg(response_ch) => {
debug!("render_task: exitmsg response send");
- response_ch.send(());
+ response_ch.map(|ch| ch.send(()));
break;
}
}