diff options
Diffstat (limited to 'components/servo/lib.rs')
-rw-r--r-- | components/servo/lib.rs | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 44eb62e51fc..71848f165a0 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -60,7 +60,6 @@ fn webdriver(port: u16, constellation: Sender<ConstellationMsg>) { #[cfg(not(feature = "webdriver"))] fn webdriver(_port: u16, _constellation: Sender<ConstellationMsg>) {} -use background_hang_monitor::HangMonitorRegister; use bluetooth::BluetoothThreadFactory; use bluetooth_traits::BluetoothRequest; use canvas::gl_context::GLContextFactory; @@ -133,6 +132,7 @@ pub struct Servo<Window: WindowMethods + 'static> { constellation_chan: Sender<ConstellationMsg>, embedder_receiver: EmbedderReceiver, embedder_events: Vec<(Option<BrowserId>, EmbedderMsg)>, + profiler_enabled: bool, } #[derive(Clone)] @@ -319,6 +319,7 @@ where constellation_chan: constellation_chan, embedder_receiver: embedder_receiver, embedder_events: Vec::new(), + profiler_enabled: false, } } @@ -407,6 +408,18 @@ where } }, + WindowEvent::ToggleSamplingProfiler(rate) => { + self.profiler_enabled = !self.profiler_enabled; + let msg = if self.profiler_enabled { + ConstellationMsg::EnableProfiler(rate) + } else { + ConstellationMsg::DisableProfiler + }; + if let Err(e) = self.constellation_chan.send(msg) { + warn!("Sending profiler toggle to constellation failed ({:?}).", e); + } + }, + WindowEvent::ToggleWebRenderDebug(option) => { self.compositor.toggle_webrender_debug(option); }, @@ -711,7 +724,7 @@ pub fn run_content_process(token: String) { .send(unprivileged_content_sender) .unwrap(); - let unprivileged_content = unprivileged_content_receiver.recv().unwrap(); + let mut unprivileged_content = unprivileged_content_receiver.recv().unwrap(); opts::set_options(unprivileged_content.opts()); prefs::pref_map() .set_all(unprivileged_content.prefs()) @@ -723,11 +736,8 @@ pub fn run_content_process(token: String) { create_sandbox(); } - let background_hang_monitor_register = HangMonitorRegister::init( - unprivileged_content - .background_hang_monitor_to_constellation_chan() - .clone(), - ); + let background_hang_monitor_register = + unprivileged_content.register_with_background_hang_monitor(); // send the required channels to the service worker manager let sw_senders = unprivileged_content.swmanager_senders(); |