Bug 1520678 - Declare intern-related types in a structured way. r=kamidphish
☠☠ backed out by a15dd0f8abd3 ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Fri, 18 Jan 2019 00:39:24 +0000
changeset 454376 1d2ae392021c5fabbd8a19290e965cafc7c09dec
parent 454375 9aa3456410843b6ae80f75c6d668c96dfd31b5fd
child 454377 5fa2f414676e818c36c92276ce9dc20341b877d2
push id35395
push userebalazs@mozilla.com
push dateFri, 18 Jan 2019 09:38:33 +0000
treeherdermozilla-central@88e2eb73aace [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskamidphish
bugs1520678
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1520678 - Declare intern-related types in a structured way. r=kamidphish Differential Revision: https://phabricator.services.mozilla.com/D16779
gfx/wr/webrender/src/clip.rs
gfx/wr/webrender/src/intern_types.rs
gfx/wr/webrender/src/lib.rs
gfx/wr/webrender/src/prim_store/borders.rs
gfx/wr/webrender/src/prim_store/gradient.rs
gfx/wr/webrender/src/prim_store/image.rs
gfx/wr/webrender/src/prim_store/line_dec.rs
gfx/wr/webrender/src/prim_store/mod.rs
gfx/wr/webrender/src/prim_store/picture.rs
gfx/wr/webrender/src/prim_store/text_run.rs
gfx/wr/webrender/src/render_backend.rs
gfx/wr/webrender/src/scene_builder.rs
gfx/wr/webrender_api/src/api.rs
--- a/gfx/wr/webrender/src/clip.rs
+++ b/gfx/wr/webrender/src/clip.rs
@@ -99,25 +99,19 @@ use util::{extract_inner_rect_safe, proj
     +------------------+------------------+------------------+------------------+------------------+
     | flags            | flags            | flags            | flags            | flags            |
     | ...              | ...              | ...              | ...              | ...              |
     +------------------+------------------+------------------+------------------+------------------+
 
  */
 
 // Type definitions for interning clip nodes.
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
-pub struct ClipDataMarker;
 
-pub type ClipDataStore = intern::DataStore<ClipItemKey, ClipNode, ClipDataMarker>;
-pub type ClipDataHandle = intern::Handle<ClipDataMarker>;
-pub type ClipDataUpdateList = intern::UpdateList<ClipItemKey>;
-pub type ClipDataInterner = intern::Interner<ClipItemKey, (), ClipDataMarker>;
+pub use intern_types::clip::Store as ClipDataStore;
+use intern_types::clip::Handle as ClipDataHandle;
 
 // Result of comparing a clip node instance against a local rect.
 #[derive(Debug)]
 enum ClipResult {
     // The clip does not affect the region at all.
     Accept,
     // The clip prevents the region from being drawn.
     Reject,
new file mode 100644
--- /dev/null
+++ b/gfx/wr/webrender/src/intern_types.rs
@@ -0,0 +1,107 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+macro_rules! common {
+    () => (
+        use ::intern;
+        #[allow(unused_imports)]
+        use ::prim_store::PrimitiveSceneData;
+        #[cfg_attr(feature = "capture", derive(Serialize))]
+        #[cfg_attr(feature = "replay", derive(Deserialize))]
+        #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
+        pub struct Marker;
+        pub type Handle = intern::Handle<Marker>;
+    )
+}
+
+pub mod clip {
+common!();
+use ::clip::{ClipItemKey, ClipNode};
+pub type Store = intern::DataStore<ClipItemKey, ClipNode, Marker>;
+pub type UpdateList = intern::UpdateList<ClipItemKey>;
+pub type Interner = intern::Interner<ClipItemKey, (), Marker>;
+}
+
+pub mod prim {
+common!();
+use ::prim_store::{PrimitiveKey, PrimitiveTemplate};
+pub type Store = intern::DataStore<PrimitiveKey, PrimitiveTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<PrimitiveKey>;
+pub type Interner = intern::Interner<PrimitiveKey, PrimitiveSceneData, Marker>;
+}
+
+pub mod normal_border {
+common!();
+use ::prim_store::borders::{NormalBorderKey, NormalBorderTemplate};
+pub type Store = intern::DataStore<NormalBorderKey, NormalBorderTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<NormalBorderKey>;
+pub type Interner = intern::Interner<NormalBorderKey, PrimitiveSceneData, Marker>;
+}
+
+pub mod image_border {
+common!();
+use ::prim_store::borders::{ImageBorderKey, ImageBorderTemplate};
+pub type Store = intern::DataStore<ImageBorderKey, ImageBorderTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<ImageBorderKey>;
+pub type Interner = intern::Interner<ImageBorderKey, PrimitiveSceneData, Marker>;
+}
+
+pub mod image {
+common!();
+use ::prim_store::image::{ImageKey, ImageTemplate};
+pub type Store = intern::DataStore<ImageKey, ImageTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<ImageKey>;
+pub type Interner = intern::Interner<ImageKey, PrimitiveSceneData, Marker>;
+}
+
+pub mod yuv_image {
+common!();
+use ::prim_store::image::{YuvImageKey, YuvImageTemplate};
+pub type Store = intern::DataStore<YuvImageKey, YuvImageTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<YuvImageKey>;
+pub type Interner = intern::Interner<YuvImageKey, PrimitiveSceneData, Marker>;
+}
+
+pub mod line_decoration {
+use ::prim_store::line_dec::{LineDecorationKey, LineDecorationTemplate};
+common!();
+pub type Store = intern::DataStore<LineDecorationKey, LineDecorationTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<LineDecorationKey>;
+pub type Interner = intern::Interner<LineDecorationKey, PrimitiveSceneData, Marker>;
+}
+
+pub mod linear_grad {
+common!();
+use ::prim_store::gradient::{LinearGradientKey, LinearGradientTemplate};
+pub type Store = intern::DataStore<LinearGradientKey, LinearGradientTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<LinearGradientKey>;
+pub type Interner = intern::Interner<LinearGradientKey, PrimitiveSceneData, Marker>;
+}
+
+pub mod radial_grad {
+common!();
+use ::prim_store::gradient::{RadialGradientKey, RadialGradientTemplate};
+pub type Store = intern::DataStore<RadialGradientKey, RadialGradientTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<RadialGradientKey>;
+pub type Interner = intern::Interner<RadialGradientKey, PrimitiveSceneData, Marker>;
+}
+
+pub mod picture {
+common!();
+use ::prim_store::picture::{PictureKey, PictureTemplate};
+pub type Store = intern::DataStore<PictureKey, PictureTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<PictureKey>;
+pub type Interner = intern::Interner<PictureKey, PrimitiveSceneData, Marker>;
+}
+
+pub mod text_run {
+common!();
+use ::prim_store::text_run::{TextRunKey, TextRunTemplate};
+pub type Store = intern::DataStore<TextRunKey, TextRunTemplate, Marker>;
+pub type UpdateList = intern::UpdateList<TextRunKey>;
+pub type Interner = intern::Interner<TextRunKey, PrimitiveSceneData, Marker>;
+}
+
+
+
--- a/gfx/wr/webrender/src/lib.rs
+++ b/gfx/wr/webrender/src/lib.rs
@@ -95,16 +95,17 @@ mod glyph_cache;
 mod glyph_rasterizer;
 mod gpu_cache;
 #[cfg(feature = "pathfinder")]
 mod gpu_glyph_renderer;
 mod gpu_types;
 mod hit_test;
 mod image;
 mod intern;
+mod intern_types;
 mod internal_types;
 mod picture;
 mod prim_store;
 mod print_tree;
 mod profiler;
 mod record;
 mod render_backend;
 mod render_task;
--- a/gfx/wr/webrender/src/prim_store/borders.rs
+++ b/gfx/wr/webrender/src/prim_store/borders.rs
@@ -8,16 +8,17 @@ use api::{
     Shadow
 };
 use border::create_border_segments;
 use border::NormalBorderAu;
 use display_list_flattener::{AsInstanceKind, CreateShadow, IsVisible};
 use frame_builder::{FrameBuildingState};
 use gpu_cache::GpuDataRequest;
 use intern;
+use intern_types;
 use prim_store::{
     BorderSegmentInfo, BrushSegment, NinePatchDescriptor, PrimKey,
     PrimKeyCommonData, PrimTemplate, PrimTemplateCommonData,
     PrimitiveInstanceKind, PrimitiveOpacity, PrimitiveSceneData,
     PrimitiveStore
 };
 use resource_cache::ImageRequest;
 use storage;
@@ -153,28 +154,20 @@ impl From<NormalBorderKey> for NormalBor
                 border_segments,
                 border,
                 widths,
             }
         }
     }
 }
 
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct NormalBorderDataMarker;
-
-pub type NormalBorderDataStore = intern::DataStore<NormalBorderKey, NormalBorderTemplate, NormalBorderDataMarker>;
-pub type NormalBorderDataHandle = intern::Handle<NormalBorderDataMarker>;
-pub type NormalBorderDataUpdateList = intern::UpdateList<NormalBorderKey>;
-pub type NormalBorderDataInterner = intern::Interner<NormalBorderKey, PrimitiveSceneData, NormalBorderDataMarker>;
+pub use intern_types::normal_border::Handle as NormalBorderDataHandle;
 
 impl intern::Internable for NormalBorderPrim {
-    type Marker = NormalBorderDataMarker;
+    type Marker = intern_types::normal_border::Marker;
     type Source = NormalBorderKey;
     type StoreData = NormalBorderTemplate;
     type InternData = PrimitiveSceneData;
 
     /// Build a new key from self with `info`.
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
@@ -330,28 +323,20 @@ impl From<ImageBorderKey> for ImageBorde
             kind: ImageBorderData {
                 request: key.kind.request,
                 brush_segments,
             }
         }
     }
 }
 
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct ImageBorderDataMarker;
-
-pub type ImageBorderDataStore = intern::DataStore<ImageBorderKey, ImageBorderTemplate, ImageBorderDataMarker>;
-pub type ImageBorderDataHandle = intern::Handle<ImageBorderDataMarker>;
-pub type ImageBorderDataUpdateList = intern::UpdateList<ImageBorderKey>;
-pub type ImageBorderDataInterner = intern::Interner<ImageBorderKey, PrimitiveSceneData, ImageBorderDataMarker>;
+pub use intern_types::image_border::Handle as ImageBorderDataHandle;
 
 impl intern::Internable for ImageBorder {
-    type Marker = ImageBorderDataMarker;
+    type Marker = intern_types::image_border::Marker;
     type Source = ImageBorderKey;
     type StoreData = ImageBorderTemplate;
     type InternData = PrimitiveSceneData;
 
     /// Build a new key from self with `info`.
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
--- a/gfx/wr/webrender/src/prim_store/gradient.rs
+++ b/gfx/wr/webrender/src/prim_store/gradient.rs
@@ -4,17 +4,18 @@
 
 use api::{
     ColorF, ColorU,ExtendMode, GradientStop, LayoutPoint, LayoutSize,
     LayoutPrimitiveInfo, PremultipliedColorF
 };
 use display_list_flattener::{AsInstanceKind, IsVisible};
 use frame_builder::FrameBuildingState;
 use gpu_cache::{GpuCacheHandle, GpuDataRequest};
-use intern::{DataStore, Handle, Internable, InternDebug, Interner, UpdateList};
+use intern::{Internable, InternDebug};
+use intern_types;
 use prim_store::{BrushSegment, GradientTileRange};
 use prim_store::{PrimitiveInstanceKind, PrimitiveOpacity, PrimitiveSceneData};
 use prim_store::{PrimKeyCommonData, PrimTemplateCommonData, PrimitiveStore};
 use prim_store::{NinePatchDescriptor, PointKey, SizeKey};
 use std::{hash, ops::{Deref, DerefMut}, mem};
 use util::pack_as_float;
 
 /// A hashable gradient stop that can be used in primitive keys.
@@ -220,39 +221,31 @@ impl LinearGradientTemplate {
                 self.stops_opacity
             } else {
                PrimitiveOpacity::translucent()
             }
         }
     }
 }
 
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct LinearGradientDataMarker;
-
-pub type LinearGradientDataStore = DataStore<LinearGradientKey, LinearGradientTemplate, LinearGradientDataMarker>;
-pub type LinearGradientDataHandle = Handle<LinearGradientDataMarker>;
-pub type LinearGradientDataUpdateList = UpdateList<LinearGradientKey>;
-pub type LinearGradientDataInterner = Interner<LinearGradientKey, PrimitiveSceneData, LinearGradientDataMarker>;
+pub type LinearGradientDataHandle = intern_types::linear_grad::Handle;
 
 pub struct LinearGradient {
     pub extend_mode: ExtendMode,
     pub start_point: PointKey,
     pub end_point: PointKey,
     pub stretch_size: SizeKey,
     pub tile_spacing: SizeKey,
     pub stops: Vec<GradientStopKey>,
     pub reverse_stops: bool,
     pub nine_patch: Option<Box<NinePatchDescriptor>>,
 }
 
 impl Internable for LinearGradient {
-    type Marker = LinearGradientDataMarker;
+    type Marker = intern_types::linear_grad::Marker;
     type Source = LinearGradientKey;
     type StoreData = LinearGradientTemplate;
     type InternData = PrimitiveSceneData;
 
     /// Build a new key from self with `info`.
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
@@ -447,38 +440,30 @@ impl RadialGradientTemplate {
                 &self.stops,
             );
         }
 
         self.opacity = PrimitiveOpacity::translucent();
     }
 }
 
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct RadialGradientDataMarker;
-
-pub type RadialGradientDataStore = DataStore<RadialGradientKey, RadialGradientTemplate, RadialGradientDataMarker>;
-pub type RadialGradientDataHandle = Handle<RadialGradientDataMarker>;
-pub type RadialGradientDataUpdateList = UpdateList<RadialGradientKey>;
-pub type RadialGradientDataInterner = Interner<RadialGradientKey, PrimitiveSceneData, RadialGradientDataMarker>;
+pub type RadialGradientDataHandle = intern_types::radial_grad::Handle;
 
 pub struct RadialGradient {
     pub extend_mode: ExtendMode,
     pub center: PointKey,
     pub params: RadialGradientParams,
     pub stretch_size: SizeKey,
     pub stops: Vec<GradientStopKey>,
     pub tile_spacing: SizeKey,
     pub nine_patch: Option<Box<NinePatchDescriptor>>,
 }
 
 impl Internable for RadialGradient {
-    type Marker = RadialGradientDataMarker;
+    type Marker = intern_types::radial_grad::Marker;
     type Source = RadialGradientKey;
     type StoreData = RadialGradientTemplate;
     type InternData = PrimitiveSceneData;
 
     /// Build a new key from self with `info`.
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
--- a/gfx/wr/webrender/src/prim_store/image.rs
+++ b/gfx/wr/webrender/src/prim_store/image.rs
@@ -6,17 +6,18 @@ use api::{
     AlphaType, ColorDepth, ColorF, ColorU, DeviceIntRect, DeviceIntSideOffsets,
     DeviceIntSize, ImageRendering, LayoutRect, LayoutSize, LayoutPrimitiveInfo,
     PremultipliedColorF, Shadow, TileOffset, YuvColorSpace, YuvFormat
 };
 use api::ImageKey as ApiImageKey;
 use display_list_flattener::{AsInstanceKind, CreateShadow, IsVisible};
 use frame_builder::FrameBuildingState;
 use gpu_cache::{GpuCacheHandle, GpuDataRequest};
-use intern::{DataStore, Handle, Internable, Interner, InternDebug, UpdateList};
+use intern::{Internable, InternDebug};
+use intern_types;
 use prim_store::{
     EdgeAaSegmentMask, OpacityBindingIndex, PrimitiveInstanceKind,
     PrimitiveOpacity, PrimitiveSceneData, PrimKey, PrimKeyCommonData,
     PrimTemplate, PrimTemplateCommonData, PrimitiveStore, SegmentInstanceIndex,
     SizeKey
 };
 use render_task::{
     BlitSource, RenderTask, RenderTaskCacheEntryHandle, RenderTaskCacheKey,
@@ -328,28 +329,20 @@ impl From<ImageKey> for ImageTemplate {
 
         ImageTemplate {
             common,
             kind: image.kind.into(),
         }
     }
 }
 
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct ImageDataMarker;
-
-pub type ImageDataStore = DataStore<ImageKey, ImageTemplate, ImageDataMarker>;
-pub type ImageDataHandle = Handle<ImageDataMarker>;
-pub type ImageDataUpdateList = UpdateList<ImageKey>;
-pub type ImageDataInterner = Interner<ImageKey, PrimitiveSceneData, ImageDataMarker>;
+pub use intern_types::image::Handle as ImageDataHandle;
 
 impl Internable for Image {
-    type Marker = ImageDataMarker;
+    type Marker = intern_types::image::Marker;
     type Source = ImageKey;
     type StoreData = ImageTemplate;
     type InternData = PrimitiveSceneData;
 
     /// Build a new key from self with `info`.
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
@@ -502,28 +495,20 @@ impl From<YuvImageKey> for YuvImageTempl
 
         YuvImageTemplate {
             common,
             kind: image.kind.into(),
         }
     }
 }
 
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct YuvImageDataMarker;
-
-pub type YuvImageDataStore = DataStore<YuvImageKey, YuvImageTemplate, YuvImageDataMarker>;
-pub type YuvImageDataHandle = Handle<YuvImageDataMarker>;
-pub type YuvImageDataUpdateList = UpdateList<YuvImageKey>;
-pub type YuvImageDataInterner = Interner<YuvImageKey, PrimitiveSceneData, YuvImageDataMarker>;
+pub use intern_types::yuv_image::Handle as YuvImageDataHandle;
 
 impl Internable for YuvImage {
-    type Marker = YuvImageDataMarker;
+    type Marker = intern_types::yuv_image::Marker;
     type Source = YuvImageKey;
     type StoreData = YuvImageTemplate;
     type InternData = PrimitiveSceneData;
 
     /// Build a new key from self with `info`.
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
--- a/gfx/wr/webrender/src/prim_store/line_dec.rs
+++ b/gfx/wr/webrender/src/prim_store/line_dec.rs
@@ -6,16 +6,17 @@ use api::{
     ColorF, ColorU, LayoutPrimitiveInfo, LayoutSizeAu,
     LineOrientation, LineStyle, PremultipliedColorF, Shadow,
 };
 use app_units::Au;
 use display_list_flattener::{AsInstanceKind, CreateShadow, IsVisible};
 use frame_builder::{FrameBuildingState};
 use gpu_cache::GpuDataRequest;
 use intern;
+use intern_types;
 use prim_store::{
     PrimKey, PrimKeyCommonData, PrimTemplate, PrimTemplateCommonData,
     PrimitiveSceneData, PrimitiveStore,
 };
 use prim_store::PrimitiveInstanceKind;
 
 #[derive(Clone, Debug, Hash, MallocSizeOf, PartialEq, Eq)]
 #[cfg_attr(feature = "capture", derive(Serialize))]
@@ -128,28 +129,20 @@ impl From<LineDecorationKey> for LineDec
             kind: LineDecorationData {
                 cache_key: line_dec.kind.cache_key,
                 color: line_dec.kind.color.into(),
             }
         }
     }
 }
 
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct LineDecorationDataMarker;
-
-pub type LineDecorationDataStore = intern::DataStore<LineDecorationKey, LineDecorationTemplate, LineDecorationDataMarker>;
-pub type LineDecorationDataHandle = intern::Handle<LineDecorationDataMarker>;
-pub type LineDecorationDataUpdateList = intern::UpdateList<LineDecorationKey>;
-pub type LineDecorationDataInterner = intern::Interner<LineDecorationKey, PrimitiveSceneData, LineDecorationDataMarker>;
+pub use intern_types::line_decoration::Handle as LineDecorationDataHandle;
 
 impl intern::Internable for LineDecoration {
-    type Marker = LineDecorationDataMarker;
+    type Marker = intern_types::line_decoration::Marker;
     type Source = LineDecorationKey;
     type StoreData = LineDecorationTemplate;
     type InternData = PrimitiveSceneData;
 
     /// Build a new key from self with `info`.
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
--- a/gfx/wr/webrender/src/prim_store/mod.rs
+++ b/gfx/wr/webrender/src/prim_store/mod.rs
@@ -816,44 +816,35 @@ impl PrimitiveTemplate {
             }
             PrimitiveTemplateKind::Rectangle { ref color, .. } => {
                 PrimitiveOpacity::from_alpha(color.a)
             }
         };
     }
 }
 
-// Type definitions for interning primitives.
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct PrimitiveDataMarker;
-
 impl intern::Internable for PrimitiveKeyKind {
-    type Marker = PrimitiveDataMarker;
+    type Marker = ::intern_types::prim::Marker;
     type Source = PrimitiveKey;
     type StoreData = PrimitiveTemplate;
     type InternData = PrimitiveSceneData;
 
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
     ) -> PrimitiveKey {
         PrimitiveKey::new(
             info.is_backface_visible,
             info.rect.size,
             self,
         )
     }
 }
 
-pub type PrimitiveDataStore = intern::DataStore<PrimitiveKey, PrimitiveTemplate, PrimitiveDataMarker>;
-pub type PrimitiveDataHandle = intern::Handle<PrimitiveDataMarker>;
-pub type PrimitiveDataUpdateList = intern::UpdateList<PrimitiveKey>;
-pub type PrimitiveDataInterner = intern::Interner<PrimitiveKey, PrimitiveSceneData, PrimitiveDataMarker>;
+use intern_types::prim::Handle as PrimitiveDataHandle;
 
 // Maintains a list of opacity bindings that have been collapsed into
 // the color of a single primitive. This is an important optimization
 // that avoids allocating an intermediate surface for most common
 // uses of opacity filters.
 #[derive(Debug)]
 pub struct OpacityBinding {
     pub bindings: Vec<PropertyBinding<f32>>,
--- a/gfx/wr/webrender/src/prim_store/picture.rs
+++ b/gfx/wr/webrender/src/prim_store/picture.rs
@@ -3,17 +3,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use api::{
     ColorU, FilterOp, LayoutSize, LayoutPrimitiveInfo, MixBlendMode,
     PropertyBinding, PropertyBindingId,
 };
 use app_units::Au;
 use display_list_flattener::{AsInstanceKind, IsVisible};
-use intern::{DataStore, Handle, Internable, Interner, InternDebug, UpdateList};
+use intern::{Internable, InternDebug};
+use intern_types;
 use picture::PictureCompositeMode;
 use prim_store::{
     PrimKey, PrimKeyCommonData, PrimTemplate, PrimTemplateCommonData,
     PrimitiveInstanceKind, PrimitiveSceneData, PrimitiveStore, VectorKey,
 };
 
 /// Represents a hashable description of how a picture primitive
 /// will be composited into its parent.
@@ -180,28 +181,20 @@ impl From<PictureKey> for PictureTemplat
 
         PictureTemplate {
             common,
             kind: PictureData,
         }
     }
 }
 
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct PictureDataMarker;
-
-pub type PictureDataStore = DataStore<PictureKey, PictureTemplate, PictureDataMarker>;
-pub type PictureDataHandle = Handle<PictureDataMarker>;
-pub type PictureDataUpdateList = UpdateList<PictureKey>;
-pub type PictureDataInterner = Interner<PictureKey, PrimitiveSceneData, PictureDataMarker>;
+pub use intern_types::picture::Handle as PictureDataHandle;
 
 impl Internable for Picture {
-    type Marker = PictureDataMarker;
+    type Marker = intern_types::picture::Marker;
     type Source = PictureKey;
     type StoreData = PictureTemplate;
     type InternData = PrimitiveSceneData;
 
     /// Build a new key from self with `info`.
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
--- a/gfx/wr/webrender/src/prim_store/text_run.rs
+++ b/gfx/wr/webrender/src/prim_store/text_run.rs
@@ -5,16 +5,17 @@
 use api::{ColorF, DevicePixelScale, GlyphInstance, LayoutPrimitiveInfo};
 use api::{LayoutToWorldTransform, RasterSpace};
 use api::{LayoutVector2D, Shadow};
 use display_list_flattener::{AsInstanceKind, CreateShadow, IsVisible};
 use frame_builder::{FrameBuildingState, PictureContext};
 use glyph_rasterizer::{FontInstance, FontTransform, GlyphKey, FONT_SIZE_LIMIT};
 use gpu_cache::GpuCache;
 use intern;
+use intern_types;
 use prim_store::{PrimitiveOpacity, PrimitiveSceneData,  PrimitiveScratchBuffer};
 use prim_store::{PrimitiveStore, PrimKeyCommonData, PrimTemplateCommonData, VectorKey};
 use render_task::{RenderTaskTree};
 use renderer::{MAX_VERTEX_TEXTURE_WIDTH};
 use resource_cache::{ResourceCache};
 use util::{MatrixHelpers};
 use prim_store::PrimitiveInstanceKind;
 use std::ops;
@@ -156,35 +157,27 @@ impl TextRunTemplate {
                 request.push(gpu_block);
             }
 
             assert!(request.current_used_block_num() <= MAX_VERTEX_TEXTURE_WIDTH);
         }
     }
 }
 
-#[cfg_attr(feature = "capture", derive(Serialize))]
-#[cfg_attr(feature = "replay", derive(Deserialize))]
-#[derive(Clone, Copy, Debug, Hash, Eq, MallocSizeOf, PartialEq)]
-pub struct TextRunDataMarker;
-
-pub type TextRunDataStore = intern::DataStore<TextRunKey, TextRunTemplate, TextRunDataMarker>;
-pub type TextRunDataHandle = intern::Handle<TextRunDataMarker>;
-pub type TextRunDataUpdateList = intern::UpdateList<TextRunKey>;
-pub type TextRunDataInterner = intern::Interner<TextRunKey, PrimitiveSceneData, TextRunDataMarker>;
+pub use intern_types::text_run::Handle as TextRunDataHandle;
 
 pub struct TextRun {
     pub font: FontInstance,
     pub offset: LayoutVector2D,
     pub glyphs: Arc<Vec<GlyphInstance>>,
     pub shadow: bool,
 }
 
 impl intern::Internable for TextRun {
-    type Marker = TextRunDataMarker;
+    type Marker = intern_types::text_run::Marker;
     type Source = TextRunKey;
     type StoreData = TextRunTemplate;
     type InternData = PrimitiveSceneData;
 
     /// Build a new key from self with `info`.
     fn build_key(
         self,
         info: &LayoutPrimitiveInfo,
--- a/gfx/wr/webrender/src/render_backend.rs
+++ b/gfx/wr/webrender/src/render_backend.rs
@@ -17,34 +17,28 @@ use api::{IdNamespace, LayoutPoint, Pipe
 use api::{MemoryReport};
 use api::{ScrollLocation, ScrollNodeState, TransactionMsg, ResourceUpdate, BlobImageKey};
 use api::{NotificationRequest, Checkpoint};
 use api::channel::{MsgReceiver, MsgSender, Payload};
 #[cfg(feature = "capture")]
 use api::CaptureBits;
 #[cfg(feature = "replay")]
 use api::CapturedDocument;
-use clip::ClipDataStore;
 use clip_scroll_tree::{SpatialNodeIndex, ClipScrollTree};
 #[cfg(feature = "debugger")]
 use debug_server;
 use frame_builder::{FrameBuilder, FrameBuilderConfig};
 use gpu_cache::GpuCache;
 use hit_test::{HitTest, HitTester};
+use intern_types;
 use internal_types::{DebugOutput, FastHashMap, FastHashSet, RenderedDocument, ResultMsg};
 use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
 use picture::RetainedTiles;
-use prim_store::{PrimitiveDataStore, PrimitiveScratchBuffer, PrimitiveInstance};
+use prim_store::{PrimitiveScratchBuffer, PrimitiveInstance};
 use prim_store::{PrimitiveInstanceKind, PrimTemplateCommonData};
-use prim_store::borders::{ImageBorderDataStore, NormalBorderDataStore};
-use prim_store::gradient::{LinearGradientDataStore, RadialGradientDataStore};
-use prim_store::image::{ImageDataStore, YuvImageDataStore};
-use prim_store::line_dec::LineDecorationDataStore;
-use prim_store::picture::PictureDataStore;
-use prim_store::text_run::TextRunDataStore;
 use profiler::{BackendProfileCounters, IpcProfileCounters, ResourceProfileCounters};
 use record::ApiRecordingReceiver;
 use renderer::{AsyncPropertySampler, PipelineInfo};
 use resource_cache::ResourceCache;
 #[cfg(feature = "replay")]
 use resource_cache::PlainCacheOwn;
 #[cfg(any(feature = "capture", feature = "replay"))]
 use resource_cache::PlainResources;
@@ -210,25 +204,25 @@ impl FrameStamp {
     pub const INVALID: FrameStamp = FrameStamp {
         id: FrameId(0),
         time: UNIX_EPOCH,
         document_id: DocumentId::INVALID,
     };
 }
 
 macro_rules! declare_frame_resources {
-    ( $( { $x: ident, $y: ty, $datastore_ident: ident, $datastore_type: ty } )+ ) => {
+    ( $( { $name: ident, $x: ident, $datastore_ident: ident } )+ ) => {
         /// A collection of resources that are shared by clips, primitives
         /// between display lists.
         #[cfg_attr(feature = "capture", derive(Serialize))]
         #[cfg_attr(feature = "replay", derive(Deserialize))]
         #[derive(Default)]
         pub struct FrameResources {
             $(
-                pub $datastore_ident: $datastore_type,
+                pub $datastore_ident: intern_types::$name::Store,
             )+
         }
 
         impl FrameResources {
             /// Reports CPU heap usage.
             fn report_memory(&self, ops: &mut MallocSizeOfOps, r: &mut MemoryReport) {
                 $(
                     r.interning.$datastore_ident += self.$datastore_ident.size_of(ops);
--- a/gfx/wr/webrender/src/scene_builder.rs
+++ b/gfx/wr/webrender/src/scene_builder.rs
@@ -5,64 +5,53 @@
 use api::{AsyncBlobImageRasterizer, BlobImageRequest, BlobImageParams, BlobImageResult};
 use api::{DocumentId, PipelineId, ApiMsg, FrameMsg, ResourceUpdate, ExternalEvent, Epoch};
 use api::{BuiltDisplayList, ColorF, LayoutSize, NotificationRequest, Checkpoint, IdNamespace};
 use api::{MemoryReport};
 use api::channel::MsgSender;
 #[cfg(feature = "capture")]
 use capture::CaptureConfig;
 use frame_builder::{FrameBuilderConfig, FrameBuilder};
-use clip::{ClipDataInterner, ClipDataUpdateList};
 use clip_scroll_tree::ClipScrollTree;
 use display_list_flattener::DisplayListFlattener;
 use intern::{Internable, Interner};
+use intern_types;
 use internal_types::{FastHashMap, FastHashSet};
 use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
-use prim_store::{PrimitiveDataInterner, PrimitiveDataUpdateList, PrimitiveKeyKind};
+use prim_store::{PrimitiveKeyKind};
 use prim_store::PrimitiveStoreStats;
-use prim_store::borders::{
-    ImageBorder, ImageBorderDataInterner, ImageBorderDataUpdateList,
-    NormalBorderPrim, NormalBorderDataInterner, NormalBorderDataUpdateList
-};
-use prim_store::gradient::{
-    LinearGradient, LinearGradientDataInterner, LinearGradientDataUpdateList,
-    RadialGradient, RadialGradientDataInterner, RadialGradientDataUpdateList
-};
-use prim_store::image::{
-    Image, ImageDataInterner, ImageDataUpdateList,
-    YuvImage, YuvImageDataInterner, YuvImageDataUpdateList,
-};
-use prim_store::line_dec::{
-    LineDecoration, LineDecorationDataInterner, LineDecorationDataUpdateList
-};
-use prim_store::picture::{PictureDataInterner, Picture, PictureDataUpdateList};
-use prim_store::text_run::{TextRunDataInterner, TextRun, TextRunDataUpdateList};
+use prim_store::borders::{ImageBorder, NormalBorderPrim};
+use prim_store::gradient::{LinearGradient, RadialGradient};
+use prim_store::image::{Image, YuvImage};
+use prim_store::line_dec::LineDecoration;
+use prim_store::picture::Picture;
+use prim_store::text_run::TextRun;
 use resource_cache::{AsyncBlobImageInfo, FontInstanceMap};
 use render_backend::DocumentView;
 use renderer::{PipelineInfo, SceneBuilderHooks};
 use scene::Scene;
 use std::sync::mpsc::{channel, Receiver, Sender};
 use std::mem::replace;
 use time::precise_time_ns;
 use util::drain_filter;
 use std::thread;
 use std::time::Duration;
 
 pub struct DocumentResourceUpdates {
-    pub clip_updates: ClipDataUpdateList,
-    pub prim_updates: PrimitiveDataUpdateList,
-    pub image_updates: ImageDataUpdateList,
-    pub image_border_updates: ImageBorderDataUpdateList,
-    pub line_decoration_updates: LineDecorationDataUpdateList,
-    pub linear_grad_updates: LinearGradientDataUpdateList,
-    pub normal_border_updates: NormalBorderDataUpdateList,
-    pub picture_updates: PictureDataUpdateList,
-    pub radial_grad_updates: RadialGradientDataUpdateList,
-    pub text_run_updates: TextRunDataUpdateList,
-    pub yuv_image_updates: YuvImageDataUpdateList,
+    pub clip_updates: ::intern_types::clip::UpdateList,
+    pub prim_updates: ::intern_types::prim::UpdateList,
+    pub image_updates: ::intern_types::image::UpdateList,
+    pub image_border_updates: ::intern_types::image_border::UpdateList,
+    pub line_decoration_updates: ::intern_types::line_decoration::UpdateList,
+    pub linear_grad_updates: ::intern_types::linear_grad::UpdateList,
+    pub normal_border_updates: ::intern_types::normal_border::UpdateList,
+    pub picture_updates: ::intern_types::picture::UpdateList,
+    pub radial_grad_updates: ::intern_types::radial_grad::UpdateList,
+    pub text_run_updates: ::intern_types::text_run::UpdateList,
+    pub yuv_image_updates: ::intern_types::yuv_image::UpdateList,
 }
 
 /// Represents the work associated to a transaction before scene building.
 pub struct Transaction {
     pub document_id: DocumentId,
     pub display_list_updates: Vec<DisplayListUpdate>,
     pub removed_pipelines: Vec<PipelineId>,
     pub epoch_updates: Vec<(PipelineId, Epoch)>,
@@ -190,29 +179,29 @@ pub enum SceneBuilderResult {
 // scene swap was completed. We need a separate channel for this
 // so that they don't get mixed with SceneBuilderRequest messages.
 pub enum SceneSwapResult {
     Complete(Sender<()>),
     Aborted,
 }
 
 macro_rules! declare_document_resources {
-    ( $( { $interner_ident: ident, $interner_type: ty, $x: ident, $y: ty } )+ ) => {
+    ( $( { $name: ident, $interner_ident: ident, $y: ident } )+ ) => {
         /// This struct contains all items that can be shared between
         /// display lists. We want to intern and share the same clips,
         /// primitives and other things between display lists so that:
         /// - GPU cache handles remain valid, reducing GPU cache updates.
         /// - Comparison of primitives and pictures between two
         ///   display lists is (a) fast (b) done during scene building.
         #[cfg_attr(feature = "capture", derive(Serialize))]
         #[cfg_attr(feature = "replay", derive(Deserialize))]
         #[derive(Default)]
         pub struct DocumentResources {
             $(
-                pub $interner_ident: $interner_type,
+                pub $interner_ident: intern_types::$name::Interner,
             )+
         }
 
         impl DocumentResources {
             /// Reports CPU heap memory used by the interners.
             fn report_memory(
                 &self,
                 ops: &mut MallocSizeOfOps,
--- a/gfx/wr/webrender_api/src/api.rs
+++ b/gfx/wr/webrender_api/src/api.rs
@@ -820,34 +820,33 @@ impl PipelineId {
 /// IMPORTANT: Keep this synchronized with the list in mozilla-central located at
 /// gfx/webrender_bindings/webrender_ffi.h
 ///
 /// Note that this could be a lot less verbose if concat_idents! were stable. :-(
 #[macro_export]
 macro_rules! enumerate_interners {
     ($macro_name: ident) => {
         $macro_name! {
-            { clip_interner, ClipDataInterner, clip_data_store, ClipDataStore }
-            { prim_interner, PrimitiveDataInterner, prim_data_store, PrimitiveDataStore }
-            { normal_border_interner, NormalBorderDataInterner, normal_border_data_store, NormalBorderDataStore }
-            { image_border_interner, ImageBorderDataInterner, image_border_data_store, ImageBorderDataStore }
-            { image_interner, ImageDataInterner, image_data_store, ImageDataStore }
-            { yuv_image_interner, YuvImageDataInterner, yuv_image_data_store, YuvImageDataStore }
-            { line_decoration_interner, LineDecorationDataInterner,
-              line_decoration_data_store, LineDecorationDataStore }
-            { linear_grad_interner, LinearGradientDataInterner, linear_grad_data_store, LinearGradientDataStore }
-            { radial_grad_interner, RadialGradientDataInterner, radial_grad_data_store, RadialGradientDataStore }
-            { picture_interner, PictureDataInterner, picture_data_store, PictureDataStore }
-            { text_run_interner, TextRunDataInterner, text_run_data_store, TextRunDataStore }
+            { clip, clip_interner, clip_data_store }
+            { prim, prim_interner, prim_data_store }
+            { normal_border, normal_border_interner, normal_border_data_store }
+            { image_border, image_border_interner, image_border_data_store }
+            { image, image_interner, image_data_store }
+            { yuv_image, yuv_image_interner, yuv_image_data_store }
+            { line_decoration, line_decoration_interner, line_decoration_data_store }
+            { linear_grad, linear_grad_interner, linear_grad_data_store }
+            { radial_grad, radial_grad_interner, radial_grad_data_store }
+            { picture, picture_interner, picture_data_store }
+            { text_run, text_run_interner, text_run_data_store }
         }
     }
 }
 
 macro_rules! declare_interning_memory_report {
-    ( $( { $interner_ident: ident, $x: ty, $datastore_ident: ident, $y: ty } )+ ) => {
+    ( $( { $x: ident, $interner_ident: ident, $datastore_ident: ident } )+ ) => {
         #[repr(C)]
         #[derive(Clone, Debug, Default, Deserialize, Serialize)]
         pub struct InterningMemoryReport {
             $(
                 pub $interner_ident: usize,
                 pub $datastore_ident: usize,
             )+
         }