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

Implement async fetching of extenal script sources via interruptible parsing. #5197

Closed
wants to merge 14 commits into from

scripttask tmp

  • Loading branch information
jdm committed Mar 5, 2015
commit eb34a7811a977633946c44ab3f03027ce6856b9a
@@ -85,7 +85,7 @@ use url::Url;
use libc;
use std::any::Any;
use std::borrow::ToOwned;
use std::cell::Cell;
use std::cell::{RefCell, Cell};
use std::num::ToPrimitive;
use std::rc::Rc;
use std::result::Result;
@@ -94,6 +94,7 @@ use std::u32;
use time::Tm;

thread_local!(pub static STACK_ROOTS: Cell<Option<RootCollectionPtr>> = Cell::new(None));
thread_local!(static SCRIPT_TASK_ROOT: RefCell<Option<*const ScriptTask>> = RefCell::new(None));

/// A document load that is in the process of fetching the requested resource. Contains
/// data that will need to be present when the document and frame tree entry are created,
@@ -347,6 +348,11 @@ impl ScriptTaskFactory for ScriptTask {
storage_task,
image_cache_task,
devtools_chan);
SCRIPT_TASK_ROOT.with(|root| {
let mut root = root.borrow_mut();
*root = Some(&script_task as *const _);
});

let mut failsafe = ScriptMemoryFailsafe::new(&script_task);

let new_load = InProgressLoad::new(id, None, layout_chan, window_size,
@@ -1212,6 +1218,15 @@ impl ScriptTask {
}
}

impl Drop for ScriptTask {
fn drop(&mut self) {
SCRIPT_TASK_ROOT.with(|root| {
let mut root = root.borrow_mut();
*root = None;
});
}
}

/// Shuts down layout for the given page tree.
fn shut_down_layout(page_tree: &Rc<Page>, exit_type: PipelineExitType) {
let mut channels = vec!();
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.