aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-07-15 16:04:26 +0200
committerMs2ger <ms2ger@gmail.com>2014-07-15 22:29:03 +0200
commit2d74f4d8d8c6ee02129dccb5875c82cb63c1c526 (patch)
tree8beaa5267faf2321ec6c528935c68e86fc109203
parent25abe8b289e967b3fcd7bc57040a2432646fb2bd (diff)
downloadservo-2d74f4d8d8c6ee02129dccb5875c82cb63c1c526.tar.gz
servo-2d74f4d8d8c6ee02129dccb5875c82cb63c1c526.zip
Spawn a thread for workers.
-rw-r--r--src/components/script/dom/worker.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/components/script/dom/worker.rs b/src/components/script/dom/worker.rs
index 5a62f1c37f4..09b5072a06d 100644
--- a/src/components/script/dom/worker.rs
+++ b/src/components/script/dom/worker.rs
@@ -11,6 +11,8 @@ use dom::eventtarget::EventTarget;
use servo_util::str::DOMString;
use servo_util::url::try_parse_url;
+use std::task::TaskBuilder;
+
#[deriving(Encodable)]
pub struct Worker {
eventtarget: EventTarget,
@@ -19,11 +21,15 @@ pub struct Worker {
impl Worker {
pub fn Constructor(global: &GlobalRef, scriptURL: DOMString) -> Fallible<Temporary<Worker>> {
// Step 2-4.
- let _worker_url = match try_parse_url(scriptURL.as_slice(), Some(global.get_url())) {
+ let worker_url = match try_parse_url(scriptURL.as_slice(), Some(global.get_url())) {
Ok(url) => url,
Err(_) => return Err(Syntax),
};
+ let name = format!("Web Worker at {}", worker_url);
+ TaskBuilder::new().named(name).spawn(proc() {
+ println!("Spawned!");
+ });
Err(Security)
}
}