mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Remove CollectMemoryReports from compositor (fixes #13735)
This commit is contained in:
parent
f7875dad1a
commit
1985ad6d85
3 changed files with 2 additions and 38 deletions
|
@ -17,11 +17,9 @@ use gleam::gl;
|
||||||
use gleam::gl::types::{GLint, GLsizei};
|
use gleam::gl::types::{GLint, GLsizei};
|
||||||
use image::{DynamicImage, ImageFormat, RgbImage};
|
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||||
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
||||||
use ipc_channel::router::ROUTER;
|
|
||||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, CONTROL};
|
use msg::constellation_msg::{Key, KeyModifiers, KeyState, CONTROL};
|
||||||
use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId, TraversalDirection};
|
use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId, TraversalDirection};
|
||||||
use net_traits::image::base::{Image, PixelFormat};
|
use net_traits::image::base::{Image, PixelFormat};
|
||||||
use profile_traits::mem::{self, Reporter, ReporterRequest};
|
|
||||||
use profile_traits::time::{self, ProfilerCategory, profile};
|
use profile_traits::time::{self, ProfilerCategory, profile};
|
||||||
use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg};
|
use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg};
|
||||||
use script_traits::{ConstellationMsg, LayoutControlMsg, LoadData, MouseButton};
|
use script_traits::{ConstellationMsg, LayoutControlMsg, LoadData, MouseButton};
|
||||||
|
@ -184,9 +182,6 @@ pub struct IOCompositor<Window: WindowMethods> {
|
||||||
/// The channel on which messages can be sent to the time profiler.
|
/// The channel on which messages can be sent to the time profiler.
|
||||||
time_profiler_chan: time::ProfilerChan,
|
time_profiler_chan: time::ProfilerChan,
|
||||||
|
|
||||||
/// The channel on which messages can be sent to the memory profiler.
|
|
||||||
mem_profiler_chan: mem::ProfilerChan,
|
|
||||||
|
|
||||||
/// Touch input state machine
|
/// Touch input state machine
|
||||||
touch_handler: TouchHandler,
|
touch_handler: TouchHandler,
|
||||||
|
|
||||||
|
@ -312,10 +307,6 @@ fn initialize_png(width: usize, height: usize) -> RenderTargetInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reporter_name() -> String {
|
|
||||||
"compositor-reporter".to_owned()
|
|
||||||
}
|
|
||||||
|
|
||||||
struct RenderNotifier {
|
struct RenderNotifier {
|
||||||
compositor_proxy: Box<CompositorProxy>,
|
compositor_proxy: Box<CompositorProxy>,
|
||||||
constellation_chan: Sender<ConstellationMsg>,
|
constellation_chan: Sender<ConstellationMsg>,
|
||||||
|
@ -368,23 +359,6 @@ impl webrender_traits::RenderDispatcher for CompositorThreadDispatcher {
|
||||||
impl<Window: WindowMethods> IOCompositor<Window> {
|
impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
fn new(window: Rc<Window>, state: InitialCompositorState)
|
fn new(window: Rc<Window>, state: InitialCompositorState)
|
||||||
-> IOCompositor<Window> {
|
-> IOCompositor<Window> {
|
||||||
// Register this thread as a memory reporter, via its own channel.
|
|
||||||
let (reporter_sender, reporter_receiver) = ipc::channel()
|
|
||||||
.expect("Compositor reporter chan");
|
|
||||||
let compositor_proxy_for_memory_reporter = state.sender.clone_compositor_proxy();
|
|
||||||
ROUTER.add_route(reporter_receiver.to_opaque(), box move |reporter_request| {
|
|
||||||
match reporter_request.to::<ReporterRequest>() {
|
|
||||||
Err(e) => error!("Cast to ReporterRequest failed ({}).", e),
|
|
||||||
Ok(reporter_request) => {
|
|
||||||
let msg = Msg::CollectMemoryReports(reporter_request.reports_channel);
|
|
||||||
compositor_proxy_for_memory_reporter.send(msg);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let reporter = Reporter(reporter_sender);
|
|
||||||
state.mem_profiler_chan.send(
|
|
||||||
mem::ProfilerMsg::RegisterReporter(reporter_name(), reporter));
|
|
||||||
|
|
||||||
let window_size = window.framebuffer_size();
|
let window_size = window.framebuffer_size();
|
||||||
let scale_factor = window.scale_factor();
|
let scale_factor = window.scale_factor();
|
||||||
let composite_target = match opts::get().output_file {
|
let composite_target = match opts::get().output_file {
|
||||||
|
@ -419,7 +393,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
frame_tree_id: FrameTreeId(0),
|
frame_tree_id: FrameTreeId(0),
|
||||||
constellation_chan: state.constellation_chan,
|
constellation_chan: state.constellation_chan,
|
||||||
time_profiler_chan: state.time_profiler_chan,
|
time_profiler_chan: state.time_profiler_chan,
|
||||||
mem_profiler_chan: state.mem_profiler_chan,
|
|
||||||
last_composite_time: 0,
|
last_composite_time: 0,
|
||||||
ready_to_save_state: ReadyState::Unknown,
|
ready_to_save_state: ReadyState::Unknown,
|
||||||
scroll_in_progress: false,
|
scroll_in_progress: false,
|
||||||
|
@ -461,8 +434,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
warn!("Sending exit message to constellation failed ({}).", e);
|
warn!("Sending exit message to constellation failed ({}).", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.mem_profiler_chan.send(mem::ProfilerMsg::UnregisterReporter(reporter_name()));
|
|
||||||
|
|
||||||
self.shutdown_state = ShutdownState::ShuttingDown;
|
self.shutdown_state = ShutdownState::ShuttingDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,7 +452,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
},
|
},
|
||||||
Err(_) => {},
|
Err(_) => {},
|
||||||
}
|
}
|
||||||
self.mem_profiler_chan.send(mem::ProfilerMsg::Exit);
|
|
||||||
self.delayed_composition_timer.shutdown();
|
self.delayed_composition_timer.shutdown();
|
||||||
|
|
||||||
self.shutdown_state = ShutdownState::FinishedShuttingDown;
|
self.shutdown_state = ShutdownState::FinishedShuttingDown;
|
||||||
|
@ -636,11 +606,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
self.window.head_parsed();
|
self.window.head_parsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
(Msg::CollectMemoryReports(reports_chan), ShutdownState::NotShuttingDown) => {
|
|
||||||
let reports = vec![];
|
|
||||||
reports_chan.send(reports);
|
|
||||||
}
|
|
||||||
|
|
||||||
(Msg::PipelineVisibilityChanged(pipeline_id, visible), ShutdownState::NotShuttingDown) => {
|
(Msg::PipelineVisibilityChanged(pipeline_id, visible), ShutdownState::NotShuttingDown) => {
|
||||||
self.pipeline_details(pipeline_id).visible = visible;
|
self.pipeline_details(pipeline_id).visible = visible;
|
||||||
if visible {
|
if visible {
|
||||||
|
|
|
@ -105,8 +105,6 @@ pub enum Msg {
|
||||||
NewFavicon(Url),
|
NewFavicon(Url),
|
||||||
/// <head> tag finished parsing
|
/// <head> tag finished parsing
|
||||||
HeadParsed,
|
HeadParsed,
|
||||||
/// Collect memory reports and send them back to the given mem::ReportsChan.
|
|
||||||
CollectMemoryReports(mem::ReportsChan),
|
|
||||||
/// A status message to be displayed by the browser chrome.
|
/// A status message to be displayed by the browser chrome.
|
||||||
Status(Option<String>),
|
Status(Option<String>),
|
||||||
/// Get Window Informations size and position
|
/// Get Window Informations size and position
|
||||||
|
@ -154,7 +152,6 @@ impl Debug for Msg {
|
||||||
Msg::IsReadyToSaveImageReply(..) => write!(f, "IsReadyToSaveImageReply"),
|
Msg::IsReadyToSaveImageReply(..) => write!(f, "IsReadyToSaveImageReply"),
|
||||||
Msg::NewFavicon(..) => write!(f, "NewFavicon"),
|
Msg::NewFavicon(..) => write!(f, "NewFavicon"),
|
||||||
Msg::HeadParsed => write!(f, "HeadParsed"),
|
Msg::HeadParsed => write!(f, "HeadParsed"),
|
||||||
Msg::CollectMemoryReports(..) => write!(f, "CollectMemoryReports"),
|
|
||||||
Msg::Status(..) => write!(f, "Status"),
|
Msg::Status(..) => write!(f, "Status"),
|
||||||
Msg::GetClientWindow(..) => write!(f, "GetClientWindow"),
|
Msg::GetClientWindow(..) => write!(f, "GetClientWindow"),
|
||||||
Msg::MoveTo(..) => write!(f, "MoveTo"),
|
Msg::MoveTo(..) => write!(f, "MoveTo"),
|
||||||
|
|
|
@ -1025,6 +1025,8 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
||||||
if self.shutting_down { return; }
|
if self.shutting_down { return; }
|
||||||
self.shutting_down = true;
|
self.shutting_down = true;
|
||||||
|
|
||||||
|
self.mem_profiler_chan.send(mem::ProfilerMsg::Exit);
|
||||||
|
|
||||||
// TODO: exit before the root frame is initialized?
|
// TODO: exit before the root frame is initialized?
|
||||||
debug!("Removing root frame.");
|
debug!("Removing root frame.");
|
||||||
let root_frame_id = self.root_frame_id;
|
let root_frame_id = self.root_frame_id;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue