mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Derive HeapSizeOf for GradientDisplayItem
This commit is contained in:
parent
55dcee94be
commit
966da85791
1 changed files with 1 additions and 16 deletions
|
@ -1238,7 +1238,7 @@ pub struct ImageDisplayItem {
|
|||
|
||||
|
||||
/// Paints a gradient.
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
||||
pub struct GradientDisplayItem {
|
||||
/// Fields common to all display items.
|
||||
pub base: BaseDisplayItem,
|
||||
|
@ -1253,21 +1253,6 @@ pub struct GradientDisplayItem {
|
|||
pub stops: Vec<GradientStop>,
|
||||
}
|
||||
|
||||
|
||||
impl HeapSizeOf for GradientDisplayItem {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
use heapsize::heap_size_of;
|
||||
use std::os::raw::c_void;
|
||||
|
||||
// We can't measure `stops` via Vec's HeapSizeOf implementation because GradientStop isn't
|
||||
// defined in this module, and we don't want to import GradientStop into util::mem where
|
||||
// the HeapSizeOf trait is defined. So we measure the elements directly.
|
||||
self.base.heap_size_of_children() +
|
||||
heap_size_of(self.stops.as_ptr() as *const c_void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Paints a border.
|
||||
#[derive(Clone, HeapSizeOf, Deserialize, Serialize)]
|
||||
pub struct BorderDisplayItem {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue