Bug 1628130: Delete webrender::prim_store::PrimitiveSceneData. r=gw

Most `Internable` implementations give `PrimitiveSceneData` as their
`InternData` associated type, the type of data associated with the handle in the
scene builder thread. However, nothing in the scene builder code, or anywhere in
WebRender, actually uses the contents of `PrimitiveSceneData`, so it can be
replaced with `()` with no effect on the code other than memory savings.

Differential Revision: https://phabricator.services.mozilla.com/D70121

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jim Blandy 2020-04-08 19:53:08 +00:00
Родитель baa5044bbb
Коммит 3094dff055
9 изменённых файлов: 25 добавлений и 59 удалений

Просмотреть файл

@ -9,7 +9,7 @@ use crate::intern::{Internable, InternDebug, Handle as InternHandle};
use crate::internal_types::LayoutPrimitiveInfo;
use crate::prim_store::{
InternablePrimitive, PictureIndex, PrimitiveInstanceKind, PrimKey, PrimKeyCommonData, PrimTemplate,
PrimTemplateCommonData, PrimitiveStore, PrimitiveSceneData, RectangleKey,
PrimTemplateCommonData, PrimitiveStore, RectangleKey,
};
#[cfg_attr(feature = "capture", derive(Serialize))]
@ -78,7 +78,7 @@ pub type BackdropDataHandle = InternHandle<Backdrop>;
impl Internable for Backdrop {
type Key = BackdropKey;
type StoreData = BackdropTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for Backdrop {

Просмотреть файл

@ -14,7 +14,7 @@ use crate::internal_types::LayoutPrimitiveInfo;
use crate::prim_store::{
BorderSegmentInfo, BrushSegment, NinePatchDescriptor, PrimKey,
PrimKeyCommonData, PrimTemplate, PrimTemplateCommonData,
PrimitiveInstanceKind, PrimitiveOpacity, PrimitiveSceneData,
PrimitiveInstanceKind, PrimitiveOpacity,
PrimitiveStore, InternablePrimitive,
};
use crate::resource_cache::{ImageRequest, ResourceCache};
@ -146,7 +146,7 @@ pub type NormalBorderDataHandle = intern::Handle<NormalBorderPrim>;
impl intern::Internable for NormalBorderPrim {
type Key = NormalBorderKey;
type StoreData = NormalBorderTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for NormalBorderPrim {
@ -321,7 +321,7 @@ pub type ImageBorderDataHandle = intern::Handle<ImageBorder>;
impl intern::Internable for ImageBorder {
type Key = ImageBorderKey;
type StoreData = ImageBorderTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for ImageBorder {

Просмотреть файл

@ -14,7 +14,7 @@ use crate::gpu_cache::{GpuCacheHandle, GpuDataRequest};
use crate::intern::{Internable, InternDebug, Handle as InternHandle};
use crate::internal_types::LayoutPrimitiveInfo;
use crate::prim_store::{BrushSegment, CachedGradientSegment, GradientTileRange, VectorKey};
use crate::prim_store::{PrimitiveInstanceKind, PrimitiveOpacity, PrimitiveSceneData};
use crate::prim_store::{PrimitiveInstanceKind, PrimitiveOpacity};
use crate::prim_store::{PrimKeyCommonData, PrimTemplateCommonData, PrimitiveStore};
use crate::prim_store::{NinePatchDescriptor, PointKey, SizeKey, InternablePrimitive};
use std::{hash, ops::{Deref, DerefMut}};
@ -282,7 +282,7 @@ pub struct LinearGradient {
impl Internable for LinearGradient {
type Key = LinearGradientKey;
type StoreData = LinearGradientTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for LinearGradient {
@ -512,7 +512,7 @@ pub struct RadialGradient {
impl Internable for RadialGradient {
type Key = RadialGradientKey;
type StoreData = RadialGradientTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for RadialGradient {
@ -732,7 +732,7 @@ pub struct ConicGradient {
impl Internable for ConicGradient {
type Key = ConicGradientKey;
type StoreData = ConicGradientTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for ConicGradient {

Просмотреть файл

@ -15,7 +15,7 @@ use crate::intern::{Internable, InternDebug, Handle as InternHandle};
use crate::internal_types::{LayoutPrimitiveInfo};
use crate::prim_store::{
EdgeAaSegmentMask, OpacityBindingIndex, PrimitiveInstanceKind,
PrimitiveOpacity, PrimitiveSceneData, PrimKey, PrimKeyCommonData,
PrimitiveOpacity, PrimKey, PrimKeyCommonData,
PrimTemplate, PrimTemplateCommonData, PrimitiveStore, SegmentInstanceIndex,
SizeKey, InternablePrimitive,
};
@ -307,7 +307,7 @@ pub type ImageDataHandle = InternHandle<Image>;
impl Internable for Image {
type Key = ImageKey;
type StoreData = ImageTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for Image {
@ -489,7 +489,7 @@ pub type YuvImageDataHandle = InternHandle<YuvImage>;
impl Internable for YuvImage {
type Key = YuvImageKey;
type StoreData = YuvImageTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for YuvImage {

Просмотреть файл

@ -14,7 +14,7 @@ use crate::intern;
use crate::internal_types::LayoutPrimitiveInfo;
use crate::prim_store::{
PrimKey, PrimKeyCommonData, PrimTemplate, PrimTemplateCommonData,
InternablePrimitive, PrimitiveSceneData, PrimitiveStore,
InternablePrimitive, PrimitiveStore,
};
use crate::prim_store::PrimitiveInstanceKind;
@ -127,7 +127,7 @@ pub type LineDecorationDataHandle = intern::Handle<LineDecoration>;
impl intern::Internable for LineDecoration {
type Key = LineDecorationKey;
type StoreData = LineDecorationTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for LineDecoration {

Просмотреть файл

@ -406,17 +406,6 @@ impl GpuCacheAddress {
}
}
/// The information about an interned primitive that
/// is stored and available in the scene builder
/// thread.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(MallocSizeOf)]
pub struct PrimitiveSceneData {
pub prim_size: LayoutSize,
pub flags: PrimitiveFlags,
}
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Copy, Debug, Clone, MallocSizeOf, PartialEq)]
@ -871,7 +860,7 @@ type PrimitiveDataHandle = intern::Handle<PrimitiveKeyKind>;
impl intern::Internable for PrimitiveKeyKind {
type Key = PrimitiveKey;
type StoreData = PrimitiveTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for PrimitiveKeyKind {
@ -4467,7 +4456,7 @@ fn update_opacity_binding(
/// Trait for primitives that are directly internable.
/// see SceneBuilder::add_primitive<P>
pub trait InternablePrimitive: intern::Internable<InternData = PrimitiveSceneData> + Sized {
pub trait InternablePrimitive: intern::Internable<InternData = ()> + Sized {
/// Build a new key from self with `info`.
fn into_key(
self,

Просмотреть файл

@ -15,7 +15,7 @@ use crate::internal_types::{LayoutPrimitiveInfo, Filter};
use crate::picture::PictureCompositeMode;
use crate::prim_store::{
PrimKey, PrimKeyCommonData, PrimTemplate, PrimTemplateCommonData,
PrimitiveInstanceKind, PrimitiveSceneData, PrimitiveStore, VectorKey,
PrimitiveInstanceKind, PrimitiveStore, VectorKey,
InternablePrimitive,
};
@ -279,7 +279,7 @@ pub type PictureDataHandle = InternHandle<Picture>;
impl Internable for Picture {
type Key = PictureKey;
type StoreData = PictureTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for Picture {

Просмотреть файл

@ -11,7 +11,7 @@ use crate::gpu_cache::GpuCache;
use crate::intern;
use crate::internal_types::LayoutPrimitiveInfo;
use crate::picture::{SubpixelMode, SurfaceInfo};
use crate::prim_store::{PrimitiveOpacity, PrimitiveSceneData, PrimitiveScratchBuffer};
use crate::prim_store::{PrimitiveOpacity, PrimitiveScratchBuffer};
use crate::prim_store::{PrimitiveStore, PrimKeyCommonData, PrimTemplateCommonData};
use crate::render_task_graph::RenderTaskGraph;
use crate::renderer::{MAX_VERTEX_TEXTURE_WIDTH};
@ -151,7 +151,7 @@ pub struct TextRun {
impl intern::Internable for TextRun {
type Key = TextRunKey;
type StoreData = TextRunTemplate;
type InternData = PrimitiveSceneData;
type InternData = ();
}
impl InternablePrimitive for TextRun {

Просмотреть файл

@ -23,7 +23,7 @@ use crate::intern::Interner;
use crate::internal_types::{FastHashMap, FastHashSet, LayoutPrimitiveInfo, Filter};
use crate::picture::{Picture3DContext, PictureCompositeMode, PicturePrimitive, PictureOptions};
use crate::picture::{BlitReason, OrderedPictureChild, PrimitiveList, TileCacheInstance, ClusterFlags};
use crate::prim_store::{PrimitiveInstance, PrimitiveSceneData};
use crate::prim_store::PrimitiveInstance;
use crate::prim_store::{PrimitiveInstanceKind, NinePatchDescriptor, PrimitiveStore};
use crate::prim_store::{ScrollNodeAndClipChain, PictureIndex};
use crate::prim_store::{InternablePrimitive, SegmentInstanceIndex};
@ -1589,12 +1589,7 @@ impl<'a> SceneBuilder<'a> {
let current_offset = self.current_offset(spatial_node_index);
let interner = self.interners.as_mut();
let prim_data_handle = interner
.intern(&prim_key, || {
PrimitiveSceneData {
prim_size: info.rect.size,
flags: info.flags,
}
});
.intern(&prim_key, || ());
let instance_kind = P::make_instance_kind(
prim_key,
@ -2603,13 +2598,7 @@ impl<'a> SceneBuilder<'a> {
let shadow_prim_data_handle = self.interners
.picture
.intern(&shadow_pic_key, || {
PrimitiveSceneData {
prim_size: LayoutSize::zero(),
flags: PrimitiveFlags::IS_BACKFACE_VISIBLE,
}
}
);
.intern(&shadow_pic_key, || ());
let shadow_prim_instance = PrimitiveInstance::new(
LayoutPoint::zero(),
@ -4004,13 +3993,7 @@ fn create_prim_instance(
let data_handle = interners
.picture
.intern(&pic_key, || {
PrimitiveSceneData {
prim_size: LayoutSize::zero(),
flags,
}
}
);
.intern(&pic_key, || ());
PrimitiveInstance::new(
LayoutPoint::zero(),
@ -4138,13 +4121,7 @@ fn create_tile_cache(
let pic_data_handle = interners
.picture
.intern(&pic_key, || {
PrimitiveSceneData {
prim_size: LayoutSize::zero(),
flags: PrimitiveFlags::IS_BACKFACE_VISIBLE,
}
}
);
.intern(&pic_key, || ());
// Build a clip-chain for the tile cache, that contains any of the shared clips
// we will apply when drawing the tiles. In all cases provided by Gecko, these