Bug 1345140. Remove unused WebRenderCommand infrastructure. r=kats
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 07 Mar 2017 10:58:08 -0500
changeset 347279 6374644ff317f40c9ddb43483fc70c45a121021b
parent 347278 49be4b9eca3aba79de74cd2346ddc922e4ce7d97
child 347280 335eb4955c12399374249d82de8180425dcc7f83
push id31493
push userkwierso@gmail.com
push dateMon, 13 Mar 2017 20:10:14 +0000
treeherdermozilla-central@7781e4e0a332 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1345140
milestone55.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 1345140. Remove unused WebRenderCommand infrastructure. r=kats
gfx/layers/ipc/WebRenderMessages.ipdlh
gfx/layers/wr/WebRenderBridgeChild.cpp
gfx/layers/wr/WebRenderBridgeChild.h
gfx/layers/wr/WebRenderMessageUtils.h
--- a/gfx/layers/ipc/WebRenderMessages.ipdlh
+++ b/gfx/layers/ipc/WebRenderMessages.ipdlh
@@ -27,127 +27,20 @@ using mozilla::wr::PipelineId from "mozi
 using mozilla::wr::ImageRendering from "mozilla/webrender/WebRenderTypes.h";
 using mozilla::wr::ImageKey from "mozilla/webrender/WebRenderTypes.h";
 using mozilla::wr::FontKey from "mozilla/webrender/WebRenderTypes.h";
 using mozilla::LayerIntRegion from "Units.h";
 
 namespace mozilla {
 namespace layers {
 
-struct OpDPPushStackingContext {
-  WrRect bounds;
-  WrRect overflow;
-  MaybeImageMask mask;
-  float opacity;
-  Animation[] animations;
-  Matrix4x4 matrix;
-  WrMixBlendMode mixBlendMode;
-  uint64_t scrollid;
-};
-
-struct OpDPPopStackingContext { };
-
-struct OpDPPushScrollLayer {
-  WrRect bounds;
-  WrRect overflow;
-  MaybeImageMask mask;
-  uint64_t scrollid;
-};
-
-struct OpDPPopScrollLayer { };
-
-struct OpDPPushRect {
-  WrRect bounds;
-  WrRect clip;
-  WrColor color;
-};
-
-struct OpDPPushBorder {
-  WrRect bounds;
-  WrRect clip;
-  WrBorderSide top;
-  WrBorderSide right;
-  WrBorderSide bottom;
-  WrBorderSide left;
-  WrBorderRadius radius;
-};
-
-struct OpDPPushLinearGradient {
-  WrRect bounds;
-  WrRect clip;
-  WrPoint startPoint;
-  WrPoint endPoint;
-  WrGradientExtendMode extendMode;
-  WrGradientStop[] stops;
-};
-
-struct OpDPPushRadialGradient {
-  WrRect bounds;
-  WrRect clip;
-  WrPoint startCenter;
-  WrPoint endCenter;
-  float startRadius;
-  float endRadius;
-  WrGradientExtendMode extendMode;
-  WrGradientStop[] stops;
-};
-
-struct OpDPPushImage {
-  WrRect bounds;
-  WrRect clip;
-  MaybeImageMask mask;
-  ImageRendering filter;
-  ImageKey key;
-};
-
 struct OpAddExternalImage {
   uint64_t externalImageId;
   ImageKey key;
 };
 
-struct OpDPPushIframe {
-  WrRect bounds;
-  WrRect clip;
-  PipelineId pipelineId;
-};
-
-struct OpDPPushText {
-  WrRect bounds;
-  WrRect clip;
-  WrGlyphArray[] glyph_array;
-  float glyph_size;
-  FontKey key;
-};
-
-struct OpDPPushBoxShadow {
-  WrRect rect;
-  WrRect clip;
-  WrRect box_bounds;
-  WrPoint offset;
-  WrColor color;
-  float blur_radius;
-  float spread_radius;
-  float border_radius;
-  WrBoxShadowClipMode clip_mode;
-};
-
-union WebRenderCommand {
-  OpDPPushStackingContext;
-  OpDPPopStackingContext;
-  OpDPPushScrollLayer;
-  OpDPPopScrollLayer;
-  OpDPPushRect;
-  OpDPPushBorder;
-  OpDPPushLinearGradient;
-  OpDPPushRadialGradient;
-  OpDPPushImage;
-  OpDPPushIframe;
-  OpDPPushText;
-  OpDPPushBoxShadow;
-};
-
 union WebRenderParentCommand {
   OpAddExternalImage;
   CompositableOperation;
 };
 
 } // namespace
 } // namespace
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -42,30 +42,16 @@ WebRenderBridgeChild::Destroy()
 
 void
 WebRenderBridgeChild::ActorDestroy(ActorDestroyReason why)
 {
   mDestroyed = true;
 }
 
 void
-WebRenderBridgeChild::AddWebRenderCommand(const WebRenderCommand& aCmd)
-{
-  MOZ_ASSERT(mIsInTransaction);
-  mCommands.AppendElement(aCmd);
-}
-
-void
-WebRenderBridgeChild::AddWebRenderCommands(const nsTArray<WebRenderCommand>& aCommands)
-{
-  MOZ_ASSERT(mIsInTransaction);
-  mCommands.AppendElements(aCommands);
-}
-
-void
 WebRenderBridgeChild::AddWebRenderParentCommand(const WebRenderParentCommand& aCmd)
 {
   MOZ_ASSERT(mIsInTransaction);
   mParentCommands.AppendElement(aCmd);
 }
 
 void
 WebRenderBridgeChild::AddWebRenderParentCommands(const nsTArray<WebRenderParentCommand>& aCommands)
@@ -83,120 +69,16 @@ WebRenderBridgeChild::DPBegin(const gfx:
   UpdateFwdTransactionId();
   this->SendDPBegin(aSize);
   mIsInTransaction = true;
   mReadLockSequenceNumber = 0;
   mReadLocks.AppendElement();
   return true;
 }
 
-wr::BuiltDisplayList
-WebRenderBridgeChild::ProcessWebrenderCommands(const gfx::IntSize &aSize,
-                                               InfallibleTArray<WebRenderCommand>& aCommands)
-{
-  wr::DisplayListBuilder builder(mPipelineId);
-  builder.Begin(ViewAs<LayerPixel>(aSize));
-
-  for (InfallibleTArray<WebRenderCommand>::index_type i = 0; i < aCommands.Length(); ++i) {
-    const WebRenderCommand& cmd = aCommands[i];
-
-    switch (cmd.type()) {
-      case WebRenderCommand::TOpDPPushStackingContext: {
-        const OpDPPushStackingContext& op = cmd.get_OpDPPushStackingContext();
-        builder.PushStackingContext(op.bounds(), op.overflow(), op.mask().ptrOr(nullptr), op.opacity(), op.matrix(), op.mixBlendMode());
-        break;
-      }
-      case WebRenderCommand::TOpDPPopStackingContext: {
-        builder.PopStackingContext();
-        break;
-      }
-      case WebRenderCommand::TOpDPPushScrollLayer: {
-        const OpDPPushScrollLayer& op = cmd.get_OpDPPushScrollLayer();
-        builder.PushScrollLayer(op.bounds(), op.overflow(), op.mask().ptrOr(nullptr));
-        break;
-      }
-      case WebRenderCommand::TOpDPPopScrollLayer: {
-        builder.PopScrollLayer();
-        break;
-      }
-      case WebRenderCommand::TOpDPPushRect: {
-        const OpDPPushRect& op = cmd.get_OpDPPushRect();
-        builder.PushRect(op.bounds(), op.clip(), op.color());
-        break;
-      }
-      case WebRenderCommand::TOpDPPushBorder: {
-        const OpDPPushBorder& op = cmd.get_OpDPPushBorder();
-        builder.PushBorder(op.bounds(), op.clip(),
-                           op.top(), op.right(), op.bottom(), op.left(),
-                           op.radius());
-        break;
-      }
-      case WebRenderCommand::TOpDPPushLinearGradient: {
-        const OpDPPushLinearGradient& op = cmd.get_OpDPPushLinearGradient();
-        builder.PushLinearGradient(op.bounds(), op.clip(),
-                                   op.startPoint(), op.endPoint(),
-                                   op.stops(), op.extendMode());
-        break;
-      }
-      case WebRenderCommand::TOpDPPushRadialGradient: {
-        const OpDPPushRadialGradient& op = cmd.get_OpDPPushRadialGradient();
-        builder.PushRadialGradient(op.bounds(), op.clip(),
-                                   op.startCenter(), op.endCenter(),
-                                   op.startRadius(), op.endRadius(),
-                                   op.stops(), op.extendMode());
-        break;
-      }
-      case WebRenderCommand::TOpDPPushImage: {
-        const OpDPPushImage& op = cmd.get_OpDPPushImage();
-        builder.PushImage(op.bounds(), op.clip(),
-                          op.mask().ptrOr(nullptr), op.filter(), wr::ImageKey(op.key()));
-        break;
-      }
-      case WebRenderCommand::TOpDPPushIframe: {
-        const OpDPPushIframe& op = cmd.get_OpDPPushIframe();
-        builder.PushIFrame(op.bounds(), op.clip(), op.pipelineId());
-        break;
-      }
-      case WebRenderCommand::TOpDPPushText: {
-        const OpDPPushText& op = cmd.get_OpDPPushText();
-        const nsTArray<WrGlyphArray>& glyph_array = op.glyph_array();
-
-        for (size_t i = 0; i < glyph_array.Length(); i++) {
-          const nsTArray<WrGlyphInstance>& glyphs = glyph_array[i].glyphs;
-          builder.PushText(op.bounds(),
-                           op.clip(),
-                           glyph_array[i].color,
-                           op.key(),
-                           Range<const WrGlyphInstance>(glyphs.Elements(), glyphs.Length()),
-                           op.glyph_size());
-        }
-
-        break;
-      }
-      case WebRenderCommand::TOpDPPushBoxShadow: {
-        const OpDPPushBoxShadow& op = cmd.get_OpDPPushBoxShadow();
-        builder.PushBoxShadow(op.rect(),
-                              op.clip(),
-                              op.box_bounds(),
-                              op.offset(),
-                              op.color(),
-                              op.blur_radius(),
-                              op.spread_radius(),
-                              op.border_radius(),
-                              op.clip_mode());
-        break;
-      }
-      default:
-        NS_RUNTIMEABORT("not reached");
-    }
-  }
-  builder.End();
-  return builder.Finalize();
-}
-
 void
 WebRenderBridgeChild::DPEnd(wr::DisplayListBuilder &aBuilder, const gfx::IntSize& aSize, bool aIsSync, uint64_t aTransactionId)
 {
   MOZ_ASSERT(!mDestroyed);
   MOZ_ASSERT(mIsInTransaction);
 
   for (nsTArray<ReadLockInit>& locks : mReadLocks) {
     if (locks.Length()) {
@@ -214,17 +96,16 @@ WebRenderBridgeChild::DPEnd(wr::DisplayL
   if (aIsSync) {
     this->SendDPSyncEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
                         dlData, dl.dl_desc, auxData, dl.aux_desc);
   } else {
     this->SendDPEnd(aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(), aTransactionId,
                     dlData, dl.dl_desc, auxData, dl.aux_desc);
   }
 
-  mCommands.Clear();
   mParentCommands.Clear();
   mDestroyedActors.Clear();
   mReadLocks.Clear();
   mIsInTransaction = false;
 }
 
 uint64_t
 WebRenderBridgeChild::GetNextExternalImageId()
--- a/gfx/layers/wr/WebRenderBridgeChild.h
+++ b/gfx/layers/wr/WebRenderBridgeChild.h
@@ -29,18 +29,16 @@ class TextureForwarder;
 class WebRenderBridgeChild final : public PWebRenderBridgeChild
                                  , public CompositableForwarder
 {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderBridgeChild, override)
 
 public:
   explicit WebRenderBridgeChild(const wr::PipelineId& aPipelineId);
 
-  void AddWebRenderCommand(const WebRenderCommand& aCmd);
-  void AddWebRenderCommands(const nsTArray<WebRenderCommand>& aCommands);
   void AddWebRenderParentCommand(const WebRenderParentCommand& aCmd);
   void AddWebRenderParentCommands(const nsTArray<WebRenderParentCommand>& aCommands);
 
   bool DPBegin(const  gfx::IntSize& aSize);
   void DPEnd(wr::DisplayListBuilder &aBuilder, const gfx::IntSize& aSize, bool aIsSync, uint64_t aTransactionId);
 
   CompositorBridgeChild* GetCompositorBridgeChild();
 
@@ -71,19 +69,16 @@ public:
 
 private:
   friend class CompositorBridgeChild;
 
   ~WebRenderBridgeChild() {}
 
   uint64_t GetNextExternalImageId();
 
-  wr::BuiltDisplayList ProcessWebrenderCommands(const gfx::IntSize &aSize,
-                                                InfallibleTArray<WebRenderCommand>& aCommands);
-
   // CompositableForwarder
   void Connect(CompositableClient* aCompositable,
                ImageContainer* aImageContainer = nullptr) override;
   void UseTiledLayerBuffer(CompositableClient* aCompositable,
                            const SurfaceDescriptorTiles& aTiledDescriptor) override;
   void UpdateTextureRegion(CompositableClient* aCompositable,
                            const ThebesBufferData& aThebesBufferData,
                            const nsIntRegion& aUpdatedRegion) override;
@@ -111,17 +106,16 @@ private:
   void ReleaseIPDLReference() {
     MOZ_ASSERT(mIPCOpen == true);
     mIPCOpen = false;
     Release();
   }
 
   bool AddOpDestroy(const OpDestroy& aOp);
 
-  nsTArray<WebRenderCommand> mCommands;
   nsTArray<WebRenderParentCommand> mParentCommands;
   nsTArray<OpDestroy> mDestroyedActors;
   nsDataHashtable<nsUint64HashKey, CompositableClient*> mCompositables;
   nsTArray<nsTArray<ReadLockInit>> mReadLocks;
   uint64_t mReadLockSequenceNumber;
   bool mIsInTransaction;
   uint32_t mIdNamespace;
   uint32_t mResourceId;
--- a/gfx/layers/wr/WebRenderMessageUtils.h
+++ b/gfx/layers/wr/WebRenderMessageUtils.h
@@ -94,145 +94,16 @@ struct ParamTraits<WrImageFormat>
   : public ContiguousEnumSerializer<
         WrImageFormat,
         WrImageFormat::Invalid,
         WrImageFormat::Sentinel>
 {
 };
 
 template<>
-struct ParamTraits<WrBorderStyle>
-  : public ContiguousEnumSerializer<
-        WrBorderStyle,
-        WrBorderStyle::None,
-        WrBorderStyle::Sentinel>
-{
-};
-
-template<>
-struct ParamTraits<WrColor>
-{
-  static void
-  Write(Message* aMsg, const WrColor& aParam)
-  {
-    WriteParam(aMsg, aParam.r);
-    WriteParam(aMsg, aParam.g);
-    WriteParam(aMsg, aParam.b);
-    WriteParam(aMsg, aParam.a);
-  }
-
-  static bool
-  Read(const Message* aMsg, PickleIterator* aIter, WrColor* aResult)
-  {
-    return ReadParam(aMsg, aIter, &aResult->r)
-        && ReadParam(aMsg, aIter, &aResult->g)
-        && ReadParam(aMsg, aIter, &aResult->b)
-        && ReadParam(aMsg, aIter, &aResult->a);
-  }
-};
-
-template<>
-struct ParamTraits<WrGlyphInstance>
-{
-  static void
-  Write(Message* aMsg, const WrGlyphInstance& aParam)
-  {
-    WriteParam(aMsg, aParam.index);
-    WriteParam(aMsg, aParam.x);
-    WriteParam(aMsg, aParam.y);
-  }
-
-  static bool
-  Read(const Message* aMsg, PickleIterator* aIter, WrGlyphInstance* aResult)
-  {
-    return ReadParam(aMsg, aIter, &aResult->index)
-        && ReadParam(aMsg, aIter, &aResult->x)
-        && ReadParam(aMsg, aIter, &aResult->y);
-  }
-};
-
-template<>
-struct ParamTraits<WrGlyphArray>
-{
-  static void
-  Write(Message* aMsg, const WrGlyphArray& aParam)
-  {
-    WriteParam(aMsg, aParam.color);
-    size_t length = aParam.glyphs.Length();
-
-    WriteParam(aMsg, length);
-
-    for (size_t i = 0; i < length; i++) {
-      WriteParam(aMsg, aParam.glyphs[i]);
-    }
-  }
-
-  static bool
-  Read(const Message* aMsg, PickleIterator* aIter, WrGlyphArray* aResult)
-  {
-    if (!ReadParam(aMsg, aIter, &aResult->color)) {
-      return false;
-    }
-
-    size_t length;
-    if (!ReadParam(aMsg, aIter, &length)) {
-      return false;
-    }
-
-    aResult->glyphs.SetLength(length);
-
-    for (size_t i = 0; i < length; i++) {
-      if (!ReadParam(aMsg, aIter, &aResult->glyphs[i])) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-};
-
-template<>
-struct ParamTraits<WrGradientStop>
-{
-  static void
-  Write(Message* aMsg, const WrGradientStop& aParam)
-  {
-    WriteParam(aMsg, aParam.offset);
-    WriteParam(aMsg, aParam.color);
-  }
-
-  static bool
-  Read(const Message* aMsg, PickleIterator* aIter, WrGradientStop* aResult)
-  {
-    return ReadParam(aMsg, aIter, &aResult->offset)
-        && ReadParam(aMsg, aIter, &aResult->color);
-  }
-};
-
-template<>
-struct ParamTraits<WrBorderSide>
-{
-  static void
-  Write(Message* aMsg, const WrBorderSide& aParam)
-  {
-    WriteParam(aMsg, aParam.width);
-    WriteParam(aMsg, aParam.color);
-    WriteParam(aMsg, aParam.style);
-  }
-
-  static bool
-  Read(const Message* aMsg, PickleIterator* aIter, WrBorderSide* aResult)
-  {
-    return ReadParam(aMsg, aIter, &aResult->width)
-        && ReadParam(aMsg, aIter, &aResult->color)
-        && ReadParam(aMsg, aIter, &aResult->style);
-  }
-};
-
-template<>
 struct ParamTraits<WrLayoutSize>
 {
   static void
   Write(Message* aMsg, const WrLayoutSize& aParam)
   {
     WriteParam(aMsg, aParam.width);
     WriteParam(aMsg, aParam.height);
   }
@@ -241,38 +112,16 @@ struct ParamTraits<WrLayoutSize>
   Read(const Message* aMsg, PickleIterator* aIter, WrLayoutSize* aResult)
   {
     return ReadParam(aMsg, aIter, &aResult->width)
         && ReadParam(aMsg, aIter, &aResult->height);
   }
 };
 
 template<>
-struct ParamTraits<WrBorderRadius>
-{
-  static void
-  Write(Message* aMsg, const WrBorderRadius& aParam)
-  {
-    WriteParam(aMsg, aParam.top_left);
-    WriteParam(aMsg, aParam.top_right);
-    WriteParam(aMsg, aParam.bottom_left);
-    WriteParam(aMsg, aParam.bottom_right);
-  }
-
-  static bool
-  Read(const Message* aMsg, PickleIterator* aIter, WrBorderRadius* aResult)
-  {
-    return ReadParam(aMsg, aIter, &aResult->top_left)
-        && ReadParam(aMsg, aIter, &aResult->top_right)
-        && ReadParam(aMsg, aIter, &aResult->bottom_left)
-        && ReadParam(aMsg, aIter, &aResult->bottom_right);
-  }
-};
-
-template<>
 struct ParamTraits<WrRect>
 {
   static void
   Write(Message* aMsg, const WrRect& aParam)
   {
     WriteParam(aMsg, aParam.x);
     WriteParam(aMsg, aParam.y);
     WriteParam(aMsg, aParam.width);
@@ -303,36 +152,16 @@ struct ParamTraits<WrPoint>
   Read(const Message* aMsg, PickleIterator* aIter, WrPoint* aResult)
   {
     return ReadParam(aMsg, aIter, &aResult->x) &&
            ReadParam(aMsg, aIter, &aResult->y);
   }
 };
 
 template<>
-struct ParamTraits<WrImageMask>
-{
-  static void
-  Write(Message* aMsg, const WrImageMask& aParam)
-  {
-    WriteParam(aMsg, aParam.image);
-    WriteParam(aMsg, aParam.rect);
-    WriteParam(aMsg, aParam.repeat);
-  }
-
-  static bool
-  Read(const Message* aMsg, PickleIterator* aIter, WrImageMask* aResult)
-  {
-    return ReadParam(aMsg, aIter, &aResult->image)
-        && ReadParam(aMsg, aIter, &aResult->rect)
-        && ReadParam(aMsg, aIter, &aResult->repeat);
-  }
-};
-
-template<>
 struct ParamTraits<WrBuiltDisplayListDescriptor>
 {
   static void
   Write(Message* aMsg, const WrBuiltDisplayListDescriptor& aParam)
   {
     WriteParam(aMsg, aParam.display_list_items_size);
   }
 
@@ -360,48 +189,11 @@ struct ParamTraits<WrAuxiliaryListsDescr
   {
     return ReadParam(aMsg, aIter, &aResult->gradient_stops_size)
         && ReadParam(aMsg, aIter, &aResult->complex_clip_regions_size)
         && ReadParam(aMsg, aIter, &aResult->filters_size)
         && ReadParam(aMsg, aIter, &aResult->glyph_instances_size);
   }
 };
 
-
-template<>
-struct ParamTraits<WrImageRendering>
-  : public ContiguousEnumSerializer<
-        WrImageRendering,
-        WrImageRendering::Auto,
-        WrImageRendering::Sentinel>
-{
-};
-
-template<>
-struct ParamTraits<WrMixBlendMode>
-  : public ContiguousEnumSerializer<
-        WrMixBlendMode,
-        WrMixBlendMode::Normal,
-        WrMixBlendMode::Sentinel>
-{
-};
-
-template<>
-struct ParamTraits<WrBoxShadowClipMode>
-  : public ContiguousEnumSerializer<
-        WrBoxShadowClipMode,
-        WrBoxShadowClipMode::None,
-        WrBoxShadowClipMode::Sentinel>
-{
-};
-
-template<>
-struct ParamTraits<WrGradientExtendMode>
-  : public ContiguousEnumSerializer<
-        WrGradientExtendMode,
-        WrGradientExtendMode::Clamp,
-        WrGradientExtendMode::Sentinel>
-{
-};
-
 } // namespace IPC
 
 #endif // GFX_WEBRENDERMESSAGEUTILS_H