diff options
Diffstat (limited to 'src/components/main/layout/layout_task.rs')
-rw-r--r-- | src/components/main/layout/layout_task.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs index 267da50e62b..79ac3715a44 100644 --- a/src/components/main/layout/layout_task.rs +++ b/src/components/main/layout/layout_task.rs @@ -21,7 +21,6 @@ use layout::parallel; use layout::util::{LayoutDataAccess, LayoutDataWrapper, OpaqueNodeMethods}; use layout::wrapper::{LayoutNode, TLayoutNode, ThreadSafeLayoutNode}; -use extra::url::Url; use geom::point::Point2D; use geom::rect::Rect; use geom::size::Size2D; @@ -55,13 +54,14 @@ use servo_util::task::send_on_failure; use servo_util::workqueue::WorkQueue; use std::cast::transmute; use std::cast; -use std::comm::Port; +use std::comm::{channel, Sender, Receiver}; use std::mem; use std::ptr; use std::task; use style::{AuthorOrigin, ComputedValues, Stylesheet, Stylist}; use style; use sync::{Arc, MutexArc}; +use url::Url; /// Information needed by the layout task. pub struct LayoutTask { @@ -69,7 +69,7 @@ pub struct LayoutTask { id: PipelineId, /// The port on which we receive messages. - port: Port<Msg>, + port: Receiver<Msg>, //// The channel to send messages to ourself. chan: LayoutChan, @@ -248,7 +248,7 @@ impl ImageResponder for LayoutImageResponder { impl LayoutTask { /// Spawns a new layout task. pub fn create(id: PipelineId, - port: Port<Msg>, + port: Receiver<Msg>, chan: LayoutChan, constellation_chan: ConstellationChan, failure_msg: Failure, @@ -257,7 +257,7 @@ impl LayoutTask { img_cache_task: ImageCacheTask, opts: Opts, profiler_chan: ProfilerChan, - shutdown_chan: Chan<()>) { + shutdown_chan: Sender<()>) { let mut builder = task::task().named("LayoutTask"); let ConstellationChan(con_chan) = constellation_chan.clone(); send_on_failure(&mut builder, FailureMsg(failure_msg), con_chan); @@ -280,7 +280,7 @@ impl LayoutTask { /// Creates a new `LayoutTask` structure. fn new(id: PipelineId, - port: Port<Msg>, + port: Receiver<Msg>, chan: LayoutChan, constellation_chan: ConstellationChan, script_chan: ScriptChan, @@ -384,7 +384,7 @@ impl LayoutTask { /// Enters a quiescent state in which no new messages except for `ReapLayoutDataMsg` will be /// processed until an `ExitNowMsg` is received. A pong is immediately sent on the given /// response channel. - fn prepare_to_exit(&mut self, response_chan: Chan<()>) { + fn prepare_to_exit(&mut self, response_chan: Sender<()>) { response_chan.send(()); loop { match self.port.recv() { @@ -409,7 +409,7 @@ impl LayoutTask { /// Shuts down the layout task now. If there are any DOM nodes left, layout will now (safely) /// crash. fn exit_now(&mut self) { - let (response_port, response_chan) = Chan::new(); + let (response_chan, response_port) = channel(); match self.parallel_traversal { None => {} @@ -427,11 +427,11 @@ impl LayoutTask { /// Retrieves the flow tree root from the root node. fn get_layout_root(&self, node: LayoutNode) -> ~Flow { let mut layout_data_ref = node.mutate_layout_data(); - let result = match *layout_data_ref.get() { - Some(ref mut layout_data) => { + let result = match &mut *layout_data_ref { + &Some(ref mut layout_data) => { mem::replace(&mut layout_data.data.flow_construction_result, NoConstructionResult) } - None => fail!("no layout data for root node"), + &None => fail!("no layout data for root node"), }; let mut flow = match result { FlowConstructionResult(mut flow, abs_descendants) => { @@ -893,6 +893,6 @@ impl LayoutTask { unsafe fn handle_reap_layout_data(&self, layout_data: LayoutDataRef) { let mut layout_data_ref = layout_data.borrow_mut(); let _: Option<LayoutDataWrapper> = cast::transmute( - mem::replace(layout_data_ref.get(), None)); + mem::replace(&mut *layout_data_ref, None)); } } |