mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Remove Traceable/Untraceable from page.rs
This commit is contained in:
parent
22567762a0
commit
707a2870fa
9 changed files with 95 additions and 76 deletions
|
@ -67,7 +67,7 @@ impl<'a> GlobalRef<'a> {
|
|||
|
||||
pub fn resource_task(&self) -> ResourceTask {
|
||||
match *self {
|
||||
Window(ref window) => window.page().resource_task.deref().clone(),
|
||||
Window(ref window) => window.page().resource_task.clone(),
|
||||
Worker(ref worker) => worker.resource_task().clone(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,8 @@ use http::headers::request::HeaderCollection as RequestHeaderCollection;
|
|||
use http::method::Method;
|
||||
use std::io::timer::Timer;
|
||||
use servo_msg::compositor_msg::ScriptListener;
|
||||
use servo_msg::constellation_msg::ConstellationChan;
|
||||
use layout_interface::{LayoutRPC, LayoutChan};
|
||||
|
||||
impl<T: Reflectable> JSTraceable for JS<T> {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
|
@ -165,7 +167,7 @@ impl<T: JSTraceable> JSTraceable for RefCell<T> {
|
|||
|
||||
impl<T: JSTraceable> JSTraceable for Rc<T> {
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
self.deref().trace(trc)
|
||||
(**self).trace(trc)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,6 +230,16 @@ impl<K: Eq+Hash+JSTraceable, V: JSTraceable> JSTraceable for HashMap<K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A: JSTraceable, B: JSTraceable> JSTraceable for (A, B) {
|
||||
#[inline]
|
||||
fn trace(&self, trc: *mut JSTracer) {
|
||||
let (ref a, ref b) = *self;
|
||||
a.trace(trc);
|
||||
b.trace(trc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
untraceable!(bool, f32, f64, String, Url)
|
||||
untraceable!(uint, u8, u16, u32, u64)
|
||||
untraceable!(int, i8, i16, i32, i64)
|
||||
|
@ -243,6 +255,8 @@ untraceable!(SubpageId, WindowSizeData, PipelineId)
|
|||
untraceable!(QuirksMode)
|
||||
untraceable!(Cx)
|
||||
untraceable!(ResponseHeaderCollection, RequestHeaderCollection, Method)
|
||||
untraceable!(ConstellationChan)
|
||||
untraceable!(LayoutChan)
|
||||
|
||||
impl<'a> JSTraceable for &'a str {
|
||||
#[inline]
|
||||
|
@ -264,3 +278,10 @@ impl JSTraceable for Box<ScriptListener+'static> {
|
|||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
impl JSTraceable for Box<LayoutRPC+'static> {
|
||||
#[inline]
|
||||
fn trace(&self, _: *mut JSTracer) {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ impl BrowserContext {
|
|||
assert!(handler.deref().is_not_null());
|
||||
|
||||
let parent = win.deref().reflector().get_jsobject();
|
||||
let cx = js_info.as_ref().unwrap().js_context.deref().deref().ptr;
|
||||
let cx = js_info.as_ref().unwrap().js_context.deref().ptr;
|
||||
let wrapper = with_compartment(cx, parent, || unsafe {
|
||||
WrapperNew(cx, parent, *handler.deref())
|
||||
});
|
||||
|
|
|
@ -107,7 +107,7 @@ impl<'a> HTMLIFrameElementHelpers for JSRef<'a, HTMLIFrameElement> {
|
|||
subpage_id: subpage_id,
|
||||
}));
|
||||
|
||||
let ConstellationChan(ref chan) = *page.constellation_chan.deref();
|
||||
let ConstellationChan(ref chan) = page.constellation_chan;
|
||||
chan.send(LoadIframeUrlMsg(url, page.id, subpage_id, sandboxed));
|
||||
}
|
||||
}
|
||||
|
@ -152,12 +152,12 @@ impl<'a> HTMLIFrameElementMethods for JSRef<'a, HTMLIFrameElement> {
|
|||
fn GetContentWindow(self) -> Option<Temporary<Window>> {
|
||||
self.size.get().and_then(|size| {
|
||||
let window = window_from_node(self).root();
|
||||
let children = window.deref().page.children.deref().borrow();
|
||||
let children = window.deref().page.children.borrow();
|
||||
let child = children.iter().find(|child| {
|
||||
child.subpage_id.unwrap() == size.subpage_id
|
||||
});
|
||||
child.and_then(|page| {
|
||||
page.frame.deref().borrow().as_ref().map(|frame| {
|
||||
page.frame.borrow().as_ref().map(|frame| {
|
||||
Temporary::new(frame.window.clone())
|
||||
})
|
||||
})
|
||||
|
|
|
@ -118,7 +118,7 @@ impl<'a> PrivateHTMLLinkElementHelpers for JSRef<'a, HTMLLinkElement> {
|
|||
let window = window_from_node(self).root();
|
||||
match UrlParser::new().base_url(&window.deref().page().get_url()).parse(href) {
|
||||
Ok(url) => {
|
||||
let LayoutChan(ref layout_chan) = *window.deref().page().layout_chan;
|
||||
let LayoutChan(ref layout_chan) = window.deref().page().layout_chan;
|
||||
layout_chan.send(LoadStylesheetMsg(url));
|
||||
}
|
||||
Err(e) => debug!("Parsing url {:s} failed: {:?}", href, e)
|
||||
|
|
|
@ -57,7 +57,7 @@ impl<'a> StyleElementHelpers for JSRef<'a, HTMLStyleElement> {
|
|||
|
||||
let data = node.GetTextContent().expect("Element.textContent must be a string");
|
||||
let sheet = Stylesheet::from_str(data.as_slice(), url);
|
||||
let LayoutChan(ref layout_chan) = *win.deref().page().layout_chan;
|
||||
let LayoutChan(ref layout_chan) = win.deref().page().layout_chan;
|
||||
layout_chan.send(AddStylesheetMsg(sheet));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ pub struct Window {
|
|||
impl Window {
|
||||
pub fn get_cx(&self) -> *mut JSContext {
|
||||
let js_info = self.page().js_info();
|
||||
(**js_info.as_ref().unwrap().js_context).ptr
|
||||
(*js_info.as_ref().unwrap().js_context).ptr
|
||||
}
|
||||
|
||||
pub fn page<'a>(&'a self) -> &'a Page {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||
use dom::bindings::codegen::InheritTypes::NodeCast;
|
||||
use dom::bindings::js::{JS, JSRef, Temporary, OptionalRootable};
|
||||
use dom::bindings::trace::{Traceable, Untraceable};
|
||||
use dom::bindings::utils::GlobalStaticData;
|
||||
use dom::document::{Document, DocumentHelpers};
|
||||
use dom::element::Element;
|
||||
|
@ -42,50 +41,50 @@ pub struct Page {
|
|||
pub subpage_id: Option<SubpageId>,
|
||||
|
||||
/// Unique id for last reflow request; used for confirming completion reply.
|
||||
pub last_reflow_id: Traceable<Cell<uint>>,
|
||||
pub last_reflow_id: Cell<uint>,
|
||||
|
||||
/// The outermost frame containing the document, window, and page URL.
|
||||
pub frame: Traceable<RefCell<Option<Frame>>>,
|
||||
pub frame: RefCell<Option<Frame>>,
|
||||
|
||||
/// A handle for communicating messages to the layout task.
|
||||
pub layout_chan: Untraceable<LayoutChan>,
|
||||
pub layout_chan: LayoutChan,
|
||||
|
||||
/// A handle to perform RPC calls into the layout, quickly.
|
||||
layout_rpc: Untraceable<Box<LayoutRPC+'static>>,
|
||||
layout_rpc: Box<LayoutRPC+'static>,
|
||||
|
||||
/// The port that we will use to join layout. If this is `None`, then layout is not running.
|
||||
pub layout_join_port: Untraceable<RefCell<Option<Receiver<()>>>>,
|
||||
pub layout_join_port: RefCell<Option<Receiver<()>>>,
|
||||
|
||||
/// What parts of the document are dirty, if any.
|
||||
damage: Traceable<RefCell<Option<DocumentDamage>>>,
|
||||
damage: RefCell<Option<DocumentDamage>>,
|
||||
|
||||
/// The current size of the window, in pixels.
|
||||
pub window_size: Traceable<Cell<WindowSizeData>>,
|
||||
pub window_size: Cell<WindowSizeData>,
|
||||
|
||||
js_info: Traceable<RefCell<Option<JSPageInfo>>>,
|
||||
js_info: RefCell<Option<JSPageInfo>>,
|
||||
|
||||
/// Cached copy of the most recent url loaded by the script
|
||||
/// TODO(tkuehn): this currently does not follow any particular caching policy
|
||||
/// and simply caches pages forever (!). The bool indicates if reflow is required
|
||||
/// when reloading.
|
||||
url: Untraceable<RefCell<Option<(Url, bool)>>>,
|
||||
url: RefCell<Option<(Url, bool)>>,
|
||||
|
||||
next_subpage_id: Traceable<Cell<SubpageId>>,
|
||||
next_subpage_id: Cell<SubpageId>,
|
||||
|
||||
/// Pending resize event, if any.
|
||||
pub resize_event: Untraceable<Cell<Option<WindowSizeData>>>,
|
||||
pub resize_event: Cell<Option<WindowSizeData>>,
|
||||
|
||||
/// Pending scroll to fragment event, if any
|
||||
pub fragment_name: RefCell<Option<String>>,
|
||||
|
||||
/// Associated resource task for use by DOM objects like XMLHttpRequest
|
||||
pub resource_task: Untraceable<ResourceTask>,
|
||||
pub resource_task: ResourceTask,
|
||||
|
||||
/// A handle for communicating messages to the constellation task.
|
||||
pub constellation_chan: Untraceable<ConstellationChan>,
|
||||
pub constellation_chan: ConstellationChan,
|
||||
|
||||
// Child Pages.
|
||||
pub children: Traceable<RefCell<Vec<Rc<Page>>>>,
|
||||
pub children: RefCell<Vec<Rc<Page>>>,
|
||||
|
||||
/// Number of pending reflows that were sent while layout was active.
|
||||
pub pending_reflows: Cell<int>,
|
||||
|
@ -111,7 +110,7 @@ impl IterablePage for Rc<Page> {
|
|||
}
|
||||
fn find(&self, id: PipelineId) -> Option<Rc<Page>> {
|
||||
if self.id == id { return Some(self.clone()); }
|
||||
for page in self.children.deref().borrow().iter() {
|
||||
for page in self.children.borrow().iter() {
|
||||
let found = page.find(id);
|
||||
if found.is_some() { return found; }
|
||||
}
|
||||
|
@ -129,7 +128,7 @@ impl Page {
|
|||
js_context: Rc<Cx>) -> Page {
|
||||
let js_info = JSPageInfo {
|
||||
dom_static: GlobalStaticData(),
|
||||
js_context: Untraceable::new(js_context),
|
||||
js_context: js_context,
|
||||
};
|
||||
let layout_rpc: Box<LayoutRPC> = {
|
||||
let (rpc_send, rpc_recv) = channel();
|
||||
|
@ -140,21 +139,21 @@ impl Page {
|
|||
Page {
|
||||
id: id,
|
||||
subpage_id: subpage_id,
|
||||
frame: Traceable::new(RefCell::new(None)),
|
||||
layout_chan: Untraceable::new(layout_chan),
|
||||
layout_rpc: Untraceable::new(layout_rpc),
|
||||
layout_join_port: Untraceable::new(RefCell::new(None)),
|
||||
damage: Traceable::new(RefCell::new(None)),
|
||||
window_size: Traceable::new(Cell::new(window_size)),
|
||||
js_info: Traceable::new(RefCell::new(Some(js_info))),
|
||||
url: Untraceable::new(RefCell::new(None)),
|
||||
next_subpage_id: Traceable::new(Cell::new(SubpageId(0))),
|
||||
resize_event: Untraceable::new(Cell::new(None)),
|
||||
frame: RefCell::new(None),
|
||||
layout_chan: layout_chan,
|
||||
layout_rpc: layout_rpc,
|
||||
layout_join_port: RefCell::new(None),
|
||||
damage: RefCell::new(None),
|
||||
window_size: Cell::new(window_size),
|
||||
js_info: RefCell::new(Some(js_info)),
|
||||
url: RefCell::new(None),
|
||||
next_subpage_id: Cell::new(SubpageId(0)),
|
||||
resize_event: Cell::new(None),
|
||||
fragment_name: RefCell::new(None),
|
||||
last_reflow_id: Traceable::new(Cell::new(0)),
|
||||
resource_task: Untraceable::new(resource_task),
|
||||
constellation_chan: Untraceable::new(constellation_chan),
|
||||
children: Traceable::new(RefCell::new(vec!())),
|
||||
last_reflow_id: Cell::new(0),
|
||||
resource_task: resource_task,
|
||||
constellation_chan: constellation_chan,
|
||||
children: RefCell::new(vec!()),
|
||||
pending_reflows: Cell::new(0),
|
||||
avoided_reflows: Cell::new(0),
|
||||
}
|
||||
|
@ -177,7 +176,7 @@ impl Page {
|
|||
// doing a query reflow.
|
||||
self.flush_layout(ReflowForDisplay);
|
||||
self.join_layout(); //FIXME: is this necessary, or is layout_rpc's mutex good enough?
|
||||
let layout_rpc: &LayoutRPC = &**self.layout_rpc;
|
||||
let layout_rpc: &LayoutRPC = &*self.layout_rpc;
|
||||
layout_rpc
|
||||
}
|
||||
|
||||
|
@ -185,7 +184,6 @@ impl Page {
|
|||
pub fn remove(&self, id: PipelineId) -> Option<Rc<Page>> {
|
||||
let remove_idx = {
|
||||
self.children
|
||||
.deref()
|
||||
.borrow_mut()
|
||||
.iter_mut()
|
||||
.enumerate()
|
||||
|
@ -197,9 +195,9 @@ impl Page {
|
|||
.map(|(idx, _)| idx)
|
||||
};
|
||||
match remove_idx {
|
||||
Some(idx) => return Some(self.children.deref().borrow_mut().remove(idx).unwrap()),
|
||||
Some(idx) => return Some(self.children.borrow_mut().remove(idx).unwrap()),
|
||||
None => {
|
||||
for page_tree in self.children.deref().borrow_mut().iter_mut() {
|
||||
for page_tree in self.children.borrow_mut().iter_mut() {
|
||||
match page_tree.remove(id) {
|
||||
found @ Some(_) => return found,
|
||||
None => (), // keep going...
|
||||
|
@ -215,7 +213,7 @@ impl Iterator<Rc<Page>> for PageIterator {
|
|||
fn next(&mut self) -> Option<Rc<Page>> {
|
||||
if !self.stack.is_empty() {
|
||||
let next = self.stack.pop().unwrap();
|
||||
for child in next.children.deref().borrow().iter() {
|
||||
for child in next.children.borrow().iter() {
|
||||
self.stack.push(child.clone());
|
||||
}
|
||||
Some(next.clone())
|
||||
|
@ -227,33 +225,33 @@ impl Iterator<Rc<Page>> for PageIterator {
|
|||
|
||||
impl Page {
|
||||
pub fn mut_js_info<'a>(&'a self) -> RefMut<'a, Option<JSPageInfo>> {
|
||||
self.js_info.deref().borrow_mut()
|
||||
self.js_info.borrow_mut()
|
||||
}
|
||||
|
||||
pub fn js_info<'a>(&'a self) -> Ref<'a, Option<JSPageInfo>> {
|
||||
self.js_info.deref().borrow()
|
||||
self.js_info.borrow()
|
||||
}
|
||||
|
||||
pub fn url<'a>(&'a self) -> Ref<'a, Option<(Url, bool)>> {
|
||||
self.url.deref().borrow()
|
||||
self.url.borrow()
|
||||
}
|
||||
|
||||
pub fn mut_url<'a>(&'a self) -> RefMut<'a, Option<(Url, bool)>> {
|
||||
self.url.deref().borrow_mut()
|
||||
self.url.borrow_mut()
|
||||
}
|
||||
|
||||
pub fn frame<'a>(&'a self) -> Ref<'a, Option<Frame>> {
|
||||
self.frame.deref().borrow()
|
||||
self.frame.borrow()
|
||||
}
|
||||
|
||||
pub fn mut_frame<'a>(&'a self) -> RefMut<'a, Option<Frame>> {
|
||||
self.frame.deref().borrow_mut()
|
||||
self.frame.borrow_mut()
|
||||
}
|
||||
|
||||
pub fn get_next_subpage_id(&self) -> SubpageId {
|
||||
let subpage_id = self.next_subpage_id.deref().get();
|
||||
let subpage_id = self.next_subpage_id.get();
|
||||
let SubpageId(id_num) = subpage_id;
|
||||
self.next_subpage_id.deref().set(SubpageId(id_num + 1));
|
||||
self.next_subpage_id.set(SubpageId(id_num + 1));
|
||||
subpage_id
|
||||
}
|
||||
|
||||
|
@ -267,7 +265,7 @@ impl Page {
|
|||
None => {},
|
||||
Some(root) => {
|
||||
let root: JSRef<Node> = NodeCast::from_ref(*root);
|
||||
let mut damage = *self.damage.deref().borrow_mut();
|
||||
let mut damage = *self.damage.borrow_mut();
|
||||
match damage {
|
||||
None => {}
|
||||
Some(ref mut damage) => {
|
||||
|
@ -278,7 +276,7 @@ impl Page {
|
|||
}
|
||||
}
|
||||
|
||||
*self.damage.deref().borrow_mut() = Some(DocumentDamage {
|
||||
*self.damage.borrow_mut() = Some(DocumentDamage {
|
||||
root: root.to_trusted_node_address(),
|
||||
level: level,
|
||||
})
|
||||
|
@ -297,7 +295,7 @@ impl Page {
|
|||
/// Sends a ping to layout and waits for the response. The response will arrive when the
|
||||
/// layout task has finished any pending request messages.
|
||||
pub fn join_layout(&self) {
|
||||
let mut layout_join_port = self.layout_join_port.deref().borrow_mut();
|
||||
let mut layout_join_port = self.layout_join_port.borrow_mut();
|
||||
if layout_join_port.is_some() {
|
||||
let join_port = replace(&mut *layout_join_port, None);
|
||||
match join_port {
|
||||
|
@ -355,15 +353,15 @@ impl Page {
|
|||
|
||||
// Layout will let us know when it's done.
|
||||
let (join_chan, join_port) = channel();
|
||||
let mut layout_join_port = self.layout_join_port.deref().borrow_mut();
|
||||
let mut layout_join_port = self.layout_join_port.borrow_mut();
|
||||
*layout_join_port = Some(join_port);
|
||||
|
||||
let last_reflow_id = self.last_reflow_id.deref();
|
||||
let last_reflow_id = &self.last_reflow_id;
|
||||
last_reflow_id.set(last_reflow_id.get() + 1);
|
||||
|
||||
let root: JSRef<Node> = NodeCast::from_ref(*root);
|
||||
let mut damage = self.damage.deref().borrow_mut();
|
||||
let window_size = self.window_size.deref().get();
|
||||
let mut damage = self.damage.borrow_mut();
|
||||
let window_size = self.window_size.get();
|
||||
|
||||
// Send new document and relevant styles to layout.
|
||||
let reflow = box Reflow {
|
||||
|
@ -378,7 +376,7 @@ impl Page {
|
|||
id: last_reflow_id.get(),
|
||||
};
|
||||
|
||||
let LayoutChan(ref chan) = *self.layout_chan;
|
||||
let LayoutChan(ref chan) = self.layout_chan;
|
||||
chan.send(ReflowMsg(reflow));
|
||||
|
||||
debug!("script: layout forked")
|
||||
|
@ -450,5 +448,5 @@ pub struct JSPageInfo {
|
|||
/// Global static data related to the DOM.
|
||||
pub dom_static: GlobalStaticData,
|
||||
/// The JavaScript context.
|
||||
pub js_context: Untraceable<Rc<Cx>>,
|
||||
pub js_context: Rc<Cx>,
|
||||
}
|
||||
|
|
|
@ -395,14 +395,14 @@ impl ScriptTask {
|
|||
let mut page = self.page.borrow_mut();
|
||||
for page in page.iter() {
|
||||
// Only process a resize if layout is idle.
|
||||
let layout_join_port = page.layout_join_port.deref().borrow();
|
||||
let layout_join_port = page.layout_join_port.borrow();
|
||||
if layout_join_port.is_none() {
|
||||
let mut resize_event = page.resize_event.deref().get();
|
||||
let mut resize_event = page.resize_event.get();
|
||||
match resize_event.take() {
|
||||
Some(size) => resizes.push((page.id, size)),
|
||||
None => ()
|
||||
}
|
||||
page.resize_event.deref().set(None);
|
||||
page.resize_event.set(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ impl ScriptTask {
|
|||
FromConstellation(ResizeMsg(id, size)) => {
|
||||
let mut page = self.page.borrow_mut();
|
||||
let page = page.find(id).expect("resize sent to nonexistent pipeline");
|
||||
page.resize_event.deref().set(Some(size));
|
||||
page.resize_event.set(Some(size));
|
||||
}
|
||||
_ => {
|
||||
sequential.push(event);
|
||||
|
@ -594,15 +594,15 @@ impl ScriptTask {
|
|||
whose parent has a PipelineId which does not correspond to a pipeline in the script
|
||||
task's page tree. This is a bug.");
|
||||
let new_page = {
|
||||
let window_size = parent_page.window_size.deref().get();
|
||||
let window_size = parent_page.window_size.get();
|
||||
Page::new(new_pipeline_id, Some(subpage_id),
|
||||
LayoutChan(layout_chan.downcast_ref::<Sender<layout_interface::Msg>>().unwrap().clone()),
|
||||
window_size,
|
||||
parent_page.resource_task.deref().clone(),
|
||||
parent_page.resource_task.clone(),
|
||||
self.constellation_chan.clone(),
|
||||
self.js_context.borrow().as_ref().unwrap().clone())
|
||||
};
|
||||
parent_page.children.deref().borrow_mut().push(Rc::new(new_page));
|
||||
parent_page.children.borrow_mut().push(Rc::new(new_page));
|
||||
}
|
||||
|
||||
/// Handles a timer that fired.
|
||||
|
@ -622,9 +622,9 @@ impl ScriptTask {
|
|||
let page = page.find(pipeline_id).expect(
|
||||
"ScriptTask: received a load message for a layout channel that is not associated \
|
||||
with this script task. This is a bug.");
|
||||
let last_reflow_id = page.last_reflow_id.deref().get();
|
||||
let last_reflow_id = page.last_reflow_id.get();
|
||||
if last_reflow_id == reflow_id {
|
||||
let mut layout_join_port = page.layout_join_port.deref().borrow_mut();
|
||||
let mut layout_join_port = page.layout_join_port.borrow_mut();
|
||||
*layout_join_port = None;
|
||||
}
|
||||
|
||||
|
@ -649,7 +649,7 @@ impl ScriptTask {
|
|||
let mut page = self.page.borrow_mut();
|
||||
let page = page.find(id).expect("Received resize message for PipelineId not associated
|
||||
with a page in the page tree. This is a bug.");
|
||||
page.window_size.deref().set(new_size);
|
||||
page.window_size.set(new_size);
|
||||
match &mut *page.mut_url() {
|
||||
&Some((_, ref mut needs_reflow)) => *needs_reflow = true,
|
||||
&None => (),
|
||||
|
@ -866,7 +866,7 @@ impl ScriptTask {
|
|||
|
||||
let window = {
|
||||
let page = get_page(&*self.page.borrow(), pipeline_id);
|
||||
page.window_size.deref().set(new_size);
|
||||
page.window_size.set(new_size);
|
||||
|
||||
let frame = page.frame();
|
||||
if frame.is_some() {
|
||||
|
@ -911,7 +911,7 @@ impl ScriptTask {
|
|||
let page = get_page(&*self.page.borrow(), pipeline_id);
|
||||
let frame = page.frame();
|
||||
if frame.is_some() {
|
||||
let in_layout = page.layout_join_port.deref().borrow().is_some();
|
||||
let in_layout = page.layout_join_port.borrow().is_some();
|
||||
if in_layout {
|
||||
page.pending_reflows.set(page.pending_reflows.get() + 1);
|
||||
} else {
|
||||
|
@ -1062,7 +1062,7 @@ fn shut_down_layout(page_tree: &Rc<Page>, rt: *mut JSRuntime) {
|
|||
// Tell the layout task to begin shutting down, and wait until it
|
||||
// processed this message.
|
||||
let (response_chan, response_port) = channel();
|
||||
let LayoutChan(ref chan) = *page.layout_chan;
|
||||
let LayoutChan(ref chan) = page.layout_chan;
|
||||
chan.send(layout_interface::PrepareToExitMsg(response_chan));
|
||||
response_port.recv();
|
||||
}
|
||||
|
@ -1085,7 +1085,7 @@ fn shut_down_layout(page_tree: &Rc<Page>, rt: *mut JSRuntime) {
|
|||
|
||||
// Destroy the layout task. If there were node leaks, layout will now crash safely.
|
||||
for page in page_tree.iter() {
|
||||
let LayoutChan(ref chan) = *page.layout_chan;
|
||||
let LayoutChan(ref chan) = page.layout_chan;
|
||||
chan.send(layout_interface::ExitNowMsg);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue