Implement a ProfilerActor struct.

This is sufficient to make the profiler tab show up in Firefox's devtools.
This commit is contained in:
Ms2ger 2015-08-13 15:36:13 +02:00
parent 9fda72d60f
commit c10bf0dcaa
3 changed files with 46 additions and 2 deletions

View file

@ -41,6 +41,7 @@ use actors::console::ConsoleActor;
use actors::network_event::{NetworkEventActor, EventActor, ResponseStartMsg};
use actors::framerate::FramerateActor;
use actors::inspector::InspectorActor;
use actors::profiler::ProfilerActor;
use actors::root::RootActor;
use actors::tab::TabActor;
use actors::timeline::TimelineActor;
@ -73,6 +74,7 @@ mod actors {
pub mod memory;
pub mod network_event;
pub mod object;
pub mod profiler;
pub mod root;
pub mod tab;
pub mod timeline;
@ -203,7 +205,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
let (pipeline, worker_id) = ids;
//TODO: move all this actor creation into a constructor method on TabActor
let (tab, console, inspector, timeline) = {
let (tab, console, inspector, timeline, profiler) = {
let console = ConsoleActor {
name: actors.new_name("console"),
script_chan: script_sender.clone(),
@ -224,6 +226,8 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
script_sender,
devtools_sender);
let profiler = ProfilerActor::new(actors.new_name("profiler"));
let DevtoolsPageInfo { title, url } = page_info;
let tab = TabActor {
name: actors.new_name("tab"),
@ -232,11 +236,13 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
console: console.name(),
inspector: inspector.name(),
timeline: timeline.name(),
profiler: profiler.name(),
};
let root = actors.find_mut::<RootActor>("root");
root.tabs.push(tab.name.clone());
(tab, console, inspector, timeline)
(tab, console, inspector, timeline, profiler)
};
if let Some(id) = worker_id {
@ -254,6 +260,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
actors.register(box console);
actors.register(box inspector);
actors.register(box timeline);
actors.register(box profiler);
}
fn handle_console_message(actors: Arc<Mutex<ActorRegistry>>,