Revert "auto merge of #1356 : ksh8281/servo/remove_@_in_LayoutTask.FontContext, r=pcwalton"

This reverts commit e8ffac13d7, reversing
changes made to db923feffe.

Reverting this change because FreeType is *not* thread safe. See the
documentation here:

http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html

"In multi-threaded applications, make sure that the same FT_Library
object or any of its children doesn't get accessed in parallel."

We will need to use a `MutexArc` instead.
This commit is contained in:
Patrick Walton 2013-12-09 19:39:40 -08:00
parent e8ffac13d7
commit 30bbaa49b7
13 changed files with 120 additions and 122 deletions

View file

@ -77,6 +77,9 @@ struct LayoutTask {
/// The local image cache.
local_image_cache: MutexArc<LocalImageCache>,
/// The local font context.
font_ctx: @mut FontContext,
/// The size of the viewport.
screen_size: Option<Size2D<Au>>,
@ -87,8 +90,6 @@ struct LayoutTask {
/// The channel on which messages can be sent to the profiler.
profiler_chan: ProfilerChan,
opts: Opts
}
/// The damage computation traversal.
@ -228,6 +229,7 @@ impl LayoutTask {
opts: &Opts,
profiler_chan: ProfilerChan)
-> LayoutTask {
let fctx = @mut FontContext::new(opts.render_backend, true, profiler_chan.clone());
LayoutTask {
id: id,
@ -237,13 +239,13 @@ impl LayoutTask {
render_chan: render_chan,
image_cache_task: image_cache_task.clone(),
local_image_cache: MutexArc::new(LocalImageCache(image_cache_task)),
font_ctx: fctx,
screen_size: None,
display_list: None,
stylist: RWArc::new(new_stylist()),
profiler_chan: profiler_chan,
opts: opts.clone()
}
}
@ -257,8 +259,7 @@ impl LayoutTask {
// Create a layout context for use in building display lists, hit testing, &c.
fn build_layout_context(&self) -> LayoutContext {
let image_cache = self.local_image_cache.clone();
let font_ctx = ~FontContext::new(self.opts.render_backend, true,
self.profiler_chan.clone());
let font_ctx = self.font_ctx;
let screen_size = self.screen_size.unwrap();
LayoutContext {
@ -343,9 +344,9 @@ impl LayoutTask {
/// is intertwined with selector matching, making it difficult to compare directly. It is
/// marked `#[inline(never)]` to aid benchmarking in sampling profilers.
#[inline(never)]
fn construct_flow_tree(&self, layout_context: &mut LayoutContext, node: AbstractNode<LayoutView>)
fn construct_flow_tree(&self, layout_context: &LayoutContext, node: AbstractNode<LayoutView>)
-> ~Flow: {
node.traverse_postorder_mut(&mut FlowConstructor::init(layout_context));
node.traverse_postorder(&FlowConstructor::init(layout_context));
let result = match *node.mutate_layout_data().ptr {
Some(ref mut layout_data) => {
@ -440,7 +441,7 @@ impl LayoutTask {
// Construct the flow tree.
let mut layout_root = profile(time::LayoutTreeBuilderCategory,
self.profiler_chan.clone(),
|| self.construct_flow_tree(&mut layout_ctx, *node));
|| self.construct_flow_tree(&layout_ctx, *node));
// Propagate damage.
layout_root.traverse_preorder(&mut PropagateDamageTraversal {