Run all task spawning through util, to allow for easy hooking.

During debugging, I found it useful to hook all task creation in a
central location, and util::task was the perfect place for it.

r? @pcwalton (or maybe someone else, I'm kinda sending you a bunch of
reviews today because I don't know who better to give them to)
This commit is contained in:
Clark Gaebel 2014-10-28 09:53:45 -07:00
parent 9e94ecf99c
commit 6df1cc8e4c
14 changed files with 48 additions and 36 deletions

View file

@ -24,6 +24,7 @@ use script_task::WorkerPostMessage;
use script_task::StackRootTLS;
use servo_net::resource_task::{ResourceTask, load_whole_resource};
use servo_util::task::spawn_named_native;
use servo_util::task_state;
use servo_util::task_state::{Script, InWorker};
@ -34,8 +35,6 @@ use js::rust::Cx;
use std::rc::Rc;
use std::ptr;
use std::task::TaskBuilder;
use native::task::NativeTaskBuilder;
use url::Url;
#[dom_struct]
@ -88,10 +87,7 @@ impl DedicatedWorkerGlobalScope {
parent_sender: ScriptChan,
own_sender: ScriptChan,
receiver: Receiver<ScriptMsg>) {
TaskBuilder::new()
.native()
.named(format!("Web Worker at {}", worker_url.serialize()))
.spawn(proc() {
spawn_named_native(format!("Web worker for {}", worker_url.serialize()), proc() {
task_state::initialize(Script | InWorker);