Make Performance Timeline API work in Workers

This commit is contained in:
Fernando Jiménez Moreno 2017-08-30 17:52:18 +02:00
parent 449ffb23ac
commit fb843c251a
20 changed files with 146 additions and 128 deletions

View file

@ -118,7 +118,7 @@ use task_source::dom_manipulation::{DOMManipulationTask, DOMManipulationTaskSour
use task_source::file_reading::FileReadingTaskSource;
use task_source::history_traversal::HistoryTraversalTaskSource;
use task_source::networking::NetworkingTaskSource;
use task_source::performance_timeline::{PerformanceTimelineTask, PerformanceTimelineTaskSource};
use task_source::performance_timeline::PerformanceTimelineTaskSource;
use task_source::user_interaction::{UserInteractionTask, UserInteractionTaskSource};
use time::{get_time, precise_time_ns, Tm};
use url::Position;
@ -272,8 +272,6 @@ pub enum MainThreadScriptMsg {
/// Notifies the script thread that a new worklet has been loaded, and thus the page should be
/// reflowed.
WorkletLoaded(PipelineId),
/// Tasks that originate from the performance timeline task source.
PerformanceTimeline(PerformanceTimelineTask),
}
impl OpaqueSender<CommonScriptMsg> for Box<ScriptChan + Send> {
@ -860,9 +858,9 @@ impl ScriptThread {
dom_manipulation_task_source: DOMManipulationTaskSource(chan.clone()),
user_interaction_task_source: UserInteractionTaskSource(chan.clone()),
networking_task_source: NetworkingTaskSource(boxed_script_sender.clone()),
history_traversal_task_source: HistoryTraversalTaskSource(chan.clone()),
file_reading_task_source: FileReadingTaskSource(boxed_script_sender),
performance_timeline_task_source: PerformanceTimelineTaskSource(chan),
history_traversal_task_source: HistoryTraversalTaskSource(chan),
file_reading_task_source: FileReadingTaskSource(boxed_script_sender.clone()),
performance_timeline_task_source: PerformanceTimelineTaskSource(boxed_script_sender),
control_chan: state.control_chan,
control_port: control_port,
@ -1192,6 +1190,7 @@ impl ScriptThread {
ScriptThreadEventCategory::ServiceWorkerEvent => ProfilerCategory::ScriptServiceWorkerEvent,
ScriptThreadEventCategory::EnterFullscreen => ProfilerCategory::ScriptEnterFullscreen,
ScriptThreadEventCategory::ExitFullscreen => ProfilerCategory::ScriptExitFullscreen,
ScriptThreadEventCategory::PerformanceTimelineTask => ProfilerCategory::ScriptPerformanceEvent,
};
profile(profiler_cat, None, self.time_profiler_chan.clone(), f)
} else {
@ -1295,8 +1294,6 @@ impl ScriptThread {
self.handle_worklet_loaded(pipeline_id),
MainThreadScriptMsg::DOMManipulation(task) =>
task.handle_task(self),
MainThreadScriptMsg::PerformanceTimeline(task) =>
task.handle_task(self),
MainThreadScriptMsg::UserInteraction(task) =>
task.handle_task(self),
}
@ -2009,7 +2006,6 @@ impl ScriptThread {
let DOMManipulationTaskSource(ref dom_sender) = self.dom_manipulation_task_source;
let UserInteractionTaskSource(ref user_sender) = self.user_interaction_task_source;
let HistoryTraversalTaskSource(ref history_sender) = self.history_traversal_task_source;
let PerformanceTimelineTaskSource(ref performance_sender) = self.performance_timeline_task_source;
let (ipc_timer_event_chan, ipc_timer_event_port) = ipc::channel().unwrap();
ROUTER.route_ipc_receiver_to_mpsc_sender(ipc_timer_event_port,
@ -2034,7 +2030,7 @@ impl ScriptThread {
self.networking_task_source.clone(),
HistoryTraversalTaskSource(history_sender.clone()),
self.file_reading_task_source.clone(),
PerformanceTimelineTaskSource(performance_sender.clone()),
self.performance_timeline_task_source.clone(),
self.image_cache_channel.clone(),
self.image_cache.clone(),
self.resource_threads.clone(),