mirror of
https://github.com/servo/servo.git
synced 2025-07-31 19:20:22 +01:00
auto merge of #5193 : nnethercote/servo/measure-display-list, r=jdm
These changeset implements the beginnings of fine-grained measurement of Servo's data structures. @pcwalton, @jdm: are you likely reviewers for this?
This commit is contained in:
commit
f093620922
14 changed files with 475 additions and 46 deletions
|
@ -13,6 +13,7 @@ use geom::rect::Rect;
|
|||
use script_traits::{ScriptControlChan, OpaqueScriptLayoutChannel, UntrustedNodeAddress};
|
||||
use msg::constellation_msg::{PipelineExitType, WindowSizeData};
|
||||
use util::geometry::Au;
|
||||
use util::memory::{MemoryReporter, MemoryReportsChan};
|
||||
use std::any::Any;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::boxed::BoxAny;
|
||||
|
@ -44,6 +45,10 @@ pub enum Msg {
|
|||
/// TODO(pcwalton): Maybe think about batching to avoid message traffic.
|
||||
ReapLayoutData(LayoutData),
|
||||
|
||||
/// Requests that the layout task measure its memory usage. The resulting reports are sent back
|
||||
/// via the supplied channel.
|
||||
CollectMemoryReports(MemoryReportsChan),
|
||||
|
||||
/// Requests that the layout task enter a quiescent state in which no more messages are
|
||||
/// accepted except `ExitMsg`. A response message will be sent on the supplied channel when
|
||||
/// this happens.
|
||||
|
@ -128,6 +133,14 @@ impl LayoutChan {
|
|||
}
|
||||
}
|
||||
|
||||
impl MemoryReporter for LayoutChan {
|
||||
// Just injects an appropriate event into the layout task's queue.
|
||||
fn collect_reports(&self, reports_chan: MemoryReportsChan) -> bool {
|
||||
let LayoutChan(ref c) = *self;
|
||||
c.send(Msg::CollectMemoryReports(reports_chan)).is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait to manage opaque references to script<->layout channels without needing
|
||||
/// to expose the message type to crates that don't need to know about them.
|
||||
pub trait ScriptLayoutChan {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue