aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/compositing/pipeline.rs
diff options
context:
space:
mode:
authorGlenn Watson <gw@intuitionlibrary.com>2014-07-04 07:53:25 +1000
committerGlenn Watson <gw@intuitionlibrary.com>2014-07-07 14:25:21 +1000
commit12978eeb50d8f727bc020bcdd0534e80d7890c7f (patch)
treeb33c8659a0faf66765fef9cc016ac766a44007f5 /src/components/compositing/pipeline.rs
parente62637fee2f1c9627468dde81a68df1dd40b6bc9 (diff)
downloadservo-12978eeb50d8f727bc020bcdd0534e80d7890c7f.tar.gz
servo-12978eeb50d8f727bc020bcdd0534e80d7890c7f.zip
Next stage of refactoring font system. This commit introduces
the font cache task, and adapts client code to use it. It also cleans up some existing code paths. - Fonts are only read once from disk while in use (they are discarded if the reference count reaches zero, however). This saves memory and prevents unnecessary reading from disk. - It will be easier to add web font support, as all fonts are created and managed in a single place and the entire pipeline ensures that only one in-memory copy of font data is required. An overview of how the pieces fit together: FontTemplate - A structure containing everything that is required to create (and select) font handles. This structure is shared among all matching font handles (via Arc). FontTemplateData - A platform specific structure that contains the actual font data inside a template (this is a byte array on Linux/Android, CTFont on Mac). FontHandle - An opaque, platform specific handle to a font instance. Each FontHandle contains an Arc<> reference to the FontTemplate it was created from. FontCache - This is a separate task, that is responsible for loading and caching FontTemplate structures. There is one FontCache per constellation. It is only ever accessed via the FontContext described below. FontContext - This is the public interface to the FontCache and is used by the layout and render code to create font handles. These must *not* be shared between threads. There is typically one FontContext per thread/task.
Diffstat (limited to 'src/components/compositing/pipeline.rs')
-rw-r--r--src/components/compositing/pipeline.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/components/compositing/pipeline.rs b/src/components/compositing/pipeline.rs
index cabf2984b15..dbd054feb55 100644
--- a/src/components/compositing/pipeline.rs
+++ b/src/components/compositing/pipeline.rs
@@ -14,6 +14,7 @@ use script::script_task;
use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId};
use servo_msg::constellation_msg::WindowSizeData;
use servo_net::image_cache_task::ImageCacheTask;
+use gfx::font_cache_task::FontCacheTask;
use servo_net::resource_task::ResourceTask;
use servo_util::opts::Opts;
use servo_util::time::TimeProfilerChan;
@@ -49,6 +50,7 @@ impl Pipeline {
constellation_chan: ConstellationChan,
compositor_chan: CompositorChan,
image_cache_task: ImageCacheTask,
+ font_cache_task: FontCacheTask,
time_profiler_chan: TimeProfilerChan,
opts: Opts,
script_pipeline: Rc<Pipeline>,
@@ -68,6 +70,7 @@ impl Pipeline {
render_port,
compositor_chan.clone(),
constellation_chan.clone(),
+ font_cache_task.clone(),
failure.clone(),
opts.clone(),
time_profiler_chan.clone(),
@@ -81,6 +84,7 @@ impl Pipeline {
script_pipeline.script_chan.clone(),
render_chan.clone(),
image_cache_task.clone(),
+ font_cache_task.clone(),
opts.clone(),
time_profiler_chan,
layout_shutdown_chan);
@@ -110,6 +114,7 @@ impl Pipeline {
constellation_chan: ConstellationChan,
compositor_chan: CompositorChan,
image_cache_task: ImageCacheTask,
+ font_cache_task: FontCacheTask,
resource_task: ResourceTask,
time_profiler_chan: TimeProfilerChan,
window_size: WindowSizeData,
@@ -150,6 +155,7 @@ impl Pipeline {
render_port,
compositor_chan.clone(),
constellation_chan.clone(),
+ font_cache_task.clone(),
failure.clone(),
opts.clone(),
time_profiler_chan.clone(),
@@ -163,6 +169,7 @@ impl Pipeline {
script_chan.clone(),
render_chan.clone(),
image_cache_task,
+ font_cache_task,
opts.clone(),
time_profiler_chan,
layout_shutdown_chan);