Auto merge of #5767 - glennw:image-cache, r=larsbergstrom,jdm

* Simpler image cache API for clients to use.
 * Significantly fewer threads.
   * One thread for image cache task (multiplexes commands, decoder threads and async resource requests).
   * 4 threads for decoder worker tasks.
 * Removed ReflowEvent hacks in script and layout tasks.
   * Image elements pass a Trusted<T> to image cache, which is used to dirty nodes via script task. Previous use of Untrusted addresses was unsafe.
   * Image requests such as background-image on layout / paint threads trigger repaint only rather than full reflow.
 * Add reflow batching for when multiple images load quickly.
   * Reduces the number of paints loading wikipedia from ~95 to ~35.
 * Reasonably simple to add proper prefetch support in a follow up PR.
 * Async loaded images always construct Image fragments now, instead of generic.
   * Image fragments support the image not being present.
 * Simpler implementation of synchronous image loading for reftests.
 * Removed image holder.
 * image.onload support.
 * image NaturalWidth and NaturalHeight support.
 * Updated WPT expectations.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5767)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-04-22 19:16:46 -05:00
commit ac0645c236
33 changed files with 2785 additions and 1679 deletions

View file

@ -39,12 +39,10 @@ use msg::constellation_msg::ConstellationChan;
use script::dom::bindings::codegen::RegisterBindings;
#[cfg(not(test))]
use net::image_cache_task::{ImageCacheTaskFactory, LoadPlaceholder};
use net::image_cache_task::new_image_cache_task;
#[cfg(not(test))]
use net::storage_task::StorageTaskFactory;
#[cfg(not(test))]
use net_traits::image_cache_task::ImageCacheTask;
#[cfg(not(test))]
use net::resource_task::new_resource_task;
#[cfg(not(test))]
use gfx::font_cache_task::FontCacheTask;
@ -108,17 +106,7 @@ impl Browser {
// Create a Servo instance.
let resource_task = new_resource_task(opts.user_agent.clone());
// If we are emitting an output file, then we need to block on
// image load or we risk emitting an output file missing the
// image.
let image_cache_task: ImageCacheTask = if opts.output_file.is_some() {
ImageCacheTaskFactory::new_sync(resource_task.clone(), shared_task_pool,
time_profiler_chan.clone(), LoadPlaceholder::Preload)
} else {
ImageCacheTaskFactory::new(resource_task.clone(), shared_task_pool,
time_profiler_chan.clone(), LoadPlaceholder::Preload)
};
let image_cache_task = new_image_cache_task(resource_task.clone());
let font_cache_task = FontCacheTask::new(resource_task.clone());
let storage_task = StorageTaskFactory::new();