diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-05-09 12:43:19 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-05-10 12:43:05 +0200 |
commit | f429c28f23bb21812deb042bf50e4bf16b9e1f1b (patch) | |
tree | a8db3e1774db4cc31bf25c65926dbc4779d298dd /components/servo_arc | |
parent | 0d5c4481b8b5f96325260ee0ffc2b5f206c97548 (diff) | |
download | servo-f429c28f23bb21812deb042bf50e4bf16b9e1f1b.tar.gz servo-f429c28f23bb21812deb042bf50e4bf16b9e1f1b.zip |
style: Add bindings for ArcSlice and ThinArc, and use them to reduce copies of SVG path data.
As I said over bug 1549593, the eventual goal is to use ArcSlice in all
inherited properties. But this seemed like a good first candidate that doesn't
require me to move around a lot more code, since we were already using cbindgen
for the path commands.
Differential Revision: https://phabricator.services.mozilla.com/D30134
Diffstat (limited to 'components/servo_arc')
-rw-r--r-- | components/servo_arc/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs index 09b81920164..b7c179cd13f 100644 --- a/components/servo_arc/lib.rs +++ b/components/servo_arc/lib.rs @@ -308,6 +308,9 @@ impl<T: ?Sized> Arc<T> { impl<T: ?Sized> Clone for Arc<T> { #[inline] fn clone(&self) -> Self { + // NOTE(emilio): If you change anything here, make sure that the + // implementation in layout/style/ServoStyleConstsInlines.h matches! + // // Using a relaxed ordering to check for STATIC_REFCOUNT is safe, since // `count` never changes between STATIC_REFCOUNT and other values. if self.inner().count.load(Relaxed) != STATIC_REFCOUNT { @@ -416,6 +419,9 @@ impl<T: ?Sized> Arc<T> { impl<T: ?Sized> Drop for Arc<T> { #[inline] fn drop(&mut self) { + // NOTE(emilio): If you change anything here, make sure that the + // implementation in layout/style/ServoStyleConstsInlines.h matches! + // // Using a relaxed ordering to check for STATIC_REFCOUNT is safe, since // `count` never changes between STATIC_REFCOUNT and other values. if self.inner().count.load(Relaxed) == STATIC_REFCOUNT { @@ -571,6 +577,7 @@ impl<T: Serialize> Serialize for Arc<T> { /// Structure to allow Arc-managing some fixed-sized data and a variably-sized /// slice in a single allocation. #[derive(Debug, Eq, PartialEq, PartialOrd)] +#[repr(C)] pub struct HeaderSlice<H, T: ?Sized> { /// The fixed-sized data. pub header: H, @@ -743,6 +750,7 @@ impl<H, T> Arc<HeaderSlice<H, [T]>> { /// Header data with an inline length. Consumers that use HeaderWithLength as the /// Header type in HeaderSlice can take advantage of ThinArc. #[derive(Debug, Eq, PartialEq, PartialOrd)] +#[repr(C)] pub struct HeaderWithLength<H> { /// The fixed-sized data. pub header: H, |