mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
fix for Layout memory reporter uses pre-redirect url #6872
This commit is contained in:
parent
8ba470d79f
commit
239f1ae1a7
3 changed files with 28 additions and 8 deletions
|
@ -54,6 +54,7 @@ use script_traits::{ConstellationControlMsg, LayoutControlMsg, OpaqueScriptLayou
|
||||||
use sequential;
|
use sequential;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
|
use std::cell::{Cell, RefCell};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::collections::hash_state::DefaultState;
|
use std::collections::hash_state::DefaultState;
|
||||||
use std::mem::transmute;
|
use std::mem::transmute;
|
||||||
|
@ -119,7 +120,7 @@ pub struct LayoutTask {
|
||||||
id: PipelineId,
|
id: PipelineId,
|
||||||
|
|
||||||
/// The URL of the pipeline that we belong to.
|
/// The URL of the pipeline that we belong to.
|
||||||
url: Url,
|
url: RefCell<Option<Url>>,
|
||||||
|
|
||||||
/// Is the current reflow of an iframe, as opposed to a root window?
|
/// Is the current reflow of an iframe, as opposed to a root window?
|
||||||
is_iframe: bool,
|
is_iframe: bool,
|
||||||
|
@ -404,7 +405,7 @@ impl LayoutTask {
|
||||||
|
|
||||||
LayoutTask {
|
LayoutTask {
|
||||||
id: id,
|
id: id,
|
||||||
url: url,
|
url: RefCell::new(Some(url)),
|
||||||
is_iframe: is_iframe,
|
is_iframe: is_iframe,
|
||||||
port: port,
|
port: port,
|
||||||
pipeline_port: pipeline_receiver,
|
pipeline_port: pipeline_receiver,
|
||||||
|
@ -625,6 +626,10 @@ impl LayoutTask {
|
||||||
Msg::CreateLayoutTask(info) => {
|
Msg::CreateLayoutTask(info) => {
|
||||||
self.create_layout_task(info)
|
self.create_layout_task(info)
|
||||||
}
|
}
|
||||||
|
Msg::SetFinalUrl(final_url) => {
|
||||||
|
let mut url_ref_cell = self.url.borrow_mut();
|
||||||
|
*url_ref_cell = Some(final_url);
|
||||||
|
},
|
||||||
Msg::PrepareToExit(response_chan) => {
|
Msg::PrepareToExit(response_chan) => {
|
||||||
self.prepare_to_exit(response_chan);
|
self.prepare_to_exit(response_chan);
|
||||||
return false
|
return false
|
||||||
|
@ -647,15 +652,17 @@ impl LayoutTask {
|
||||||
// FIXME(njn): Just measuring the display tree for now.
|
// FIXME(njn): Just measuring the display tree for now.
|
||||||
let rw_data = possibly_locked_rw_data.lock();
|
let rw_data = possibly_locked_rw_data.lock();
|
||||||
let stacking_context = rw_data.stacking_context.as_ref();
|
let stacking_context = rw_data.stacking_context.as_ref();
|
||||||
|
let ref formatted_url = *self.url.borrow().as_ref().map_or("url(None)".to_owned(),
|
||||||
|
|url| format!("url({})", url));
|
||||||
reports.push(Report {
|
reports.push(Report {
|
||||||
path: path![format!("url({})", self.url), "layout-task", "display-list"],
|
path: path![formatted_url, "layout-task", "display-list"],
|
||||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||||
size: stacking_context.map_or(0, |sc| sc.heap_size_of_children()),
|
size: stacking_context.map_or(0, |sc| sc.heap_size_of_children()),
|
||||||
});
|
});
|
||||||
|
|
||||||
// The LayoutTask has a context in TLS...
|
// The LayoutTask has a context in TLS...
|
||||||
reports.push(Report {
|
reports.push(Report {
|
||||||
path: path![format!("url({})", self.url), "layout-task", "local-context"],
|
path: path![formatted_url, "layout-task", "local-context"],
|
||||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||||
size: heap_size_of_local_context(),
|
size: heap_size_of_local_context(),
|
||||||
});
|
});
|
||||||
|
@ -665,7 +672,7 @@ impl LayoutTask {
|
||||||
let sizes = traversal.heap_size_of_tls(heap_size_of_local_context);
|
let sizes = traversal.heap_size_of_tls(heap_size_of_local_context);
|
||||||
for (i, size) in sizes.iter().enumerate() {
|
for (i, size) in sizes.iter().enumerate() {
|
||||||
reports.push(Report {
|
reports.push(Report {
|
||||||
path: path![format!("url({})", self.url),
|
path: path![formatted_url,
|
||||||
format!("layout-worker-{}-local-context", i)],
|
format!("layout-worker-{}-local-context", i)],
|
||||||
kind: ReportKind::ExplicitJemallocHeapSize,
|
kind: ReportKind::ExplicitJemallocHeapSize,
|
||||||
size: *size,
|
size: *size,
|
||||||
|
@ -943,6 +950,8 @@ impl LayoutTask {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
debug!("layout: received layout request for: {}",
|
||||||
|
self.url.borrow().as_ref().map_or("None".to_owned(), |url| url.serialize()));
|
||||||
if log_enabled!(log::LogLevel::Debug) {
|
if log_enabled!(log::LogLevel::Debug) {
|
||||||
node.dump();
|
node.dump();
|
||||||
}
|
}
|
||||||
|
@ -1005,9 +1014,10 @@ impl LayoutTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a layout context for use throughout the following passes.
|
// Create a layout context for use throughout the following passes.
|
||||||
|
let url_clone = &self.url.borrow().as_ref().unwrap().clone();
|
||||||
let mut shared_layout_context = self.build_shared_layout_context(&*rw_data,
|
let mut shared_layout_context = self.build_shared_layout_context(&*rw_data,
|
||||||
viewport_size_changed,
|
viewport_size_changed,
|
||||||
&self.url,
|
url_clone,
|
||||||
data.reflow_info.goal);
|
data.reflow_info.goal);
|
||||||
|
|
||||||
if node.is_dirty() || node.has_dirty_descendants() {
|
if node.is_dirty() || node.has_dirty_descendants() {
|
||||||
|
@ -1118,9 +1128,10 @@ impl LayoutTask {
|
||||||
page_clip_rect: MAX_RECT,
|
page_clip_rect: MAX_RECT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let url_clone = &self.url.borrow().as_ref().unwrap().clone();
|
||||||
let mut layout_context = self.build_shared_layout_context(&*rw_data,
|
let mut layout_context = self.build_shared_layout_context(&*rw_data,
|
||||||
false,
|
false,
|
||||||
&self.url,
|
url_clone,
|
||||||
reflow_info.goal);
|
reflow_info.goal);
|
||||||
|
|
||||||
self.perform_post_main_layout_passes(&reflow_info, &mut *rw_data, &mut layout_context);
|
self.perform_post_main_layout_passes(&reflow_info, &mut *rw_data, &mut layout_context);
|
||||||
|
@ -1142,9 +1153,10 @@ impl LayoutTask {
|
||||||
page_clip_rect: MAX_RECT,
|
page_clip_rect: MAX_RECT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let url_clone = &self.url.borrow().as_ref().unwrap().clone();
|
||||||
let mut layout_context = self.build_shared_layout_context(&*rw_data,
|
let mut layout_context = self.build_shared_layout_context(&*rw_data,
|
||||||
false,
|
false,
|
||||||
&self.url,
|
url_clone,
|
||||||
reflow_info.goal);
|
reflow_info.goal);
|
||||||
|
|
||||||
if let Some(mut root_flow) = self.root_flow.clone() {
|
if let Some(mut root_flow) = self.root_flow.clone() {
|
||||||
|
|
|
@ -86,6 +86,9 @@ pub enum Msg {
|
||||||
///
|
///
|
||||||
/// This basically exists to keep the script-layout dependency one-way.
|
/// This basically exists to keep the script-layout dependency one-way.
|
||||||
CreateLayoutTask(NewLayoutTaskInfo),
|
CreateLayoutTask(NewLayoutTaskInfo),
|
||||||
|
|
||||||
|
/// Set the final Url.
|
||||||
|
SetFinalUrl(Url),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Synchronous messages that script can send to layout.
|
/// Synchronous messages that script can send to layout.
|
||||||
|
|
|
@ -1549,6 +1549,11 @@ impl ScriptTask {
|
||||||
/// objects, parses HTML and CSS, and kicks off initial layout.
|
/// objects, parses HTML and CSS, and kicks off initial layout.
|
||||||
fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> ParserRoot {
|
fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> ParserRoot {
|
||||||
let final_url = metadata.final_url.clone();
|
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);
|
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
|
// 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