Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade SpiderMonkey #2455

Closed
wants to merge 7 commits into from
Prev

Reenable send_on_failure for the script task.

  • Loading branch information
jdm committed May 23, 2014
commit f2fb06e3928bb1d2420256ea435bd3275bd9c616
@@ -176,7 +176,7 @@ impl<C: RenderListener + Send> RenderTask<C> {
shutdown_chan: Sender<()>) {
let mut builder = task::task().named("RenderTask");
let ConstellationChan(c) = constellation_chan.clone();
send_on_failure(&mut builder, FailureMsg(failure_msg), c);
send_on_failure(&mut builder.opts, FailureMsg(failure_msg), c);
builder.spawn(proc() {

{ // Ensures RenderTask and graphics context are destroyed before shutdown msg
@@ -289,7 +289,7 @@ impl LayoutTask {
shutdown_chan: Sender<()>) {
let mut builder = task::task().named("LayoutTask");
let ConstellationChan(con_chan) = constellation_chan.clone();
send_on_failure(&mut builder, FailureMsg(failure_msg), con_chan);
send_on_failure(&mut builder.opts, FailureMsg(failure_msg), con_chan);
builder.spawn(proc() {
{ // Ensures layout task is destroyed before we send shutdown message
let mut layout = LayoutTask::new(id,
@@ -46,13 +46,13 @@ use native;
use servo_msg::compositor_msg::{FinishedLoading, LayerId, Loading, PerformingLayout};
use servo_msg::compositor_msg::{ScriptListener};
use servo_msg::constellation_msg::{ConstellationChan, LoadCompleteMsg, LoadUrlMsg, NavigationDirection};
use servo_msg::constellation_msg::{PipelineId, SubpageId, Failure, /*FailureMsg*/};
use servo_msg::constellation_msg::{PipelineId, SubpageId, Failure, FailureMsg};
use servo_msg::constellation_msg;
use servo_net::image_cache_task::ImageCacheTask;
use servo_net::resource_task::ResourceTask;
use servo_util::geometry::to_frac_px;
use servo_util::url::parse_url;
//use servo_util::task::send_on_failure;
use servo_util::task::send_on_failure;
use servo_util::namespace::Null;
use std::cast;
use std::cell::{Cell, RefCell, Ref, RefMut};
@@ -676,7 +676,7 @@ impl ScriptTask {
let mut opts = task::TaskOpts::new();
opts.name = Some(Slice("ScriptTask"));
let ConstellationChan(const_chan) = constellation_chan.clone();
//send_on_failure(&mut builder, FailureMsg(failure_msg), const_chan);
send_on_failure(&mut opts, FailureMsg(failure_msg), const_chan);
native::task::spawn_opts(opts, proc() {
let script_task = ScriptTask::new(id,
compositor as ~ScriptListener,
@@ -4,8 +4,8 @@

use std::str::IntoMaybeOwned;
use std::task;
use std::comm::Sender;
use std::task::TaskBuilder;
use std::comm::{channel, Sender};
use std::task::TaskOpts;

pub fn spawn_named<S: IntoMaybeOwned<'static>>(name: S, f: proc():Send) {
let builder = task::task().named(name);
@@ -14,12 +14,14 @@ pub fn spawn_named<S: IntoMaybeOwned<'static>>(name: S, f: proc():Send) {

/// Arrange to send a particular message to a channel if the task built by
/// this `TaskBuilder` fails.
pub fn send_on_failure<T: Send>(builder: &mut TaskBuilder, msg: T, dest: Sender<T>) {
let port = builder.future_result();
let watched_name = builder.opts.name.as_ref().unwrap().as_slice().to_owned();
pub fn send_on_failure<T: Send>(opts: &mut TaskOpts, msg: T, dest: Sender<T>) {
assert!(opts.notify_chan.is_none());
let (tx, rx) = channel();
opts.notify_chan = Some(tx);
let watched_name = opts.name.as_ref().unwrap().as_slice().to_owned();
let name = format!("{:s}Watcher", watched_name);
spawn_named(name, proc() {
match port.recv() {
match rx.recv() {
Ok(()) => (),
Err(..) => {
debug!("{:s} failed, notifying constellation", watched_name);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.