aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-05-11 01:31:32 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-05-11 21:05:42 +0200
commit50e0c67e2cf6a3a633126fb0971ada5eff3b6fc8 (patch)
treecf06f96ebbaf0e683353b3329d47be5fa7e558ab /components
parentebd9bf8181d79bb362e1d6b6dfbe334251ce79ee (diff)
downloadservo-50e0c67e2cf6a3a633126fb0971ada5eff3b6fc8.tar.gz
servo-50e0c67e2cf6a3a633126fb0971ada5eff3b6fc8.zip
style: Stop refcounting the stylist.
Diffstat (limited to 'components')
-rw-r--r--components/layout_thread/lib.rs14
-rw-r--r--components/style/gecko/data.rs27
2 files changed, 17 insertions, 24 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index fbca9d3c890..6e1be94deca 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -133,7 +133,7 @@ pub struct LayoutThread {
url: ServoUrl,
/// Performs CSS selector matching and style resolution.
- stylist: ::StyleArc<Stylist>,
+ stylist: Stylist,
/// Is the current reflow of an iframe, as opposed to a root window?
is_iframe: bool,
@@ -418,7 +418,7 @@ impl LayoutThread {
let font_cache_receiver =
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_font_cache_receiver);
- let stylist = StyleArc::new(Stylist::new(device));
+ let stylist = Stylist::new(device);
let outstanding_web_fonts_counter = Arc::new(AtomicUsize::new(0));
let ua_stylesheets = &*UA_STYLESHEETS;
let guard = ua_stylesheets.shared_lock.read();
@@ -679,11 +679,10 @@ impl LayoutThread {
size: display_list.map_or(0, |sc| sc.heap_size_of_children()),
});
- let stylist = self.stylist.as_ref();
reports.push(Report {
path: path![formatted_url, "layout-thread", "stylist"],
kind: ReportKind::ExplicitJemallocHeapSize,
- size: stylist.heap_size_of_children(),
+ size: self.stylist.heap_size_of_children(),
});
// The LayoutThread has data in Persistent TLS...
@@ -780,7 +779,7 @@ impl LayoutThread {
/// Sets quirks mode for the document, causing the quirks mode stylesheet to be used.
fn handle_set_quirks_mode<'a, 'b>(&mut self, quirks_mode: QuirksMode) {
- StyleArc::get_mut(&mut self.stylist).unwrap().set_quirks_mode(quirks_mode);
+ self.stylist.set_quirks_mode(quirks_mode);
}
fn try_get_layout_root<N: LayoutNode>(&self, node: N) -> Option<FlowRef> {
@@ -1038,8 +1037,7 @@ impl LayoutThread {
self.document_shared_lock = Some(document_shared_lock.clone());
let author_guard = document_shared_lock.read();
let device = Device::new(MediaType::Screen, initial_viewport);
- StyleArc::get_mut(&mut self.stylist).unwrap()
- .set_device(device, &author_guard, &data.document_stylesheets);
+ self.stylist.set_device(device, &author_guard, &data.document_stylesheets);
self.viewport_size =
self.stylist.viewport_constraints().map_or(current_screen_size, |constraints| {
@@ -1092,7 +1090,7 @@ impl LayoutThread {
let mut extra_data = ExtraStyleData {
marker: PhantomData,
};
- let needs_dirtying = StyleArc::get_mut(&mut self.stylist).unwrap().update(
+ let needs_dirtying = self.stylist.update(
&data.document_stylesheets,
&guards,
Some(ua_stylesheets),
diff --git a/components/style/gecko/data.rs b/components/style/gecko/data.rs
index 64252c79afc..65fbe6b39fb 100644
--- a/components/style/gecko/data.rs
+++ b/components/style/gecko/data.rs
@@ -25,7 +25,7 @@ use stylist::{ExtraStyleData, Stylist};
/// itself.
pub struct PerDocumentStyleDataImpl {
/// Rule processor.
- pub stylist: Arc<Stylist>,
+ pub stylist: Stylist,
/// List of stylesheets, mirrored from Gecko.
pub stylesheets: StylesheetSet,
@@ -60,7 +60,7 @@ impl PerDocumentStyleData {
let (new_anims_sender, new_anims_receiver) = channel();
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
- stylist: Arc::new(Stylist::new(device)),
+ stylist: Stylist::new(device),
stylesheets: StylesheetSet::new(),
new_animations_sender: new_anims_sender,
new_animations_receiver: new_anims_receiver,
@@ -86,10 +86,7 @@ impl PerDocumentStyleDataImpl {
///
/// Implies also a stylesheet flush.
pub fn reset_device(&mut self, guard: &SharedRwLockReadGuard) {
- {
- let mut stylist = Arc::get_mut(&mut self.stylist).unwrap();
- Arc::get_mut(&mut stylist.device).unwrap().reset();
- }
+ Arc::get_mut(&mut self.stylist.device).unwrap().reset();
self.stylesheets.force_dirty();
self.flush_stylesheets(guard);
}
@@ -100,7 +97,6 @@ impl PerDocumentStyleDataImpl {
return;
}
- let mut stylist = Arc::get_mut(&mut self.stylist).unwrap();
let mut extra_data = ExtraStyleData {
font_faces: &mut self.font_faces,
};
@@ -108,13 +104,13 @@ impl PerDocumentStyleDataImpl {
let author_style_disabled = self.stylesheets.author_style_disabled();
let mut stylesheets = Vec::<Arc<Stylesheet>>::new();
self.stylesheets.flush(&mut stylesheets);
- stylist.clear();
- stylist.rebuild(stylesheets.as_slice(),
- &StylesheetGuards::same(guard),
- /* ua_sheets = */ None,
- /* stylesheets_changed = */ true,
- author_style_disabled,
- &mut extra_data);
+ self.stylist.clear();
+ self.stylist.rebuild(stylesheets.as_slice(),
+ &StylesheetGuards::same(guard),
+ /* ua_sheets = */ None,
+ /* stylesheets_changed = */ true,
+ author_style_disabled,
+ &mut extra_data);
}
/// Get the default computed values for this document.
@@ -125,8 +121,7 @@ impl PerDocumentStyleDataImpl {
/// Clear the stylist. This will be a no-op if the stylist is
/// already cleared; the stylist handles that.
pub fn clear_stylist(&mut self) {
- let mut stylist = Arc::get_mut(&mut self.stylist).unwrap();
- stylist.clear();
+ self.stylist.clear();
}
}