Simplify devtools frame marker notification. Record each frame tick based on a single message sent from the script task that ticked.

This commit is contained in:
Josh Matthews 2015-08-12 00:56:36 -04:00
parent 47b9e89c66
commit e59de75608
8 changed files with 33 additions and 72 deletions

View file

@ -4,7 +4,7 @@
use devtools_traits::{CachedConsoleMessage, CachedConsoleMessageTypes, PAGE_ERROR, CONSOLE_API};
use devtools_traits::{EvaluateJSReply, NodeInfo, Modification, TimelineMarker, TimelineMarkerType};
use devtools_traits::{ConsoleAPI, PageError};
use devtools_traits::{ConsoleAPI, PageError, ScriptToDevtoolsControlMsg};
use dom::bindings::conversions::jsstring_to_str;
use dom::bindings::conversions::FromJSValConvertible;
use dom::bindings::js::Root;
@ -202,10 +202,13 @@ pub fn handle_drop_timeline_markers(page: &Rc<Page>,
}
}
pub fn handle_request_animation_frame(page: &Rc<Page>, id: PipelineId, callback: IpcSender<f64>) {
pub fn handle_request_animation_frame(page: &Rc<Page>, id: PipelineId, actor_name: String) {
let page = page.find(id).expect("There is no such page");
let doc = page.document();
let devtools_sender = page.window().devtools_chan();
doc.r().request_animation_frame(box move |time| {
callback.send(time).unwrap()
devtools_sender.unwrap()
.send(ScriptToDevtoolsControlMsg::FramerateTick(actor_name, time))
.unwrap();
});
}