Bug 1727423 - Convert some usage of LayerManager to WindowRenderer in image/. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 25 Aug 2021 07:35:17 +0000
changeset 589857 0e0ca21818f67cb8ce778ceee2bfeccdaa05b72b
parent 589856 ccc07e1c94decf12c54e5b21c5e85e0de1296fbb
child 589858 f1086c70c60e04d45640803305e6839b8b45fb14
push id38735
push usernbeleuzu@mozilla.com
push dateWed, 25 Aug 2021 15:39:54 +0000
treeherdermozilla-central@55a7e8179f28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1727423
milestone93.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 1727423 - Convert some usage of LayerManager to WindowRenderer in image/. r=jrmuizel Differential Revision: https://phabricator.services.mozilla.com/D123554
gfx/layers/LayerManager.h
image/ClippedImage.cpp
image/ClippedImage.h
image/DynamicImage.cpp
image/FrozenImage.cpp
image/FrozenImage.h
image/Image.cpp
image/Image.h
image/ImageWrapper.cpp
image/OrientedImage.cpp
image/OrientedImage.h
image/RasterImage.cpp
image/RasterImage.h
image/VectorImage.cpp
image/VectorImage.h
image/imgIContainer.idl
layout/painting/WindowRenderer.h
--- a/gfx/layers/LayerManager.h
+++ b/gfx/layers/LayerManager.h
@@ -401,22 +401,16 @@ class LayerManager : public WindowRender
   virtual already_AddRefed<mozilla::gfx::DrawTarget> CreateDrawTarget(
       const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
 
   virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) {
     return true;
   }
 
   /**
-   * returns the maximum texture size on this layer backend, or INT32_MAX
-   * if there is no maximum
-   */
-  virtual int32_t GetMaxTextureSize() const = 0;
-
-  /**
    * This setter can be used anytime. The user data for all keys is
    * initially null. Ownership pases to the layer manager.
    */
   void SetUserData(void* aKey, LayerUserData* aData) {
     mUserData.Add(static_cast<gfx::UserDataKey*>(aKey), aData,
                   LayerUserDataDestroy);
   }
   /**
--- a/image/ClippedImage.cpp
+++ b/image/ClippedImage.cpp
@@ -294,25 +294,25 @@ ClippedImage::IsImageContainerAvailable(
                                         uint32_t aFlags) {
   if (!ShouldClip()) {
     return InnerImage()->IsImageContainerAvailable(aManager, aFlags);
   }
   return false;
 }
 
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
-ClippedImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags) {
+ClippedImage::GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) {
   // XXX(seth): We currently don't have a way of clipping the result of
   // GetImageContainer. We work around this by always returning null, but if it
   // ever turns out that ClippedImage is widely used on codepaths that can
   // actually benefit from GetImageContainer, it would be a good idea to fix
   // that method for performance reasons.
 
   if (!ShouldClip()) {
-    return InnerImage()->GetImageContainer(aManager, aFlags);
+    return InnerImage()->GetImageContainer(aRenderer, aFlags);
   }
 
   return nullptr;
 }
 
 NS_IMETHODIMP_(bool)
 ClippedImage::IsImageContainerAvailableAtSize(LayerManager* aManager,
                                               const IntSize& aSize,
@@ -320,31 +320,31 @@ ClippedImage::IsImageContainerAvailableA
   if (!ShouldClip()) {
     return InnerImage()->IsImageContainerAvailableAtSize(aManager, aSize,
                                                          aFlags);
   }
   return false;
 }
 
 NS_IMETHODIMP_(ImgDrawResult)
-ClippedImage::GetImageContainerAtSize(layers::LayerManager* aManager,
+ClippedImage::GetImageContainerAtSize(WindowRenderer* aRenderer,
                                       const gfx::IntSize& aSize,
                                       const Maybe<SVGImageContext>& aSVGContext,
                                       const Maybe<ImageIntRegion>& aRegion,
                                       uint32_t aFlags,
                                       layers::ImageContainer** aOutContainer) {
   // XXX(seth): We currently don't have a way of clipping the result of
   // GetImageContainer. We work around this by always returning null, but if it
   // ever turns out that ClippedImage is widely used on codepaths that can
   // actually benefit from GetImageContainer, it would be a good idea to fix
   // that method for performance reasons.
 
   if (!ShouldClip()) {
     return InnerImage()->GetImageContainerAtSize(
-        aManager, aSize, aSVGContext, aRegion, aFlags, aOutContainer);
+        aRenderer, aSize, aSVGContext, aRegion, aFlags, aOutContainer);
   }
 
   return ImgDrawResult::NOT_SUPPORTED;
 }
 
 static bool MustCreateSurface(gfxContext* aContext, const nsIntSize& aSize,
                               const ImageRegion& aRegion,
                               const uint32_t aFlags) {
--- a/image/ClippedImage.h
+++ b/image/ClippedImage.h
@@ -41,24 +41,23 @@ class ClippedImage : public ImageWrapper
   GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
   NS_IMETHOD_(already_AddRefed<SourceSurface>)
   GetFrameAtSize(const gfx::IntSize& aSize, uint32_t aWhichFrame,
                  uint32_t aFlags) override;
   NS_IMETHOD_(bool)
   IsImageContainerAvailable(layers::LayerManager* aManager,
                             uint32_t aFlags) override;
   NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)
-  GetImageContainer(layers::LayerManager* aManager, uint32_t aFlags) override;
+  GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) override;
   NS_IMETHOD_(bool)
   IsImageContainerAvailableAtSize(layers::LayerManager* aManager,
                                   const gfx::IntSize& aSize,
                                   uint32_t aFlags) override;
   NS_IMETHOD_(ImgDrawResult)
-  GetImageContainerAtSize(layers::LayerManager* aManager,
-                          const gfx::IntSize& aSize,
+  GetImageContainerAtSize(WindowRenderer* aRenderer, const gfx::IntSize& aSize,
                           const Maybe<SVGImageContext>& aSVGContext,
                           const Maybe<ImageIntRegion>& aRegion, uint32_t aFlags,
                           layers::ImageContainer** aOutContainer) override;
   NS_IMETHOD_(ImgDrawResult)
   Draw(gfxContext* aContext, const nsIntSize& aSize, const ImageRegion& aRegion,
        uint32_t aWhichFrame, gfx::SamplingFilter aSamplingFilter,
        const Maybe<SVGImageContext>& aSVGContext, uint32_t aFlags,
        float aOpacity) override;
--- a/image/DynamicImage.cpp
+++ b/image/DynamicImage.cpp
@@ -166,29 +166,29 @@ DynamicImage::WillDrawOpaqueNow() { retu
 
 NS_IMETHODIMP_(bool)
 DynamicImage::IsImageContainerAvailable(LayerManager* aManager,
                                         uint32_t aFlags) {
   return false;
 }
 
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
-DynamicImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags) {
+DynamicImage::GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) {
   return nullptr;
 }
 
 NS_IMETHODIMP_(bool)
 DynamicImage::IsImageContainerAvailableAtSize(LayerManager* aManager,
                                               const IntSize& aSize,
                                               uint32_t aFlags) {
   return false;
 }
 
 NS_IMETHODIMP_(ImgDrawResult)
-DynamicImage::GetImageContainerAtSize(layers::LayerManager* aManager,
+DynamicImage::GetImageContainerAtSize(WindowRenderer* aRenderer,
                                       const gfx::IntSize& aSize,
                                       const Maybe<SVGImageContext>& aSVGContext,
                                       const Maybe<ImageIntRegion>& aRegion,
                                       uint32_t aFlags,
                                       layers::ImageContainer** aContainer) {
   return ImgDrawResult::NOT_SUPPORTED;
 }
 
--- a/image/FrozenImage.cpp
+++ b/image/FrozenImage.cpp
@@ -56,20 +56,19 @@ FrozenImage::IsImageContainerAvailable(L
                                        uint32_t aFlags) {
   if (IsNonAnimated()) {
     return InnerImage()->IsImageContainerAvailable(aManager, aFlags);
   }
   return false;
 }
 
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
-FrozenImage::GetImageContainer(layers::LayerManager* aManager,
-                               uint32_t aFlags) {
+FrozenImage::GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) {
   if (IsNonAnimated()) {
-    return InnerImage()->GetImageContainer(aManager, aFlags);
+    return InnerImage()->GetImageContainer(aRenderer, aFlags);
   }
   // XXX(seth): GetImageContainer does not currently support anything but the
   // current frame. We work around this by always returning null, but if it ever
   // turns out that FrozenImage is widely used on codepaths that can actually
   // benefit from GetImageContainer, it would be a good idea to fix that method
   // for performance reasons.
   return nullptr;
 }
@@ -81,25 +80,25 @@ FrozenImage::IsImageContainerAvailableAt
   if (IsNonAnimated()) {
     return InnerImage()->IsImageContainerAvailableAtSize(aManager, aSize,
                                                          aFlags);
   }
   return false;
 }
 
 NS_IMETHODIMP_(ImgDrawResult)
-FrozenImage::GetImageContainerAtSize(layers::LayerManager* aManager,
+FrozenImage::GetImageContainerAtSize(WindowRenderer* aRenderer,
                                      const gfx::IntSize& aSize,
                                      const Maybe<SVGImageContext>& aSVGContext,
                                      const Maybe<ImageIntRegion>& aRegion,
                                      uint32_t aFlags,
                                      layers::ImageContainer** aOutContainer) {
   if (IsNonAnimated()) {
     return InnerImage()->GetImageContainerAtSize(
-        aManager, aSize, aSVGContext, aRegion, aFlags, aOutContainer);
+        aRenderer, aSize, aSVGContext, aRegion, aFlags, aOutContainer);
   }
 
   // XXX(seth): GetImageContainer does not currently support anything but the
   // current frame. We work around this by always returning null, but if it ever
   // turns out that FrozenImage is widely used on codepaths that can actually
   // benefit from GetImageContainer, it would be a good idea to fix that method
   // for performance reasons.
   return ImgDrawResult::NOT_SUPPORTED;
--- a/image/FrozenImage.h
+++ b/image/FrozenImage.h
@@ -40,24 +40,23 @@ class FrozenImage : public ImageWrapper 
   GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
   NS_IMETHOD_(already_AddRefed<SourceSurface>)
   GetFrameAtSize(const gfx::IntSize& aSize, uint32_t aWhichFrame,
                  uint32_t aFlags) override;
   NS_IMETHOD_(bool)
   IsImageContainerAvailable(layers::LayerManager* aManager,
                             uint32_t aFlags) override;
   NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)
-  GetImageContainer(layers::LayerManager* aManager, uint32_t aFlags) override;
+  GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) override;
   NS_IMETHOD_(bool)
   IsImageContainerAvailableAtSize(layers::LayerManager* aManager,
                                   const gfx::IntSize& aSize,
                                   uint32_t aFlags) override;
   NS_IMETHOD_(ImgDrawResult)
-  GetImageContainerAtSize(layers::LayerManager* aManager,
-                          const gfx::IntSize& aSize,
+  GetImageContainerAtSize(WindowRenderer* aRenderer, const gfx::IntSize& aSize,
                           const Maybe<SVGImageContext>& aSVGContext,
                           const Maybe<ImageIntRegion>& aRegion, uint32_t aFlags,
                           layers::ImageContainer** aOutContainer) override;
   NS_IMETHOD_(ImgDrawResult)
   Draw(gfxContext* aContext, const nsIntSize& aSize, const ImageRegion& aRegion,
        uint32_t aWhichFrame, gfx::SamplingFilter aSamplingFilter,
        const Maybe<SVGImageContext>& aSVGContext, uint32_t aFlags,
        float aOpacity) override;
--- a/image/Image.cpp
+++ b/image/Image.cpp
@@ -153,30 +153,30 @@ void ImageResource::SetCurrentImage(laye
       gfx::IntRect dirtyRect(gfx::IntPoint(0, 0), aSurface->GetSize());
       layers::SharedSurfacesChild::UpdateAnimation(aContainer, aSurface,
                                                    dirtyRect);
     }
   }
 }
 
 ImgDrawResult ImageResource::GetImageContainerImpl(
-    layers::LayerManager* aManager, const gfx::IntSize& aSize,
+    WindowRenderer* aRenderer, const gfx::IntSize& aSize,
     const Maybe<SVGImageContext>& aSVGContext,
     const Maybe<ImageIntRegion>& aRegion, uint32_t aFlags,
     layers::ImageContainer** aOutContainer) {
   MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aManager);
+  MOZ_ASSERT(aRenderer);
   MOZ_ASSERT((aFlags &
               ~(FLAG_SYNC_DECODE | FLAG_SYNC_DECODE_IF_FAST | FLAG_RECORD_BLOB |
                 FLAG_ASYNC_NOTIFY | FLAG_HIGH_QUALITY_SCALING)) == FLAG_NONE,
              "Unsupported flag passed to GetImageContainer");
 
   ImgDrawResult drawResult;
   gfx::IntSize size;
-  Tie(drawResult, size) = GetImageContainerSize(aManager, aSize, aFlags);
+  Tie(drawResult, size) = GetImageContainerSize(aRenderer, aSize, aFlags);
   if (drawResult != ImgDrawResult::SUCCESS) {
     return drawResult;
   }
 
   MOZ_ASSERT(!size.IsEmpty());
 
   if (mAnimationConsumers == 0) {
     SendOnUnlockedDraw(aFlags);
--- a/image/Image.h
+++ b/image/Image.h
@@ -421,22 +421,21 @@ class ImageResource : public Image {
 
   /**
    * Calculate the estimated size to use for an image container with the given
    * parameters. It may not be the same as the given size, and it may not be
    * the same as the size of the surface in the image container, but it is the
    * best effort estimate.
    */
   virtual Tuple<ImgDrawResult, gfx::IntSize> GetImageContainerSize(
-      layers::LayerManager* aManager, const gfx::IntSize& aSize,
-      uint32_t aFlags) {
+      WindowRenderer* aRenderer, const gfx::IntSize& aSize, uint32_t aFlags) {
     return MakeTuple(ImgDrawResult::NOT_SUPPORTED, gfx::IntSize(0, 0));
   }
 
-  ImgDrawResult GetImageContainerImpl(layers::LayerManager* aManager,
+  ImgDrawResult GetImageContainerImpl(WindowRenderer* aRenderer,
                                       const gfx::IntSize& aSize,
                                       const Maybe<SVGImageContext>& aSVGContext,
                                       const Maybe<ImageIntRegion>& aRegion,
                                       uint32_t aFlags,
                                       layers::ImageContainer** aContainer);
 
   /**
    * Re-requests the appropriate frames for each image container using
--- a/image/ImageWrapper.cpp
+++ b/image/ImageWrapper.cpp
@@ -167,35 +167,35 @@ ImageWrapper::WillDrawOpaqueNow() { retu
 
 NS_IMETHODIMP_(bool)
 ImageWrapper::IsImageContainerAvailable(LayerManager* aManager,
                                         uint32_t aFlags) {
   return mInnerImage->IsImageContainerAvailable(aManager, aFlags);
 }
 
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
-ImageWrapper::GetImageContainer(LayerManager* aManager, uint32_t aFlags) {
-  return mInnerImage->GetImageContainer(aManager, aFlags);
+ImageWrapper::GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) {
+  return mInnerImage->GetImageContainer(aRenderer, aFlags);
 }
 
 NS_IMETHODIMP_(bool)
 ImageWrapper::IsImageContainerAvailableAtSize(LayerManager* aManager,
                                               const IntSize& aSize,
                                               uint32_t aFlags) {
   return mInnerImage->IsImageContainerAvailableAtSize(aManager, aSize, aFlags);
 }
 
 NS_IMETHODIMP_(ImgDrawResult)
-ImageWrapper::GetImageContainerAtSize(layers::LayerManager* aManager,
+ImageWrapper::GetImageContainerAtSize(WindowRenderer* aRenderer,
                                       const gfx::IntSize& aSize,
                                       const Maybe<SVGImageContext>& aSVGContext,
                                       const Maybe<ImageIntRegion>& aRegion,
                                       uint32_t aFlags,
                                       layers::ImageContainer** aOutContainer) {
-  return mInnerImage->GetImageContainerAtSize(aManager, aSize, aSVGContext,
+  return mInnerImage->GetImageContainerAtSize(aRenderer, aSize, aSVGContext,
                                               aRegion, aFlags, aOutContainer);
 }
 
 NS_IMETHODIMP_(ImgDrawResult)
 ImageWrapper::Draw(gfxContext* aContext, const nsIntSize& aSize,
                    const ImageRegion& aRegion, uint32_t aWhichFrame,
                    SamplingFilter aSamplingFilter,
                    const Maybe<SVGImageContext>& aSVGContext, uint32_t aFlags,
--- a/image/OrientedImage.cpp
+++ b/image/OrientedImage.cpp
@@ -152,25 +152,25 @@ OrientedImage::IsImageContainerAvailable
                                          uint32_t aFlags) {
   if (mOrientation.IsIdentity()) {
     return InnerImage()->IsImageContainerAvailable(aManager, aFlags);
   }
   return false;
 }
 
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
-OrientedImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags) {
+OrientedImage::GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) {
   // XXX(seth): We currently don't have a way of orienting the result of
   // GetImageContainer. We work around this by always returning null, but if it
   // ever turns out that OrientedImage is widely used on codepaths that can
   // actually benefit from GetImageContainer, it would be a good idea to fix
   // that method for performance reasons.
 
   if (mOrientation.IsIdentity()) {
-    return InnerImage()->GetImageContainer(aManager, aFlags);
+    return InnerImage()->GetImageContainer(aRenderer, aFlags);
   }
 
   return nullptr;
 }
 
 NS_IMETHODIMP_(bool)
 OrientedImage::IsImageContainerAvailableAtSize(LayerManager* aManager,
                                                const IntSize& aSize,
@@ -179,29 +179,29 @@ OrientedImage::IsImageContainerAvailable
     return InnerImage()->IsImageContainerAvailableAtSize(aManager, aSize,
                                                          aFlags);
   }
   return false;
 }
 
 NS_IMETHODIMP_(ImgDrawResult)
 OrientedImage::GetImageContainerAtSize(
-    layers::LayerManager* aManager, const gfx::IntSize& aSize,
+    WindowRenderer* aRenderer, const gfx::IntSize& aSize,
     const Maybe<SVGImageContext>& aSVGContext,
     const Maybe<ImageIntRegion>& aRegion, uint32_t aFlags,
     layers::ImageContainer** aOutContainer) {
   // XXX(seth): We currently don't have a way of orienting the result of
   // GetImageContainer. We work around this by always returning null, but if it
   // ever turns out that OrientedImage is widely used on codepaths that can
   // actually benefit from GetImageContainer, it would be a good idea to fix
   // that method for performance reasons.
 
   if (mOrientation.IsIdentity()) {
     return InnerImage()->GetImageContainerAtSize(
-        aManager, aSize, aSVGContext, aRegion, aFlags, aOutContainer);
+        aRenderer, aSize, aSVGContext, aRegion, aFlags, aOutContainer);
   }
 
   return ImgDrawResult::NOT_SUPPORTED;
 }
 
 struct MatrixBuilder {
   explicit MatrixBuilder(bool aInvert) : mInvert(aInvert) {}
 
--- a/image/OrientedImage.h
+++ b/image/OrientedImage.h
@@ -36,24 +36,23 @@ class OrientedImage : public ImageWrappe
   GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
   NS_IMETHOD_(already_AddRefed<SourceSurface>)
   GetFrameAtSize(const gfx::IntSize& aSize, uint32_t aWhichFrame,
                  uint32_t aFlags) override;
   NS_IMETHOD_(bool)
   IsImageContainerAvailable(layers::LayerManager* aManager,
                             uint32_t aFlags) override;
   NS_IMETHOD_(already_AddRefed<layers::ImageContainer>)
-  GetImageContainer(layers::LayerManager* aManager, uint32_t aFlags) override;
+  GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) override;
   NS_IMETHOD_(bool)
   IsImageContainerAvailableAtSize(layers::LayerManager* aManager,
                                   const gfx::IntSize& aSize,
                                   uint32_t aFlags) override;
   NS_IMETHOD_(ImgDrawResult)
-  GetImageContainerAtSize(layers::LayerManager* aManager,
-                          const gfx::IntSize& aSize,
+  GetImageContainerAtSize(WindowRenderer* aRenderer, const gfx::IntSize& aSize,
                           const Maybe<SVGImageContext>& aSVGContext,
                           const Maybe<ImageIntRegion>& aRegion, uint32_t aFlags,
                           layers::ImageContainer** aOutContainer) override;
   NS_IMETHOD_(ImgDrawResult)
   Draw(gfxContext* aContext, const nsIntSize& aSize, const ImageRegion& aRegion,
        uint32_t aWhichFrame, gfx::SamplingFilter aSamplingFilter,
        const Maybe<SVGImageContext>& aSVGContext, uint32_t aFlags,
        float aOpacity) override;
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -612,30 +612,30 @@ RasterImage::GetFrameInternal(const IntS
                      std::move(surface));
   }
 
   return MakeTuple(ImgDrawResult::SUCCESS, suggestedSize.ToUnknownSize(),
                    std::move(surface));
 }
 
 Tuple<ImgDrawResult, IntSize> RasterImage::GetImageContainerSize(
-    LayerManager* aManager, const IntSize& aRequestedSize, uint32_t aFlags) {
+    WindowRenderer* aRenderer, const IntSize& aRequestedSize, uint32_t aFlags) {
   if (!LoadHasSize()) {
     return MakeTuple(ImgDrawResult::NOT_READY, IntSize(0, 0));
   }
 
   if (aRequestedSize.IsEmpty()) {
     return MakeTuple(ImgDrawResult::BAD_ARGS, IntSize(0, 0));
   }
 
   // We check the minimum size because while we support downscaling, we do not
   // support upscaling. If aRequestedSize > mSize, we will never give a larger
   // surface than mSize. If mSize > aRequestedSize, and mSize > maxTextureSize,
   // we still want to use image containers if aRequestedSize <= maxTextureSize.
-  int32_t maxTextureSize = aManager->GetMaxTextureSize();
+  int32_t maxTextureSize = aRenderer->GetMaxTextureSize();
   if (min(mSize.width, aRequestedSize.width) > maxTextureSize ||
       min(mSize.height, aRequestedSize.height) > maxTextureSize) {
     return MakeTuple(ImgDrawResult::NOT_SUPPORTED, IntSize(0, 0));
   }
 
   auto requestedSize = OrientedIntSize::FromUnknownSize(aRequestedSize);
   if (!CanDownscaleDuringDecode(ToUnoriented(requestedSize), aFlags)) {
     return MakeTuple(ImgDrawResult::SUCCESS, mSize.ToUnknownSize());
@@ -647,23 +647,23 @@ Tuple<ImgDrawResult, IntSize> RasterImag
 NS_IMETHODIMP_(bool)
 RasterImage::IsImageContainerAvailable(LayerManager* aManager,
                                        uint32_t aFlags) {
   return IsImageContainerAvailableAtSize(aManager, mSize.ToUnknownSize(),
                                          aFlags);
 }
 
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
-RasterImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags) {
+RasterImage::GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) {
   // Strip out unsupported flags for raster images.
   uint32_t flags = aFlags & ~(FLAG_RECORD_BLOB);
 
   RefPtr<ImageContainer> container;
   ImgDrawResult drawResult =
-      GetImageContainerImpl(aManager, mSize.ToUnknownSize(), Nothing(),
+      GetImageContainerImpl(aRenderer, mSize.ToUnknownSize(), Nothing(),
                             Nothing(), flags, getter_AddRefs(container));
 
   // We silence the unused warning here because anything that needs the draw
   // result should be using GetImageContainerAtSize, not GetImageContainer.
   (void)drawResult;
   return container.forget();
 }
 
@@ -681,26 +681,26 @@ RasterImage::IsImageContainerAvailableAt
       min(mSize.height, aRequestedSize.height) > maxTextureSize) {
     return false;
   }
 
   return true;
 }
 
 NS_IMETHODIMP_(ImgDrawResult)
-RasterImage::GetImageContainerAtSize(layers::LayerManager* aManager,
+RasterImage::GetImageContainerAtSize(WindowRenderer* aRenderer,
                                      const gfx::IntSize& aSize,
                                      const Maybe<SVGImageContext>& aSVGContext,
                                      const Maybe<ImageIntRegion>& aRegion,
                                      uint32_t aFlags,
                                      layers::ImageContainer** aOutContainer) {
   // We do not pass in the given SVG context because in theory it could differ
   // between calls, but actually have no impact on the actual contents of the
   // image container.
-  return GetImageContainerImpl(aManager, aSize, Nothing(), Nothing(), aFlags,
+  return GetImageContainerImpl(aRenderer, aSize, Nothing(), Nothing(), aFlags,
                                aOutContainer);
 }
 
 size_t RasterImage::SizeOfSourceWithComputedFallback(
     SizeOfState& aState) const {
   return mSourceBuffer->SizeOfIncludingThisWithComputedFallback(
       aState.mMallocSizeOf);
 }
--- a/image/RasterImage.h
+++ b/image/RasterImage.h
@@ -317,17 +317,17 @@ class RasterImage final : public ImageRe
 
   Tuple<ImgDrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>>
   GetFrameInternal(const gfx::IntSize& aSize,
                    const Maybe<SVGImageContext>& aSVGContext,
                    const Maybe<ImageIntRegion>& aRegion, uint32_t aWhichFrame,
                    uint32_t aFlags) override;
 
   Tuple<ImgDrawResult, gfx::IntSize> GetImageContainerSize(
-      layers::LayerManager* aManager, const gfx::IntSize& aSize,
+      WindowRenderer* aRenderer, const gfx::IntSize& aSize,
       uint32_t aFlags) override;
 
   //////////////////////////////////////////////////////////////////////////////
   // Decoding.
   //////////////////////////////////////////////////////////////////////////////
 
   /**
    * Creates and runs a decoder, either synchronously or asynchronously
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -775,32 +775,32 @@ VectorImage::GetFrameInternal(const IntS
   }
 
   SendFrameComplete(didCache, params.flags);
   return MakeTuple(ImgDrawResult::SUCCESS, decodeSize, std::move(surface));
 }
 
 //******************************************************************************
 Tuple<ImgDrawResult, IntSize> VectorImage::GetImageContainerSize(
-    LayerManager* aManager, const IntSize& aSize, uint32_t aFlags) {
+    WindowRenderer* aRenderer, const IntSize& aSize, uint32_t aFlags) {
   if (mError) {
     return MakeTuple(ImgDrawResult::BAD_IMAGE, IntSize(0, 0));
   }
 
   if (!mIsFullyLoaded) {
     return MakeTuple(ImgDrawResult::NOT_READY, IntSize(0, 0));
   }
 
   if (mHaveAnimations && !StaticPrefs::image_svg_blob_image()) {
     // We don't support rasterizing animation SVGs. We can put them in a blob
     // recording however instead of using fallback.
     return MakeTuple(ImgDrawResult::NOT_SUPPORTED, IntSize(0, 0));
   }
 
-  if (aManager->GetBackendType() != LayersBackend::LAYERS_WR) {
+  if (aRenderer->GetBackendType() != LayersBackend::LAYERS_WR) {
     return MakeTuple(ImgDrawResult::NOT_SUPPORTED, IntSize(0, 0));
   }
 
   // We don't need to check if the size is too big since we only support
   // WebRender backends.
   if (aSize.IsEmpty()) {
     return MakeTuple(ImgDrawResult::BAD_ARGS, IntSize(0, 0));
   }
@@ -822,47 +822,47 @@ VectorImage::IsImageContainerAvailable(L
     return false;
   }
 
   return true;
 }
 
 //******************************************************************************
 NS_IMETHODIMP_(already_AddRefed<ImageContainer>)
-VectorImage::GetImageContainer(LayerManager* aManager, uint32_t aFlags) {
-  MOZ_ASSERT(aManager->GetBackendType() != LayersBackend::LAYERS_WR,
+VectorImage::GetImageContainer(WindowRenderer* aRenderer, uint32_t aFlags) {
+  MOZ_ASSERT(aRenderer->GetBackendType() != LayersBackend::LAYERS_WR,
              "WebRender should always use GetImageContainerAvailableAtSize!");
   return nullptr;
 }
 
 //******************************************************************************
 NS_IMETHODIMP_(bool)
 VectorImage::IsImageContainerAvailableAtSize(LayerManager* aManager,
                                              const IntSize& aSize,
                                              uint32_t aFlags) {
   // Since we only support image containers with WebRender, and it can handle
   // textures larger than the hw max texture size, we don't need to check aSize.
   return !aSize.IsEmpty() && IsImageContainerAvailable(aManager, aFlags);
 }
 
 //******************************************************************************
 NS_IMETHODIMP_(ImgDrawResult)
-VectorImage::GetImageContainerAtSize(layers::LayerManager* aManager,
+VectorImage::GetImageContainerAtSize(WindowRenderer* aRenderer,
                                      const gfx::IntSize& aSize,
                                      const Maybe<SVGImageContext>& aSVGContext,
                                      const Maybe<ImageIntRegion>& aRegion,
                                      uint32_t aFlags,
                                      layers::ImageContainer** aOutContainer) {
   Maybe<SVGImageContext> newSVGContext;
   MaybeRestrictSVGContext(newSVGContext, aSVGContext, aFlags);
 
   // The aspect ratio flag was already handled as part of the SVG context
   // restriction above.
   uint32_t flags = aFlags & ~(FLAG_FORCE_PRESERVEASPECTRATIO_NONE);
-  auto rv = GetImageContainerImpl(aManager, aSize,
+  auto rv = GetImageContainerImpl(aRenderer, aSize,
                                   newSVGContext ? newSVGContext : aSVGContext,
                                   aRegion, flags, aOutContainer);
 
   // Invalidations may still be suspended if we had a refresh tick and there
   // were no image containers remaining. If we created a new container, we
   // should resume invalidations to allow animations to progress.
   if (*aOutContainer && mRenderingObserver) {
     mRenderingObserver->ResumeHonoringInvalidations();
--- a/image/VectorImage.h
+++ b/image/VectorImage.h
@@ -85,17 +85,17 @@ class VectorImage final : public ImageRe
 
   Tuple<ImgDrawResult, gfx::IntSize, RefPtr<gfx::SourceSurface>>
   GetFrameInternal(const gfx::IntSize& aSize,
                    const Maybe<SVGImageContext>& aSVGContext,
                    const Maybe<ImageIntRegion>& aRegion, uint32_t aWhichFrame,
                    uint32_t aFlags) override;
 
   Tuple<ImgDrawResult, gfx::IntSize> GetImageContainerSize(
-      layers::LayerManager* aManager, const gfx::IntSize& aSize,
+      WindowRenderer* aRenderer, const gfx::IntSize& aSize,
       uint32_t aFlags) override;
 
   /**
    * Attempt to find a matching cached surface in the SurfaceCache. Returns the
    * cached surface, if found, and the size to rasterize at, if applicable.
    * If we cannot rasterize, it will be the requested size to draw at (aSize).
    */
   Tuple<RefPtr<gfx::SourceSurface>, gfx::IntSize> LookupCachedSurface(
--- a/image/imgIContainer.idl
+++ b/image/imgIContainer.idl
@@ -24,16 +24,17 @@ class gfxContext;
 
 namespace mozilla {
 struct AspectRatio;
 
 namespace gfx {
 class SourceSurface;
 }
 
+class WindowRenderer;
 namespace layers {
 class LayerManager;
 class ImageContainer;
 }
 }
 
 class nsIFrame;
 
@@ -67,16 +68,17 @@ native SamplingFilter(mozilla::gfx::Samp
 native nsIntRectByVal(nsIntRect);
 [ref] native nsIntSize(nsIntSize);
 native nsSize(nsSize);
 [ptr] native nsIFrame(nsIFrame);
 native TempRefImageContainer(already_AddRefed<mozilla::layers::ImageContainer>);
 [ptr] native ImageContainer(mozilla::layers::ImageContainer);
 [ref] native ImageRegion(mozilla::image::ImageRegion);
 [ptr] native LayerManager(mozilla::layers::LayerManager);
+[ptr] native WindowRenderer(mozilla::WindowRenderer);
 native Orientation(mozilla::image::Orientation);
 native ImageResolution(mozilla::image::Resolution);
 [ref] native TimeStamp(mozilla::TimeStamp);
 [ref] native MaybeSVGImageContext(mozilla::Maybe<mozilla::SVGImageContext>);
 [ref] native MaybeImageIntRegion(mozilla::Maybe<mozilla::image::ImageIntRegion>);
 native TempRefSourceSurface(already_AddRefed<mozilla::gfx::SourceSurface>);
 native TempRefImgIContainer(already_AddRefed<imgIContainer>);
 native nsIntSizeByVal(nsIntSize);
@@ -323,50 +325,50 @@ interface imgIContainer : nsISupports
   [noscript, notxpcom] boolean isImageContainerAvailable(in LayerManager aManager,
                                                          in uint32_t aFlags);
   /**
    * Attempts to create an ImageContainer (and Image) containing the current
    * frame at its native size.
    *
    * Avoid calling this unless you're actually going to layerize this image.
    *
-   * @param aManager The LayerManager which will be used to create the
-   *                 ImageContainer.
+   * @param aRenderer The WindowRenderer which will be used to render the
+   *                  ImageContainer.
    * @param aFlags Decoding / drawing flags (in other words, FLAG_* flags).
    *               Currently only FLAG_SYNC_DECODE and FLAG_SYNC_DECODE_IF_FAST
    *               are supported.
    * @return An ImageContainer for the current frame, or nullptr if one could
    *         not be created.
    */
-  [noscript, notxpcom] TempRefImageContainer getImageContainer(in LayerManager aManager,
+  [noscript, notxpcom] TempRefImageContainer getImageContainer(in WindowRenderer aRenderer,
                                                                in uint32_t aFlags);
 
   /**
    * Attempts to create an ImageContainer (and Image) containing the current
    * frame at the given size. Match the requested size is best effort; it's
    * not guaranteed that the surface you get will be a perfect match. (Some
    * reasons you may get a surface of a different size include: if you
    * requested upscaling, or if downscale-during-decode is disabled.)
    *
    * Avoid calling this unless you're actually going to layerize this image.
    *
-   * @param aManager The LayerManager which will be used to create the
-   *                 ImageContainer.
+   * @param aRenderer The WindowRenderer which will be used to render the
+   *                  ImageContainer.
    * @param aSVGContext If specified, SVG-related rendering context, such as
    *                    overridden attributes on the image document's root <svg>
    *                    node, and the size of the viewport that the full image
    *                    would occupy. Ignored for raster images.
    * @param aFlags Decoding / drawing flags (in other words, FLAG_* flags).
    *               Currently only FLAG_SYNC_DECODE and FLAG_SYNC_DECODE_IF_FAST
    *               are supported.
    * @param aContainer Return value for ImageContainer for the current frame.
    *                   May be null depending on the draw result.
    * @return The draw result for the current frame.
    */
-  [noscript, notxpcom] ImgDrawResult getImageContainerAtSize(in LayerManager aManager,
+  [noscript, notxpcom] ImgDrawResult getImageContainerAtSize(in WindowRenderer aRenderer,
                                                              [const] in nsIntSize aSize,
                                                              [const] in MaybeSVGImageContext aSVGContext,
                                                              [const] in MaybeImageIntRegion aRegion,
                                                              in uint32_t aFlags,
                                                              out ImageContainer aOutContainer);
 
   /**
    * @return true if getImageContainer() is expected to return a valid
--- a/layout/painting/WindowRenderer.h
+++ b/layout/painting/WindowRenderer.h
@@ -170,16 +170,22 @@ class WindowRenderer : public FrameRecor
    * Make sure that the previous transaction has been
    * received. This will synchronsly wait on a remote compositor.
    */
   virtual void WaitOnTransactionProcessed() {}
 
   virtual bool IsCompositingCheap() { return true; }
 
   /**
+   * returns the maximum texture size on this layer backend, or INT32_MAX
+   * if there is no maximum
+   */
+  virtual int32_t GetMaxTextureSize() const { return INT32_MAX; }
+
+  /**
    * Return the name of the layer manager's backend.
    */
   virtual void GetBackendName(nsAString& aName) = 0;
 
   virtual void GetFrameUniformity(layers::FrameUniformityData* aOutData) {}
 
   virtual bool AddPendingScrollUpdateForNextTransaction(
       layers::ScrollableLayerGuid::ViewID aScrollId,