Switch some uses of Arc<AtomicRefCell<T>> over to ArcRefCell<T>

This commit is contained in:
Patrick Walton 2020-03-13 19:30:08 -07:00
parent 5b3f277465
commit 1d9f669cf0
2 changed files with 7 additions and 8 deletions

View file

@ -2,13 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::cell::ArcRefCell;
use crate::context::LayoutContext; use crate::context::LayoutContext;
use crate::element_data::{LayoutBox, LayoutDataForElement}; use crate::element_data::{LayoutBox, LayoutDataForElement};
use crate::geom::PhysicalSize; use crate::geom::PhysicalSize;
use crate::replaced::{CanvasInfo, CanvasSource, ReplacedContent}; use crate::replaced::{CanvasInfo, CanvasSource, ReplacedContent};
use crate::style_ext::{Display, DisplayGeneratingBox, DisplayInside, DisplayOutside}; use crate::style_ext::{Display, DisplayGeneratingBox, DisplayInside, DisplayOutside};
use crate::wrapper::GetRawData; use crate::wrapper::GetRawData;
use atomic_refcell::{AtomicRefCell, AtomicRefMut}; use atomic_refcell::AtomicRefMut;
use html5ever::LocalName; use html5ever::LocalName;
use net_traits::image::base::Image as NetImage; use net_traits::image::base::Image as NetImage;
use script_layout_interface::wrapper_traits::{ use script_layout_interface::wrapper_traits::{
@ -317,12 +318,12 @@ where
} }
pub struct BoxSlot<'dom> { pub struct BoxSlot<'dom> {
slot: Option<ServoArc<AtomicRefCell<Option<LayoutBox>>>>, slot: Option<ArcRefCell<Option<LayoutBox>>>,
marker: marker<&'dom ()>, marker: marker<&'dom ()>,
} }
impl BoxSlot<'_> { impl BoxSlot<'_> {
pub(crate) fn new(slot: ServoArc<AtomicRefCell<Option<LayoutBox>>>) -> Self { pub(crate) fn new(slot: ArcRefCell<Option<LayoutBox>>) -> Self {
*slot.borrow_mut() = None; *slot.borrow_mut() = None;
let slot = Some(slot); let slot = Some(slot);
Self { slot, marker } Self { slot, marker }

View file

@ -5,19 +5,17 @@
use crate::cell::ArcRefCell; use crate::cell::ArcRefCell;
use crate::flow::inline::InlineLevelBox; use crate::flow::inline::InlineLevelBox;
use crate::flow::BlockLevelBox; use crate::flow::BlockLevelBox;
use atomic_refcell::AtomicRefCell;
use servo_arc::Arc;
#[derive(Default)] #[derive(Default)]
pub struct LayoutDataForElement { pub struct LayoutDataForElement {
pub(super) self_box: Arc<AtomicRefCell<Option<LayoutBox>>>, pub(super) self_box: ArcRefCell<Option<LayoutBox>>,
pub(super) pseudo_elements: Option<Box<PseudoElementBoxes>>, pub(super) pseudo_elements: Option<Box<PseudoElementBoxes>>,
} }
#[derive(Default)] #[derive(Default)]
pub(super) struct PseudoElementBoxes { pub(super) struct PseudoElementBoxes {
pub before: Arc<AtomicRefCell<Option<LayoutBox>>>, pub before: ArcRefCell<Option<LayoutBox>>,
pub after: Arc<AtomicRefCell<Option<LayoutBox>>>, pub after: ArcRefCell<Option<LayoutBox>>,
} }
pub(super) enum LayoutBox { pub(super) enum LayoutBox {