diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-05-08 23:40:15 +0200 |
---|---|---|
committer | Jack Moffitt <jack@metajack.im> | 2014-05-22 16:36:40 -0600 |
commit | eaedeb07cb0c4fdda37f35057588e4a769fbe758 (patch) | |
tree | cdeb134482f06818f7d6dbad8e008882fcc336a5 /src/components/main/layout/layout_task.rs | |
parent | 3644d0272c89336954358eb5005f884a9c89e8bc (diff) | |
download | servo-eaedeb07cb0c4fdda37f35057588e4a769fbe758.tar.gz servo-eaedeb07cb0c4fdda37f35057588e4a769fbe758.zip |
Update Rust.
Diffstat (limited to 'src/components/main/layout/layout_task.rs')
-rw-r--r-- | src/components/main/layout/layout_task.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs index 91fab27f1c5..e039bc7e506 100644 --- a/src/components/main/layout/layout_task.rs +++ b/src/components/main/layout/layout_task.rs @@ -58,7 +58,7 @@ use std::cast; use std::comm::{channel, Sender, Receiver}; use std::mem; use std::ptr; -use std::task; +use std::task::TaskBuilder; use style::{AuthorOrigin, Stylesheet, Stylist}; use sync::{Arc, Mutex}; use url::Url; @@ -95,7 +95,7 @@ pub struct LayoutTask { /// A cached display list. pub display_list: Option<Arc<DisplayList>>, - pub stylist: ~Stylist, + pub stylist: Box<Stylist>, /// The workers that we use for parallel operation. pub parallel_traversal: Option<WorkQueue<*mut LayoutContext,PaddedUnsafeFlow>>, @@ -264,7 +264,7 @@ impl ImageResponder for LayoutImageResponder { let script_chan = self.script_chan.clone(); let f: proc(ImageResponseMsg):Send = proc(_) { let ScriptChan(chan) = script_chan; - drop(chan.try_send(SendEventMsg(id.clone(), ReflowEvent))) + drop(chan.send_opt(SendEventMsg(id.clone(), ReflowEvent))) }; f } @@ -283,7 +283,7 @@ impl LayoutTask { opts: Opts, profiler_chan: ProfilerChan, shutdown_chan: Sender<()>) { - let mut builder = task::task().named("LayoutTask"); + let mut builder = TaskBuilder::new().named("LayoutTask"); let ConstellationChan(con_chan) = constellation_chan.clone(); send_on_failure(&mut builder, FailureMsg(failure_msg), con_chan); builder.spawn(proc() { @@ -314,10 +314,10 @@ impl LayoutTask { opts: &Opts, profiler_chan: ProfilerChan) -> LayoutTask { - let local_image_cache = ~LocalImageCache(image_cache_task.clone()); + let local_image_cache = box LocalImageCache(image_cache_task.clone()); let local_image_cache = unsafe { - let cache = Arc::new(Mutex::new(cast::transmute::<~LocalImageCache, - *()>(local_image_cache))); + let cache = Arc::new(Mutex::new( + cast::transmute::<Box<LocalImageCache>, *()>(local_image_cache))); LocalImageCacheHandle::new(cast::transmute::<Arc<Mutex<*()>>,Arc<*()>>(cache)) }; let screen_size = Size2D(Au(0), Au(0)); @@ -339,7 +339,7 @@ impl LayoutTask { screen_size: screen_size, display_list: None, - stylist: ~new_stylist(), + stylist: box new_stylist(), parallel_traversal: parallel_traversal, profiler_chan: profiler_chan, opts: opts.clone(), @@ -455,7 +455,7 @@ impl LayoutTask { } /// Retrieves the flow tree root from the root node. - fn get_layout_root(&self, node: LayoutNode) -> ~Flow:Share { + fn get_layout_root(&self, node: LayoutNode) -> Box<Flow:Share> { let mut layout_data_ref = node.mutate_layout_data(); let result = match &mut *layout_data_ref { &Some(ref mut layout_data) => { @@ -521,7 +521,7 @@ impl LayoutTask { /// benchmarked against those two. It is marked `#[inline(never)]` to aid profiling. #[inline(never)] fn solve_constraints_parallel(&mut self, - layout_root: &mut ~Flow:Share, + layout_root: &mut Box<Flow:Share>, layout_context: &mut LayoutContext) { if layout_context.opts.bubble_widths_separately { let mut traversal = BubbleWidthsTraversal { @@ -547,13 +547,13 @@ impl LayoutTask { /// This is only on in debug builds. #[inline(never)] #[cfg(debug)] - fn verify_flow_tree(&mut self, layout_root: &mut ~Flow:Share) { + fn verify_flow_tree(&mut self, layout_root: &mut Box<Flow:Share>) { let mut traversal = FlowTreeVerificationTraversal; layout_root.traverse_preorder(&mut traversal); } #[cfg(not(debug))] - fn verify_flow_tree(&mut self, _: &mut ~Flow:Share) { + fn verify_flow_tree(&mut self, _: &mut Box<Flow:Share>) { } /// The high-level routine that performs layout tasks. @@ -597,7 +597,7 @@ impl LayoutTask { // FIXME(pcwalton): This is a pretty bogus thing to do. Essentially this is a workaround // for libgreen having slow TLS. let mut font_context_opt = if self.parallel_traversal.is_none() { - Some(~FontContext::new(layout_ctx.font_context_info.clone())) + Some(box FontContext::new(layout_ctx.font_context_info.clone())) } else { None }; @@ -805,7 +805,7 @@ impl LayoutTask { match *item { ClipDisplayItemClass(ref cc) => { if geometry::rect_contains_point(cc.base.bounds, Point2D(x, y)) { - let ret = hit_test(x, y, cc.children.list.rev_iter()); + let ret = hit_test(x, y, cc.children.list.iter().rev()); if !ret.is_none() { return ret } @@ -835,7 +835,7 @@ impl LayoutTask { Au::from_frac_px(point.y as f64)); let resp = match self.display_list { None => fail!("no display list!"), - Some(ref display_list) => hit_test(x, y, display_list.list.rev_iter()), + Some(ref display_list) => hit_test(x, y, display_list.list.iter().rev()), }; if resp.is_some() { reply_chan.send(Ok(resp.unwrap())); @@ -900,15 +900,15 @@ impl LayoutTask { // to the script task, and ultimately cause the image to be // re-requested. We probably don't need to go all the way back to // the script task for this. - fn make_on_image_available_cb(&self) -> ~ImageResponder:Send { + fn make_on_image_available_cb(&self) -> Box<ImageResponder:Send> { // This has a crazy signature because the image cache needs to // make multiple copies of the callback, and the dom event // channel is not a copyable type, so this is actually a // little factory to produce callbacks - ~LayoutImageResponder { + box LayoutImageResponder { id: self.id.clone(), script_chan: self.script_chan.clone(), - } as ~ImageResponder:Send + } as Box<ImageResponder:Send> } /// Handles a message to destroy layout data. Layout data must be destroyed on *this* task |