diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-10-07 12:22:06 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-11-14 21:24:19 +0100 |
commit | 73917cce83d2225b51b29c374d861d71ec69435f (patch) | |
tree | ac8c6b562ca3e88a7d853ddcab88d114362559e7 /components/style/gecko/data.rs | |
parent | b7eb36fa84e6c6c77727ea2cd02c57f6750dc7af (diff) | |
download | servo-73917cce83d2225b51b29c374d861d71ec69435f.tar.gz servo-73917cce83d2225b51b29c374d861d71ec69435f.zip |
style: Use rayon instead of our custom work queue.
Diffstat (limited to 'components/style/gecko/data.rs')
-rw-r--r-- | components/style/gecko/data.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/components/style/gecko/data.rs b/components/style/gecko/data.rs index 1cc360fdeb8..2f6ed96c71f 100644 --- a/components/style/gecko/data.rs +++ b/components/style/gecko/data.rs @@ -4,15 +4,14 @@ use animation::Animation; use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; -use context::SharedStyleContext; use dom::OpaqueNode; use euclid::size::TypedSize2D; use gecko_bindings::bindings::RawServoStyleSet; use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI}; use media_queries::{Device, MediaType}; use num_cpus; -use parallel::WorkQueueData; use parking_lot::RwLock; +use rayon; use selector_matching::Stylist; use std::cmp; use std::collections::HashMap; @@ -21,8 +20,6 @@ use std::sync::Arc; use std::sync::mpsc::{Receiver, Sender, channel}; use style_traits::ViewportPx; use stylesheets::Stylesheet; -use thread_state; -use workqueue::WorkQueue; pub struct PerDocumentStyleDataImpl { /// Rule processor. @@ -41,7 +38,7 @@ pub struct PerDocumentStyleDataImpl { pub expired_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>, // FIXME(bholley): This shouldn't be per-document. - pub work_queue: Option<WorkQueue<SharedStyleContext, WorkQueueData>>, + pub work_queue: Option<rayon::ThreadPool>, pub num_threads: usize, } @@ -76,7 +73,9 @@ impl PerDocumentStyleData { work_queue: if *NUM_THREADS <= 1 { None } else { - WorkQueue::new("StyleWorker", thread_state::LAYOUT, *NUM_THREADS).ok() + let configuration = + rayon::Configuration::new().set_num_threads(*NUM_THREADS); + rayon::ThreadPool::new(configuration).ok() }, num_threads: *NUM_THREADS, })) @@ -112,8 +111,6 @@ unsafe impl HasBoxFFI for PerDocumentStyleData {} impl Drop for PerDocumentStyleDataImpl { fn drop(&mut self) { - if let Some(ref mut queue) = self.work_queue { - queue.shutdown(); - } + let _ = self.work_queue.take(); } } |