mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Auto merge of #8903 - KiChjang:layout-reporter-redirect, r=nox
fix for Layout memory reporter uses pre-redirect url Rebase of #7612. Fixes #6872. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8903) <!-- Reviewable:end -->
This commit is contained in:
commit
bc7158310c
3 changed files with 27 additions and 12 deletions
|
@ -55,6 +55,7 @@ use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayou
|
|||
use sequential;
|
||||
use serde_json;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_state::DefaultState;
|
||||
use std::mem::transmute;
|
||||
|
@ -119,7 +120,7 @@ pub struct LayoutTask {
|
|||
id: PipelineId,
|
||||
|
||||
/// The URL of the pipeline that we belong to.
|
||||
url: Url,
|
||||
url: RefCell<Url>,
|
||||
|
||||
/// Is the current reflow of an iframe, as opposed to a root window?
|
||||
is_iframe: bool,
|
||||
|
@ -404,7 +405,7 @@ impl LayoutTask {
|
|||
|
||||
LayoutTask {
|
||||
id: id,
|
||||
url: url,
|
||||
url: RefCell::new(url),
|
||||
is_iframe: is_iframe,
|
||||
port: port,
|
||||
pipeline_port: pipeline_receiver,
|
||||
|
@ -567,7 +568,7 @@ impl LayoutTask {
|
|||
};
|
||||
let mut layout_context = self.build_shared_layout_context(&*rw_data,
|
||||
false,
|
||||
&self.url,
|
||||
&self.url.borrow(),
|
||||
reflow_info.goal);
|
||||
|
||||
self.perform_post_style_recalc_layout_passes(&reflow_info,
|
||||
|
@ -625,6 +626,9 @@ impl LayoutTask {
|
|||
Msg::CreateLayoutTask(info) => {
|
||||
self.create_layout_task(info)
|
||||
}
|
||||
Msg::SetFinalUrl(final_url) => {
|
||||
*self.url.borrow_mut() = final_url;
|
||||
},
|
||||
Msg::PrepareToExit(response_chan) => {
|
||||
self.prepare_to_exit(response_chan);
|
||||
return false
|
||||
|
@ -647,15 +651,16 @@ impl LayoutTask {
|
|||
// FIXME(njn): Just measuring the display tree for now.
|
||||
let rw_data = possibly_locked_rw_data.lock();
|
||||
let stacking_context = rw_data.stacking_context.as_ref();
|
||||
let ref formatted_url = format!("url({})", *self.url.borrow());
|
||||
reports.push(Report {
|
||||
path: path![format!("url({})", self.url), "layout-task", "display-list"],
|
||||
path: path![formatted_url, "layout-task", "display-list"],
|
||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||
size: stacking_context.map_or(0, |sc| sc.heap_size_of_children()),
|
||||
});
|
||||
|
||||
// The LayoutTask has a context in TLS...
|
||||
reports.push(Report {
|
||||
path: path![format!("url({})", self.url), "layout-task", "local-context"],
|
||||
path: path![formatted_url, "layout-task", "local-context"],
|
||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||
size: heap_size_of_local_context(),
|
||||
});
|
||||
|
@ -665,7 +670,7 @@ impl LayoutTask {
|
|||
let sizes = traversal.heap_size_of_tls(heap_size_of_local_context);
|
||||
for (i, size) in sizes.iter().enumerate() {
|
||||
reports.push(Report {
|
||||
path: path![format!("url({})", self.url),
|
||||
path: path![formatted_url,
|
||||
format!("layout-worker-{}-local-context", i)],
|
||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||
size: *size,
|
||||
|
@ -912,7 +917,7 @@ impl LayoutTask {
|
|||
let document = unsafe { ServoLayoutNode::new(&data.document) };
|
||||
let document = document.as_document().unwrap();
|
||||
|
||||
debug!("layout: received layout request for: {}", self.url.serialize());
|
||||
debug!("layout: received layout request for: {}", self.url.borrow().serialize());
|
||||
|
||||
let mut rw_data = possibly_locked_rw_data.lock();
|
||||
|
||||
|
@ -943,6 +948,8 @@ impl LayoutTask {
|
|||
Some(x) => x,
|
||||
};
|
||||
|
||||
debug!("layout: received layout request for: {}",
|
||||
self.url.borrow().serialize());
|
||||
if log_enabled!(log::LogLevel::Debug) {
|
||||
node.dump();
|
||||
}
|
||||
|
@ -1007,7 +1014,7 @@ impl LayoutTask {
|
|||
// Create a layout context for use throughout the following passes.
|
||||
let mut shared_layout_context = self.build_shared_layout_context(&*rw_data,
|
||||
viewport_size_changed,
|
||||
&self.url,
|
||||
&self.url.borrow(),
|
||||
data.reflow_info.goal);
|
||||
|
||||
if node.is_dirty() || node.has_dirty_descendants() {
|
||||
|
@ -1120,7 +1127,7 @@ impl LayoutTask {
|
|||
|
||||
let mut layout_context = self.build_shared_layout_context(&*rw_data,
|
||||
false,
|
||||
&self.url,
|
||||
&self.url.borrow(),
|
||||
reflow_info.goal);
|
||||
|
||||
self.perform_post_main_layout_passes(&reflow_info, &mut *rw_data, &mut layout_context);
|
||||
|
@ -1144,7 +1151,7 @@ impl LayoutTask {
|
|||
|
||||
let mut layout_context = self.build_shared_layout_context(&*rw_data,
|
||||
false,
|
||||
&self.url,
|
||||
&self.url.borrow(),
|
||||
reflow_info.goal);
|
||||
|
||||
if let Some(mut root_flow) = self.root_flow.clone() {
|
||||
|
@ -1175,7 +1182,7 @@ impl LayoutTask {
|
|||
|
||||
let mut layout_context = self.build_shared_layout_context(&*rw_data,
|
||||
false,
|
||||
&self.url,
|
||||
&self.url.borrow(),
|
||||
reflow_info.goal);
|
||||
|
||||
// No need to do a style recalc here.
|
||||
|
@ -1299,7 +1306,7 @@ impl LayoutTask {
|
|||
/// Returns profiling information which is passed to the time profiler.
|
||||
fn profiler_metadata(&self) -> Option<TimerMetadata> {
|
||||
Some(TimerMetadata {
|
||||
url: self.url.serialize(),
|
||||
url: self.url.borrow().serialize(),
|
||||
iframe: if self.is_iframe {
|
||||
TimerMetadataFrameType::IFrame
|
||||
} else {
|
||||
|
|
|
@ -85,6 +85,9 @@ pub enum Msg {
|
|||
///
|
||||
/// This basically exists to keep the script-layout dependency one-way.
|
||||
CreateLayoutTask(NewLayoutTaskInfo),
|
||||
|
||||
/// Set the final Url.
|
||||
SetFinalUrl(Url),
|
||||
}
|
||||
|
||||
/// Synchronous messages that script can send to layout.
|
||||
|
|
|
@ -1558,6 +1558,11 @@ impl ScriptTask {
|
|||
/// objects, parses HTML and CSS, and kicks off initial layout.
|
||||
fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> ParserRoot {
|
||||
let final_url = metadata.final_url.clone();
|
||||
{
|
||||
// send the final url to the layout task.
|
||||
let LayoutChan(ref chan) = incomplete.layout_chan;
|
||||
chan.send(layout_interface::Msg::SetFinalUrl(final_url.clone())).unwrap();
|
||||
}
|
||||
debug!("ScriptTask: loading {} on page {:?}", incomplete.url.serialize(), incomplete.pipeline_id);
|
||||
|
||||
// We should either be initializing a root page or loading a child page of an
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue