deactive profiler when not in use; use newtype structs for task chans

This commit is contained in:
Tim Kuehn 2013-09-19 21:29:23 -04:00
parent 17864cb25d
commit c804db0f93
7 changed files with 55 additions and 92 deletions

View file

@ -30,6 +30,7 @@ use std::int;
use std::libc;
use std::rt::rtio::RtioTimer;
use std::rt::io::timer::Timer;
use std::task::spawn_with;
use js::jsapi::JSVal;
pub enum TimerControlMsg {
@ -198,21 +199,20 @@ impl Window {
compositor: @ScriptListener,
image_cache_task: ImageCacheTask)
-> @mut Window {
let script_chan_clone = script_chan.clone();
let win = @mut Window {
page: page,
script_chan: script_chan,
script_chan: script_chan.clone(),
compositor: compositor,
wrapper: WrapperCache::new(),
timer_chan: {
let (timer_port, timer_chan) = comm::stream::<TimerControlMsg>();
let id = page.id.clone();
do spawn {
do spawn_with(script_chan) |script_chan| {
loop {
match timer_port.recv() {
TimerMessage_Close => break,
TimerMessage_Fire(td) => script_chan_clone.chan.send(FireTimerMsg(id, td)),
TimerMessage_TriggerExit => script_chan_clone.chan.send(ExitMsg),
TimerMessage_Fire(td) => script_chan.send(FireTimerMsg(id, td)),
TimerMessage_TriggerExit => script_chan.send(ExitMsg),
}
}
}