diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-03-16 21:33:50 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-03-16 21:33:50 -0600 |
commit | f093620922621e1877393b03968ed0ce767fdf12 (patch) | |
tree | 0588ee917cca56ea4a4a8ea93b93afbdd4814168 /components/script | |
parent | 990a965ddfba254bb1b58664b27f2056fa9654f5 (diff) | |
parent | fa9ca206efefea850ef1d8c8b43513653ff07507 (diff) | |
download | servo-f093620922621e1877393b03968ed0ce767fdf12.tar.gz servo-f093620922621e1877393b03968ed0ce767fdf12.zip |
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?
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/layout_interface.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs index e6e448dd800..52b5aed1b43 100644 --- a/components/script/layout_interface.rs +++ b/components/script/layout_interface.rs @@ -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 { |