Add RwLock in more Arc’d things in stylesheets.

This commit is contained in:
Simon Sapin 2016-10-19 19:08:14 +02:00
parent 9e3cf3189b
commit 742681a623
9 changed files with 250 additions and 334 deletions

View file

@ -113,7 +113,7 @@ use style::media_queries::{Device, MediaType};
use style::parallel::WorkQueueData;
use style::parser::ParserContextExtraData;
use style::selector_matching::Stylist;
use style::stylesheets::{CSSRuleIteratorExt, Origin, Stylesheet, UserAgentStylesheets};
use style::stylesheets::{Origin, Stylesheet, UserAgentStylesheets};
use style::thread_state;
use style::timer::Timer;
use style::workqueue::WorkQueue;
@ -354,21 +354,21 @@ fn add_font_face_rules(stylesheet: &Stylesheet,
outstanding_web_fonts_counter: &Arc<AtomicUsize>) {
if opts::get().load_webfonts_synchronously {
let (sender, receiver) = ipc::channel().unwrap();
for font_face in stylesheet.effective_rules(&device).font_face() {
stylesheet.effective_font_face_rules(&device, |font_face| {
let effective_sources = font_face.effective_sources();
font_cache_thread.add_web_font(font_face.family.clone(),
effective_sources,
sender.clone());
receiver.recv().unwrap();
}
})
} else {
for font_face in stylesheet.effective_rules(&device).font_face() {
stylesheet.effective_font_face_rules(&device, |font_face| {
let effective_sources = font_face.effective_sources();
outstanding_web_fonts_counter.fetch_add(1, Ordering::SeqCst);
font_cache_thread.add_web_font(font_face.family.clone(),
effective_sources,
(*font_cache_sender).clone());
}
})
}
}