Load web fonts synchronously during wpt.

This commit is contained in:
Bobby Holley 2015-11-04 17:14:04 -08:00
parent 1dc144d168
commit 77c253fd43
3 changed files with 24 additions and 5 deletions

View file

@ -326,10 +326,18 @@ fn add_font_face_rules(stylesheet: &Stylesheet,
outstanding_web_fonts_counter: &Arc<AtomicUsize>) {
for font_face in stylesheet.effective_rules(&device).font_face() {
for source in &font_face.sources {
outstanding_web_fonts_counter.fetch_add(1, Ordering::SeqCst);
font_cache_task.add_web_font(font_face.family.clone(),
(*source).clone(),
(*font_cache_sender).clone());
if opts::get().load_webfonts_synchronously {
let (sender, receiver) = channel();
font_cache_task.add_web_font(font_face.family.clone(),
(*source).clone(),
sender);
receiver.recv().unwrap();
} else {
outstanding_web_fonts_counter.fetch_add(1, Ordering::SeqCst);
font_cache_task.add_web_font(font_face.family.clone(),
(*source).clone(),
(*font_cache_sender).clone());
}
}
}
}