mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Un-stub timer code
This commit is contained in:
parent
a2d9810b69
commit
fb3db6a72d
3 changed files with 26 additions and 26 deletions
|
@ -26,6 +26,8 @@ use std::comm::{Chan, SharedChan, Port};
|
||||||
use std::num::Orderable;
|
use std::num::Orderable;
|
||||||
use std::task;
|
use std::task;
|
||||||
use std::vec;
|
use std::vec;
|
||||||
|
use std::rt::rtio::RtioTimer;
|
||||||
|
use std::rt::io::timer::Timer;
|
||||||
use geom::matrix::identity;
|
use geom::matrix::identity;
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use geom::size::Size2D;
|
use geom::size::Size2D;
|
||||||
|
@ -480,6 +482,7 @@ impl CompositorTask {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Enter the main event loop.
|
// Enter the main event loop.
|
||||||
|
let tm = Timer::new().unwrap();
|
||||||
while !done {
|
while !done {
|
||||||
// Check for new messages coming from the rendering task.
|
// Check for new messages coming from the rendering task.
|
||||||
check_for_messages(&self.port);
|
check_for_messages(&self.port);
|
||||||
|
@ -492,10 +495,7 @@ impl CompositorTask {
|
||||||
composite();
|
composite();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
tm.sleep(10);
|
||||||
timer::sleep(&uv_global_loop::get(), 10);
|
|
||||||
*/
|
|
||||||
fail!("stubbed out!");
|
|
||||||
|
|
||||||
// If a pinch-zoom happened recently, ask for tiles at the new resolution
|
// If a pinch-zoom happened recently, ask for tiles at the new resolution
|
||||||
if zoom_action && precise_time_s() - zoom_time > 0.3 {
|
if zoom_action && precise_time_s() - zoom_time > 0.3 {
|
||||||
|
|
|
@ -49,6 +49,8 @@ pub use gfx::text;
|
||||||
pub use servo_util::url::make_url;
|
pub use servo_util::url::make_url;
|
||||||
use std::comm;
|
use std::comm;
|
||||||
use std::os;
|
use std::os;
|
||||||
|
use std::rt::rtio::RtioTimer;
|
||||||
|
use std::rt::io::timer::Timer;
|
||||||
|
|
||||||
#[path="compositing/mod.rs"]
|
#[path="compositing/mod.rs"]
|
||||||
pub mod compositing;
|
pub mod compositing;
|
||||||
|
@ -104,20 +106,17 @@ fn run(opts: &Opts) {
|
||||||
let (profiler_port, profiler_chan) = comm::stream();
|
let (profiler_port, profiler_chan) = comm::stream();
|
||||||
let profiler_chan = ProfilerChan::new(profiler_chan);
|
let profiler_chan = ProfilerChan::new(profiler_chan);
|
||||||
Profiler::create(profiler_port);
|
Profiler::create(profiler_port);
|
||||||
/*
|
do opts.profiler_period.map |&period| {
|
||||||
do opts.profiler_period.map |period| {
|
|
||||||
let profiler_chan = profiler_chan.clone();
|
let profiler_chan = profiler_chan.clone();
|
||||||
let period = *period;
|
let period = (period * 1000f) as u64;
|
||||||
do spawn {
|
do spawn {
|
||||||
|
let tm = Timer::new().unwrap();
|
||||||
loop {
|
loop {
|
||||||
extra::timer::sleep(&uv_global_loop::get(),
|
tm.sleep(period);
|
||||||
(period * 1000f) as uint);
|
|
||||||
profiler_chan.send(PrintMsg);
|
profiler_chan.send(PrintMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
fail!("stubbed out!");
|
|
||||||
|
|
||||||
// Create the compositor.
|
// Create the compositor.
|
||||||
let (compositor_port, compositor_chan) = comm::stream();
|
let (compositor_port, compositor_chan) = comm::stream();
|
||||||
|
|
|
@ -18,9 +18,12 @@ use js::{JSVAL_NULL, JSPROP_ENUMERATE};
|
||||||
|
|
||||||
use std::cast;
|
use std::cast;
|
||||||
use std::comm;
|
use std::comm;
|
||||||
use std::comm::Chan;
|
use std::comm::SharedChan;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
use std::int;
|
||||||
|
use std::rt::rtio::RtioTimer;
|
||||||
|
use std::rt::io::timer::Timer;
|
||||||
use js::jsapi::JSVal;
|
use js::jsapi::JSVal;
|
||||||
|
|
||||||
pub enum TimerControlMsg {
|
pub enum TimerControlMsg {
|
||||||
|
@ -35,7 +38,7 @@ pub struct Window {
|
||||||
script_chan: ScriptChan,
|
script_chan: ScriptChan,
|
||||||
compositor: @ScriptListener,
|
compositor: @ScriptListener,
|
||||||
wrapper: WrapperCache,
|
wrapper: WrapperCache,
|
||||||
timer_chan: Chan<TimerControlMsg>,
|
timer_chan: SharedChan<TimerControlMsg>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
@ -139,21 +142,19 @@ impl BindingObject for Window {
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
pub fn SetTimeout(&self, _cx: *JSContext, callback: JSVal, timeout: i32) -> i32 {
|
pub fn SetTimeout(&self, _cx: *JSContext, callback: JSVal, timeout: i32) -> i32 {
|
||||||
/*
|
let timeout = int::max(0, timeout) as u64;
|
||||||
let timeout = int::max(0, timeout) as uint;
|
|
||||||
|
|
||||||
// Post a delayed message to the per-window timer task; it will dispatch it
|
// Post a delayed message to the per-window timer task; it will dispatch it
|
||||||
// to the relevant script handler that will deal with it.
|
// to the relevant script handler that will deal with it.
|
||||||
let data = ~TimerData {
|
let tm = Timer::new().unwrap();
|
||||||
funval: callback,
|
let chan = self.timer_chan.clone();
|
||||||
args: ~[]
|
do spawn {
|
||||||
};
|
tm.sleep(timeout);
|
||||||
timer::delayed_send(&uv_global_loop::get(),
|
chan.send(TimerMessage_Fire(~TimerData {
|
||||||
timeout,
|
funval: callback,
|
||||||
&self.timer_chan,
|
args: ~[]
|
||||||
TimerMessage_Fire(data));
|
}));
|
||||||
*/
|
}
|
||||||
fail!("stubbed out!");
|
|
||||||
return 0; //TODO return handle into list of active timers
|
return 0; //TODO return handle into list of active timers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timer_chan
|
SharedChan::new(timer_chan)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue