Bug 1404997 - P5. Fix constness and remove redundant virtual keyword. r?mattwoodrow draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 30 Nov 2017 19:03:02 +0100
changeset 712477 cca4de35b47a803dd9bfd2b3544c243cb59d3187
parent 712476 f42fbeaa26402ce9ff75d174a477023ba3944e1a
child 712478 85a1ecc9f556d60c3d72a762b9aa612a3ccd168f
push id93348
push userbmo:jyavenard@mozilla.com
push dateSat, 16 Dec 2017 21:31:13 +0000
reviewersmattwoodrow
bugs1404997
milestone59.0a1
Bug 1404997 - P5. Fix constness and remove redundant virtual keyword. r?mattwoodrow Additionally, various C++ code and style cleanup MozReview-Commit-ID: 7BCtQzFGaOc
gfx/layers/D3D11ShareHandleImage.cpp
gfx/layers/D3D11ShareHandleImage.h
gfx/layers/D3D11YCbCrImage.cpp
gfx/layers/D3D11YCbCrImage.h
gfx/layers/D3D9SurfaceImage.cpp
gfx/layers/D3D9SurfaceImage.h
gfx/layers/GLImages.h
gfx/layers/GPUVideoImage.h
gfx/layers/IMFYCbCrImage.h
gfx/layers/ImageContainer.cpp
gfx/layers/ImageContainer.h
gfx/layers/MacIOSurfaceImage.h
gfx/layers/TextureWrapperImage.cpp
gfx/layers/TextureWrapperImage.h
gfx/layers/client/SingleTiledContentClient.h
gfx/layers/client/TextureClientPool.h
gfx/layers/ipc/KnowsCompositor.h
gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
gfx/layers/ipc/SharedPlanarYCbCrImage.h
gfx/layers/ipc/SharedRGBImage.cpp
gfx/layers/ipc/SharedRGBImage.h
--- a/gfx/layers/D3D11ShareHandleImage.cpp
+++ b/gfx/layers/D3D11ShareHandleImage.cpp
@@ -54,17 +54,17 @@ D3D11ShareHandleImage::AllocateTexture(D
     newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
 
     HRESULT hr = aDevice->CreateTexture2D(&newDesc, nullptr, getter_AddRefs(mTexture));
     return SUCCEEDED(hr);
   }
 }
 
 gfx::IntSize
-D3D11ShareHandleImage::GetSize()
+D3D11ShareHandleImage::GetSize() const
 {
   return mSize;
 }
 
 TextureClient*
 D3D11ShareHandleImage::GetTextureClient(KnowsCompositor* aForwarder)
 {
   return mTextureClient;
--- a/gfx/layers/D3D11ShareHandleImage.h
+++ b/gfx/layers/D3D11ShareHandleImage.h
@@ -26,42 +26,42 @@ public:
     , mDevice(aDevice)
   {}
 
   already_AddRefed<TextureClient>
   CreateOrRecycleClient(gfx::SurfaceFormat aFormat,
                         const gfx::IntSize& aSize);
 
 protected:
-  virtual already_AddRefed<TextureClient>
-  Allocate(gfx::SurfaceFormat aFormat,
-           gfx::IntSize aSize,
-           BackendSelector aSelector,
-           TextureFlags aTextureFlags,
-           TextureAllocationFlags aAllocFlags) override;
+  virtual already_AddRefed<TextureClient> Allocate(
+    gfx::SurfaceFormat aFormat,
+    gfx::IntSize aSize,
+    BackendSelector aSelector,
+    TextureFlags aTextureFlags,
+    TextureAllocationFlags aAllocFlags) override;
 
   RefPtr<ID3D11Device> mDevice;
 };
 
 // Image class that wraps a ID3D11Texture2D. This class copies the image
 // passed into SetData(), so that it can be accessed from other D3D devices.
 // This class also manages the synchronization of the copy, to ensure the
 // resource is ready to use.
 class D3D11ShareHandleImage final : public Image {
 public:
   D3D11ShareHandleImage(const gfx::IntSize& aSize,
                         const gfx::IntRect& aRect);
-  ~D3D11ShareHandleImage() override {}
+  virtual ~D3D11ShareHandleImage() {}
 
   bool AllocateTexture(D3D11RecycleAllocator* aAllocator, ID3D11Device* aDevice);
 
-  gfx::IntSize GetSize() override;
-  virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
-  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
-  virtual gfx::IntRect GetPictureRect() override { return mPictureRect; }
+  gfx::IntSize GetSize() const override;
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
+  TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
+  gfx::IntRect GetPictureRect() const override { return mPictureRect; }
 
   ID3D11Texture2D* GetTexture() const;
 
 private:
   gfx::IntSize mSize;
   gfx::IntRect mPictureRect;
   RefPtr<TextureClient> mTextureClient;
   RefPtr<ID3D11Texture2D> mTexture;
--- a/gfx/layers/D3D11YCbCrImage.cpp
+++ b/gfx/layers/D3D11YCbCrImage.cpp
@@ -118,17 +118,17 @@ D3D11YCbCrImage::SetData(KnowsCompositor
                          aData.mCbCrStride,
                          aData.mCbCrStride * aData.mCbCrSize.height);
 
 
   return true;
 }
 
 IntSize
-D3D11YCbCrImage::GetSize()
+D3D11YCbCrImage::GetSize() const
 {
   return mPictureRect.Size();
 }
 
 TextureClient*
 D3D11YCbCrImage::GetTextureClient(KnowsCompositor* aForwarder)
 {
   return mTextureClient;
--- a/gfx/layers/D3D11YCbCrImage.h
+++ b/gfx/layers/D3D11YCbCrImage.h
@@ -27,18 +27,18 @@ class D3D11YCbCrRecycleAllocator : publi
 public:
   explicit D3D11YCbCrRecycleAllocator(KnowsCompositor* aAllocator,
                                       ID3D11Device* aDevice)
     : TextureClientRecycleAllocator(aAllocator)
     , mDevice(aDevice)
   {
   }
 
-  ID3D11Device* GetDevice() { return mDevice; }
-  KnowsCompositor* GetAllocator() { return mSurfaceAllocator; }
+  ID3D11Device* GetDevice() const { return mDevice; }
+  KnowsCompositor* GetAllocator() const { return mSurfaceAllocator; }
 
 protected:
   already_AddRefed<TextureClient>
   Allocate(gfx::SurfaceFormat aFormat,
            gfx::IntSize aSize,
            BackendSelector aSelector,
            TextureFlags aTextureFlags,
            TextureAllocationFlags aAllocFlags) override;
@@ -54,23 +54,23 @@ public:
   virtual ~D3D11YCbCrImage();
 
   // Copies the surface into a sharable texture's surface, and initializes
   // the image.
   bool SetData(KnowsCompositor* aAllocator,
                ImageContainer* aContainer,
                const PlanarYCbCrData& aData);
 
-  gfx::IntSize GetSize() override;
+  gfx::IntSize GetSize() const override;
 
   already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
 
   TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
 
-  gfx::IntRect GetPictureRect() override { return mPictureRect; }
+  gfx::IntRect GetPictureRect() const override { return mPictureRect; }
 
 private:
   const DXGIYCbCrTextureData* GetData() const;
 
   gfx::IntSize mYSize;
   gfx::IntSize mCbCrSize;
   gfx::IntRect mPictureRect;
   YUVColorSpace mColorSpace;
--- a/gfx/layers/D3D9SurfaceImage.cpp
+++ b/gfx/layers/D3D9SurfaceImage.cpp
@@ -178,17 +178,17 @@ D3D9SurfaceImage::AllocateAndCopy(D3D9Re
   hr = device->StretchRect(surface, &src, textureSurface, nullptr, D3DTEXF_NONE);
   NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
 
   mSize = aRegion.Size();
   return S_OK;
 }
 
 already_AddRefed<IDirect3DSurface9>
-D3D9SurfaceImage::GetD3D9Surface()
+D3D9SurfaceImage::GetD3D9Surface() const
 {
   RefPtr<IDirect3DSurface9> textureSurface;
   HRESULT hr = mTexture->GetSurfaceLevel(0, getter_AddRefs(textureSurface));
   NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
   return textureSurface.forget();
 }
 
 const D3DSURFACE_DESC&
@@ -199,17 +199,17 @@ D3D9SurfaceImage::GetDesc() const
 
 HANDLE
 D3D9SurfaceImage::GetShareHandle() const
 {
   return mShareHandle;
 }
 
 gfx::IntSize
-D3D9SurfaceImage::GetSize()
+D3D9SurfaceImage::GetSize() const
 {
   return mSize;
 }
 
 TextureClient*
 D3D9SurfaceImage::GetTextureClient(KnowsCompositor* aForwarder)
 {
   MOZ_ASSERT(mTextureClient);
--- a/gfx/layers/D3D9SurfaceImage.h
+++ b/gfx/layers/D3D9SurfaceImage.h
@@ -88,44 +88,44 @@ protected:
   D3DSURFACE_DESC mDesc;
 };
 
 
 // Image class that wraps a IDirect3DSurface9. This class copies the image
 // passed into SetData(), so that it can be accessed from other D3D devices.
 // This class also manages the synchronization of the copy, to ensure the
 // resource is ready to use.
-class D3D9SurfaceImage : public Image {
+class D3D9SurfaceImage : public Image
+{
 public:
-  explicit D3D9SurfaceImage();
+  D3D9SurfaceImage();
   virtual ~D3D9SurfaceImage();
 
   HRESULT AllocateAndCopy(D3D9RecycleAllocator* aAllocator,
                           IDirect3DSurface9* aSurface,
                           const gfx::IntRect& aRegion);
 
   // Returns the description of the shared surface.
   const D3DSURFACE_DESC& GetDesc() const;
 
-  gfx::IntSize GetSize() override;
+  gfx::IntSize GetSize() const override;
 
-  virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
 
-  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
+  TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
 
-  already_AddRefed<IDirect3DSurface9> GetD3D9Surface();
+  already_AddRefed<IDirect3DSurface9> GetD3D9Surface() const;
 
   HANDLE GetShareHandle() const;
 
-  virtual bool IsValid() override { return mValid; }
+  bool IsValid() const override { return mValid; }
 
   void Invalidate() { mValid = false; }
 
 private:
-
   gfx::IntSize mSize;
   RefPtr<TextureClient> mTextureClient;
   RefPtr<IDirect3DTexture9> mTexture;
   HANDLE mShareHandle;
   D3DSURFACE_DESC mDesc;
   bool mValid;
 };
 
--- a/gfx/layers/GLImages.h
+++ b/gfx/layers/GLImages.h
@@ -13,56 +13,50 @@
 #include "ImageContainer.h"             // for Image
 #include "ImageTypes.h"                 // for ImageFormat::SHARED_GLTEXTURE
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "mozilla/gfx/Point.h"          // for IntSize
 
 namespace mozilla {
 namespace layers {
 
-class GLImage : public Image {
+class GLImage : public Image
+{
 public:
   explicit GLImage(ImageFormat aFormat) : Image(nullptr, aFormat){}
 
-  virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
 
-  GLImage* AsGLImage() override {
-    return this;
-  }
+  GLImage* AsGLImage() override { return this; }
 };
 
 #ifdef MOZ_WIDGET_ANDROID
 
-class SurfaceTextureImage : public GLImage {
+class SurfaceTextureImage : public GLImage
+{
 public:
   SurfaceTextureImage(AndroidSurfaceTextureHandle aHandle,
                       const gfx::IntSize& aSize,
                       bool aContinuous,
                       gl::OriginPos aOriginPos);
 
-  gfx::IntSize GetSize() override { return mSize; }
-  AndroidSurfaceTextureHandle GetHandle() const {
-    return mHandle;
-  }
-  bool GetContinuous() const {
-    return mContinuous;
-  }
-  gl::OriginPos GetOriginPos() const {
-    return mOriginPos;
-  }
+  gfx::IntSize GetSize() const override { return mSize; }
+  AndroidSurfaceTextureHandle GetHandle() const { return mHandle; }
+  bool GetContinuous() const { return mContinuous; }
+  gl::OriginPos GetOriginPos() const { return mOriginPos; }
 
-  virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override {
-    // We can implement this, but currently don't want to because it will cause the
-    // SurfaceTexture to be permanently bound to the snapshot readback context.
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override
+  {
+    // We can implement this, but currently don't want to because it will cause
+    // the SurfaceTexture to be permanently bound to the snapshot readback
+    // context.
     return nullptr;
   }
 
-  SurfaceTextureImage* AsSurfaceTextureImage() override {
-    return this;
-  }
+  SurfaceTextureImage* AsSurfaceTextureImage() override { return this; }
 
 private:
   AndroidSurfaceTextureHandle mHandle;
   gfx::IntSize mSize;
   bool mContinuous;
   gl::OriginPos mOriginPos;
 };
 
--- a/gfx/layers/GPUVideoImage.h
+++ b/gfx/layers/GPUVideoImage.h
@@ -19,17 +19,18 @@ class VideoDecoderManagerChild;
 }
 namespace gl {
 class GLBlitHelper;
 }
 namespace layers {
 
 // Image class that refers to a decoded video frame within
 // the GPU process.
-class GPUVideoImage final : public Image {
+class GPUVideoImage final : public Image
+{
   friend class gl::GLBlitHelper;
 public:
   GPUVideoImage(dom::VideoDecoderManagerChild* aManager,
                 const SurfaceDescriptorGPUVideo& aSD,
                 const gfx::IntSize& aSize)
     : Image(nullptr, ImageFormat::GPU_VIDEO)
     , mSize(aSize)
   {
@@ -41,39 +42,40 @@ public:
     // it too, and we want to make sure we don't send the delete message
     // until we've stopped being used on the compositor.
     mTextureClient =
       TextureClient::CreateWithData(new GPUVideoTextureData(aManager, aSD, aSize),
                                     TextureFlags::RECYCLE,
                                     ImageBridgeChild::GetSingleton().get());
   }
 
-  ~GPUVideoImage() override {}
+  virtual ~GPUVideoImage() {}
 
-  gfx::IntSize GetSize() override { return mSize; }
+  gfx::IntSize GetSize() const override { return mSize; }
 
 private:
-  GPUVideoTextureData* GetData() const {
+  GPUVideoTextureData* GetData() const
+  {
     if (!mTextureClient) {
       return nullptr;
     }
     return mTextureClient->GetInternalData()->AsGPUVideoTextureData();
   }
 
 public:
-  virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override
   {
     GPUVideoTextureData* data = GetData();
     if (!data) {
       return nullptr;
     }
     return data->GetAsSourceSurface();
   }
 
-  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override
+  TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override
   {
     MOZ_ASSERT(aForwarder == ImageBridgeChild::GetSingleton(), "Must only use GPUVideo on ImageBridge");
     return mTextureClient;
   }
 
 private:
   gfx::IntSize mSize;
   RefPtr<TextureClient> mTextureClient;
--- a/gfx/layers/IMFYCbCrImage.h
+++ b/gfx/layers/IMFYCbCrImage.h
@@ -15,26 +15,26 @@
 namespace mozilla {
 namespace layers {
 
 class IMFYCbCrImage : public RecyclingPlanarYCbCrImage
 {
 public:
   IMFYCbCrImage(IMFMediaBuffer* aBuffer, IMF2DBuffer* a2DBuffer);
 
-  virtual bool IsValid() { return true; }
+  bool IsValid() const override { return true; }
 
-  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
+  TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
 
   static DXGIYCbCrTextureData* GetD3D11TextureData(Data aData,
-                                                  gfx::IntSize aSize);
+                                                   gfx::IntSize aSize);
 protected:
   TextureClient* GetD3D11TextureClient(KnowsCompositor* aForwarder);
 
-  ~IMFYCbCrImage();
+  virtual ~IMFYCbCrImage();
 
   RefPtr<IMFMediaBuffer> mBuffer;
   RefPtr<IMF2DBuffer> m2DBuffer;
   RefPtr<TextureClient> mTextureClient;
 };
 
 } // namepace layers
 } // namespace mozilla
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -595,17 +595,17 @@ RecyclingPlanarYCbCrImage::CopyData(cons
             mData.mCbCrSize, mData.mCbCrStride, mData.mCrSkip);
 
   mSize = aData.mPicSize;
   mOrigin = gfx::IntPoint(aData.mPicX, aData.mPicY);
   return true;
 }
 
 gfxImageFormat
-PlanarYCbCrImage::GetOffscreenFormat()
+PlanarYCbCrImage::GetOffscreenFormat() const
 {
   return mOffscreenFormat == SurfaceFormat::UNKNOWN ?
     gfxVars::OffscreenFormat() :
     mOffscreenFormat;
 }
 
 bool
 PlanarYCbCrImage::AdoptData(const Data& aData)
@@ -654,23 +654,23 @@ NVImage::NVImage()
   : Image(nullptr, ImageFormat::NV_IMAGE)
   , mBufferSize(0)
 {
 }
 
 NVImage::~NVImage() = default;
 
 IntSize
-NVImage::GetSize()
+NVImage::GetSize() const
 {
   return mSize;
 }
 
 IntRect
-NVImage::GetPictureRect()
+NVImage::GetPictureRect() const
 {
   return mData.GetPictureRect();
 }
 
 already_AddRefed<SourceSurface>
 NVImage::GetAsSourceSurface()
 {
   if (mSourceSurface) {
@@ -735,17 +735,17 @@ NVImage::GetAsSourceSurface()
 
   // Release the temporary buffer.
   delete[] buffer;
 
   return surface.forget();
 }
 
 bool
-NVImage::IsValid()
+NVImage::IsValid() const
 {
   return !!mBufferSize;
 }
 
 uint32_t
 NVImage::GetBufferSize() const
 {
   return mBufferSize;
@@ -807,29 +807,32 @@ NVImage::GetData() const
 
 UniquePtr<uint8_t>
 NVImage::AllocateBuffer(uint32_t aSize)
 {
   UniquePtr<uint8_t> buffer(new uint8_t[aSize]);
   return buffer;
 }
 
-SourceSurfaceImage::SourceSurfaceImage(const gfx::IntSize& aSize, gfx::SourceSurface* aSourceSurface)
-  : Image(nullptr, ImageFormat::CAIRO_SURFACE),
-    mSize(aSize),
-    mSourceSurface(aSourceSurface),
-    mTextureFlags(TextureFlags::DEFAULT)
-{}
+SourceSurfaceImage::SourceSurfaceImage(const gfx::IntSize& aSize,
+                                       gfx::SourceSurface* aSourceSurface)
+  : Image(nullptr, ImageFormat::CAIRO_SURFACE)
+  , mSize(aSize)
+  , mSourceSurface(aSourceSurface)
+  , mTextureFlags(TextureFlags::DEFAULT)
+{
+}
 
 SourceSurfaceImage::SourceSurfaceImage(gfx::SourceSurface* aSourceSurface)
-  : Image(nullptr, ImageFormat::CAIRO_SURFACE),
-    mSize(aSourceSurface->GetSize()),
-    mSourceSurface(aSourceSurface),
-    mTextureFlags(TextureFlags::DEFAULT)
-{}
+  : Image(nullptr, ImageFormat::CAIRO_SURFACE)
+  , mSize(aSourceSurface->GetSize())
+  , mSourceSurface(aSourceSurface)
+  , mTextureFlags(TextureFlags::DEFAULT)
+{
+}
 
 SourceSurfaceImage::~SourceSurfaceImage() = default;
 
 TextureClient*
 SourceSurfaceImage::GetTextureClient(KnowsCompositor* aForwarder)
 {
   if (!aForwarder) {
     return nullptr;
--- a/gfx/layers/ImageContainer.h
+++ b/gfx/layers/ImageContainer.h
@@ -60,17 +60,18 @@ public:
   class SurfaceReleaser : public mozilla::Runnable {
   public:
     explicit SurfaceReleaser(RawRef aRef)
       : mozilla::Runnable(
           "nsAutoRefTraits<nsMainThreadSourceSurfaceRef>::SurfaceReleaser")
       , mRef(aRef)
     {
     }
-    NS_IMETHOD Run() override {
+    NS_IMETHOD Run() override
+    {
       mRef->Release();
       return NS_OK;
     }
     RawRef mRef;
   };
 
   static RawRef Void() { return nullptr; }
   static void Release(RawRef aRawRef)
@@ -88,32 +89,35 @@ public:
                  "Can only add a reference on the main thread");
     aRawRef->AddRef();
   }
 };
 
 class nsOwningThreadSourceSurfaceRef;
 
 template <>
-class nsAutoRefTraits<nsOwningThreadSourceSurfaceRef> {
+class nsAutoRefTraits<nsOwningThreadSourceSurfaceRef>
+{
 public:
   typedef mozilla::gfx::SourceSurface* RawRef;
 
   /**
    * The XPCOM event that will do the actual release on the creation thread.
    */
-  class SurfaceReleaser : public mozilla::Runnable {
+  class SurfaceReleaser : public mozilla::Runnable
+  {
   public:
     explicit SurfaceReleaser(RawRef aRef)
       : mozilla::Runnable(
           "nsAutoRefTraits<nsOwningThreadSourceSurfaceRef>::SurfaceReleaser")
       , mRef(aRef)
     {
     }
-    NS_IMETHOD Run() override {
+    NS_IMETHOD Run() override
+    {
       mRef->Release();
       return NS_OK;
     }
     RawRef mRef;
   };
 
   static RawRef Void() { return nullptr; }
   void Release(RawRef aRawRef)
@@ -191,51 +195,59 @@ class MacIOSurfaceImage;
  * modified after calling SetImage. Image implementations do not need to
  * perform locking; when filling an Image, the Image client is responsible
  * for ensuring only one thread accesses the Image at a time, and after
  * SetImage the image is immutable.
  *
  * When resampling an Image, only pixels within the buffer should be
  * sampled. For example, cairo images should be sampled in EXTEND_PAD mode.
  */
-class Image {
+class Image
+{
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Image)
 
 public:
-  ImageFormat GetFormat() { return mFormat; }
-  void* GetImplData() { return mImplData; }
+  ImageFormat GetFormat() const { return mFormat; }
+  void* GetImplData() const { return mImplData; }
 
-  virtual gfx::IntSize GetSize() = 0;
-  virtual gfx::IntPoint GetOrigin()
+  virtual gfx::IntSize GetSize() const = 0;
+  virtual gfx::IntPoint GetOrigin() const
   {
     return gfx::IntPoint(0, 0);
   }
-  virtual gfx::IntRect GetPictureRect()
+  virtual gfx::IntRect GetPictureRect() const
   {
     return gfx::IntRect(GetOrigin().x, GetOrigin().y, GetSize().width, GetSize().height);
   }
 
   ImageBackendData* GetBackendData(LayersBackend aBackend)
-  { return mBackendData[aBackend]; }
+  {
+    return mBackendData[aBackend];
+  }
   void SetBackendData(LayersBackend aBackend, ImageBackendData* aData)
-  { mBackendData[aBackend] = aData; }
+  {
+    mBackendData[aBackend] = aData;
+  }
 
-  int32_t GetSerial() { return mSerial; }
+  int32_t GetSerial() const { return mSerial; }
 
   virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() = 0;
 
-  virtual bool IsValid() { return true; }
+  virtual bool IsValid() const { return true; }
 
-  virtual uint8_t* GetBuffer() { return nullptr; }
+  virtual uint8_t* GetBuffer() const { return nullptr; }
 
   /**
    * For use with the TextureForwarder only (so that the later can
    * synchronize the TextureClient with the TextureHost).
    */
-  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) { return nullptr; }
+  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder)
+  {
+    return nullptr;
+  }
 
   /* Access to derived classes. */
   virtual GLImage* AsGLImage() { return nullptr; }
 #ifdef MOZ_WIDGET_ANDROID
   virtual SurfaceTextureImage* AsSurfaceTextureImage() { return nullptr; }
 #endif
 #ifdef XP_MACOSX
   virtual MacIOSurfaceImage* AsMacIOSurfaceImage() { return nullptr; }
@@ -268,17 +280,18 @@ protected:
 
 /**
  * A RecycleBin is owned by an ImageContainer. We store buffers in it that we
  * want to recycle from one image to the next.It's a separate object from
  * ImageContainer because images need to store a strong ref to their RecycleBin
  * and we must avoid creating a reference loop between an ImageContainer and
  * its active image.
  */
-class BufferRecycleBin final {
+class BufferRecycleBin final
+{
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BufferRecycleBin)
 
   //typedef mozilla::gl::GLContext GLContext;
 
 public:
   BufferRecycleBin();
 
   void RecycleBuffer(mozilla::UniquePtr<uint8_t[]> aBuffer, uint32_t aSize);
@@ -330,17 +343,18 @@ protected:
   virtual ~ImageFactory() {}
 
   virtual RefPtr<PlanarYCbCrImage> CreatePlanarYCbCrImage(
     const gfx::IntSize& aScaleHint,
     BufferRecycleBin *aRecycleBin);
 };
 
 // Used to notify ImageContainer::NotifyComposite()
-class ImageContainerListener final {
+class ImageContainerListener final
+{
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ImageContainerListener)
 
 public:
   explicit ImageContainerListener(ImageContainer* aImageContainer);
 
   void NotifyComposite(const ImageCompositeNotification& aNotification);
   void ClearImageContainer();
   void DropImageClient();
@@ -400,17 +414,18 @@ public:
   typedef uint32_t FrameID;
   typedef uint32_t ProducerID;
 
   RefPtr<PlanarYCbCrImage> CreatePlanarYCbCrImage();
 
   // Factory methods for shared image types.
   RefPtr<SharedRGBImage> CreateSharedRGBImage();
 
-  struct NonOwningImage {
+  struct NonOwningImage
+  {
     explicit NonOwningImage(Image* aImage = nullptr,
                             TimeStamp aTimeStamp = TimeStamp(),
                             FrameID aFrameID = 0,
                             ProducerID aProducerID = 0)
       : mImage(aImage), mTimeStamp(aTimeStamp), mFrameID(aFrameID),
         mProducerID(aProducerID) {}
     Image* mImage;
     TimeStamp mTimeStamp;
@@ -535,21 +550,19 @@ public:
 
   /**
    * Sets a size that the image is expected to be rendered at.
    * This is a hint for image backends to optimize scaling.
    * Default implementation in this class is to ignore the hint.
    * Can be called on any thread. This method takes mRecursiveMutex
    * when accessing thread-shared state.
    */
-  void SetScaleHint(const gfx::IntSize& aScaleHint)
-  { mScaleHint = aScaleHint; }
+  void SetScaleHint(const gfx::IntSize& aScaleHint) { mScaleHint = aScaleHint; }
 
-  const gfx::IntSize& GetScaleHint() const
-  { return mScaleHint; }
+  const gfx::IntSize& GetScaleHint() const { return mScaleHint; }
 
   void SetImageFactory(ImageFactory *aFactory)
   {
     RecursiveMutexAutoLock lock(mRecursiveMutex);
     mImageFactory = aFactory ? aFactory : new ImageFactory();
   }
 
   ImageFactory* GetImageFactory() const
@@ -575,17 +588,18 @@ public:
     RecursiveMutexAutoLock lock(mRecursiveMutex);
     return mPaintDelay;
   }
 
   /**
    * Returns the number of images which have been contained in this container
    * and painted at least once.  Can be called from any thread.
    */
-  uint32_t GetPaintCount() {
+  uint32_t GetPaintCount()
+  {
     RecursiveMutexAutoLock lock(mRecursiveMutex);
     return mPaintCount;
   }
 
   /**
    * An entry in the current image list "expires" when the entry has an
    * non-null timestamp, and in a SetCurrentImages call the new image list is
    * non-empty, the timestamp of the first new image is non-null and greater
@@ -721,17 +735,18 @@ public:
 
     return mImages[chosenIndex].mImage.get();
   }
 
 private:
   AutoTArray<ImageContainer::OwningImage,4> mImages;
 };
 
-struct PlanarYCbCrData {
+struct PlanarYCbCrData
+{
   // Luminance buffer
   uint8_t* mYChannel;
   int32_t mYStride;
   gfx::IntSize mYSize;
   int32_t mYSkip;
   // Chroma buffers
   uint8_t* mCbChannel;
   uint8_t* mCrChannel;
@@ -742,17 +757,18 @@ struct PlanarYCbCrData {
   // Picture region
   uint32_t mPicX;
   uint32_t mPicY;
   gfx::IntSize mPicSize;
   StereoMode mStereoMode;
   YUVColorSpace mYUVColorSpace;
   uint32_t mBitDepth;
 
-  gfx::IntRect GetPictureRect() const {
+  gfx::IntRect GetPictureRect() const
+  {
     return gfx::IntRect(mPicX, mPicY,
                      mPicSize.width,
                      mPicSize.height);
   }
 
   PlanarYCbCrData()
     : mYChannel(nullptr), mYStride(0), mYSize(0, 0), mYSkip(0)
     , mCbChannel(nullptr), mCrChannel(nullptr)
@@ -794,21 +810,23 @@ struct PlanarYCbCrData {
  *  0   3   6   9   12  15  18  21                659             669
  * |----------------------------------------------------------------|
  * |Y___Y___Y___Y___Y___Y___Y___Y...                      |%%%%%%%%%|
  * |Y___Y___Y___Y___Y___Y___Y___Y...                      |%%%%%%%%%|
  * |Y___Y___Y___Y___Y___Y___Y___Y...                      |%%%%%%%%%|
  * |            |<->|
  *                mYSkip
  */
-class PlanarYCbCrImage : public Image {
+class PlanarYCbCrImage : public Image
+{
 public:
   typedef PlanarYCbCrData Data;
 
-  enum {
+  enum
+  {
     MAX_DIMENSION = 16384
   };
 
   virtual ~PlanarYCbCrImage() {}
 
   /**
    * This makes a copy of the data buffers, in order to support functioning
    * in all different layer managers.
@@ -820,66 +838,66 @@ public:
    */
   virtual bool AdoptData(const Data& aData);
 
   /**
    * Ask this Image to not convert YUV to RGB during SetData, and make
    * the original data available through GetData. This is optional,
    * and not all PlanarYCbCrImages will support it.
    */
-  virtual void SetDelayedConversion(bool aDelayed) { }
+  virtual void SetDelayedConversion(bool aDelayed) {}
 
   /**
    * Grab the original YUV data. This is optional.
    */
-  virtual const Data* GetData() { return &mData; }
+  virtual const Data* GetData() const { return &mData; }
 
   /**
    * Return the number of bytes of heap memory used to store this image.
    */
-  virtual uint32_t GetDataSize() { return mBufferSize; }
+  uint32_t GetDataSize() const { return mBufferSize; }
 
-  virtual bool IsValid() { return !!mBufferSize; }
+  bool IsValid() const override { return !!mBufferSize; }
 
-  virtual gfx::IntSize GetSize() { return mSize; }
+  gfx::IntSize GetSize() const override { return mSize; }
 
-  virtual gfx::IntPoint GetOrigin() { return mOrigin; }
-
-  explicit PlanarYCbCrImage();
+  gfx::IntPoint GetOrigin() const override { return mOrigin; }
 
-  virtual SharedPlanarYCbCrImage *AsSharedPlanarYCbCrImage() { return nullptr; }
+  PlanarYCbCrImage();
 
-  virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
+  virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
+  {
     return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const = 0;
 
-  PlanarYCbCrImage* AsPlanarYCbCrImage() { return this; }
+  PlanarYCbCrImage* AsPlanarYCbCrImage() override { return this; }
 
 protected:
-  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface();
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
 
   void SetOffscreenFormat(gfxImageFormat aFormat) { mOffscreenFormat = aFormat; }
-  gfxImageFormat GetOffscreenFormat();
+  gfxImageFormat GetOffscreenFormat() const;
 
   Data mData;
   gfx::IntPoint mOrigin;
   gfx::IntSize mSize;
   gfxImageFormat mOffscreenFormat;
   nsCountedRef<nsMainThreadSourceSurfaceRef> mSourceSurface;
   uint32_t mBufferSize;
 };
 
-class RecyclingPlanarYCbCrImage: public PlanarYCbCrImage {
+class RecyclingPlanarYCbCrImage: public PlanarYCbCrImage
+{
 public:
   explicit RecyclingPlanarYCbCrImage(BufferRecycleBin *aRecycleBin) : mRecycleBin(aRecycleBin) {}
-  virtual ~RecyclingPlanarYCbCrImage() override;
-  virtual bool CopyData(const Data& aData) override;
-  virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
+  virtual ~RecyclingPlanarYCbCrImage();
+  bool CopyData(const Data& aData) override;
+  size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
 protected:
 
   /**
    * Return a buffer to store image data in.
    */
   mozilla::UniquePtr<uint8_t[]> AllocateBuffer(uint32_t aSize);
 
   RefPtr<BufferRecycleBin> mRecycleBin;
@@ -890,34 +908,35 @@ protected:
  * NVImage is used to store YUV420SP_NV12 and YUV420SP_NV21 data natively, which
  * are not supported by PlanarYCbCrImage. (PlanarYCbCrImage only stores YUV444P,
  * YUV422P and YUV420P, it converts YUV420SP_NV12 and YUV420SP_NV21 data into
  * YUV420P in its PlanarYCbCrImage::SetData() method.)
  *
  * PlanarYCbCrData is able to express all the YUV family and so we keep use it
  * in NVImage.
  */
-class NVImage: public Image {
+class NVImage final : public Image
+{
   typedef PlanarYCbCrData Data;
 
 public:
-  explicit NVImage();
-  virtual ~NVImage() override;
+  NVImage();
+  virtual ~NVImage();
 
   // Methods inherited from layers::Image.
-  virtual gfx::IntSize GetSize() override;
-  virtual gfx::IntRect GetPictureRect() override;
-  virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
-  virtual bool IsValid() override;
-  virtual NVImage* AsNVImage() override;
+  gfx::IntSize GetSize() const override;
+  gfx::IntRect GetPictureRect() const override;
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
+  bool IsValid() const override;
+  NVImage* AsNVImage() override;
 
   // Methods mimic layers::PlanarYCbCrImage.
-  virtual bool SetData(const Data& aData);
-  virtual const Data* GetData() const;
-  virtual uint32_t GetBufferSize() const;
+  bool SetData(const Data& aData) ;
+  const Data* GetData() const;
+  uint32_t GetBufferSize() const;
 
 protected:
 
   /**
    * Return a buffer to store image data in.
    */
   mozilla::UniquePtr<uint8_t> AllocateBuffer(uint32_t aSize);
 
@@ -928,32 +947,33 @@ protected:
   nsCountedRef<nsMainThreadSourceSurfaceRef> mSourceSurface;
 };
 
 /**
  * Currently, the data in a SourceSurfaceImage surface is treated as being in the
  * device output color space. This class is very simple as all backends
  * have to know about how to deal with drawing a cairo image.
  */
-class SourceSurfaceImage final : public Image {
+class SourceSurfaceImage final : public Image
+{
 public:
-  virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override
   {
     RefPtr<gfx::SourceSurface> surface(mSourceSurface);
     return surface.forget();
   }
 
   void SetTextureFlags(TextureFlags aTextureFlags) { mTextureFlags = aTextureFlags; }
-  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
+  TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
 
-  virtual gfx::IntSize GetSize() override { return mSize; }
+  gfx::IntSize GetSize() const override { return mSize; }
 
   SourceSurfaceImage(const gfx::IntSize& aSize, gfx::SourceSurface* aSourceSurface);
   explicit SourceSurfaceImage(gfx::SourceSurface* aSourceSurface);
-  ~SourceSurfaceImage();
+  virtual ~SourceSurfaceImage();
 
 private:
   gfx::IntSize mSize;
   nsCountedRef<nsOwningThreadSourceSurfaceRef> mSourceSurface;
   nsDataHashtable<nsUint32HashKey, RefPtr<TextureClient> >  mTextureClients;
   TextureFlags mTextureFlags;
 };
 
--- a/gfx/layers/MacIOSurfaceImage.h
+++ b/gfx/layers/MacIOSurfaceImage.h
@@ -11,35 +11,39 @@
 #include "mozilla/gfx/MacIOSurface.h"
 #include "mozilla/gfx/Point.h"
 #include "mozilla/layers/TextureClient.h"
 
 namespace mozilla {
 
 namespace layers {
 
-class MacIOSurfaceImage : public Image {
+class MacIOSurfaceImage : public Image
+{
 public:
   explicit MacIOSurfaceImage(MacIOSurface* aSurface)
-   : Image(nullptr, ImageFormat::MAC_IOSURFACE),
-     mSurface(aSurface)
-  {}
+    : Image(nullptr, ImageFormat::MAC_IOSURFACE)
+    , mSurface(aSurface)
+  {
+  }
 
   MacIOSurface* GetSurface() { return mSurface; }
 
-  gfx::IntSize GetSize() override {
+  gfx::IntSize GetSize() const override
+  {
     return gfx::IntSize::Truncate(mSurface->GetDevicePixelWidth(),
                                   mSurface->GetDevicePixelHeight());
   }
 
-  virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
 
-  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
+  TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
 
-  virtual MacIOSurfaceImage* AsMacIOSurfaceImage() override {
+  MacIOSurfaceImage* AsMacIOSurfaceImage() override
+  {
     return this;
   }
 
 private:
   RefPtr<MacIOSurface> mSurface;
   RefPtr<TextureClient> mTextureClient;
 };
 
--- a/gfx/layers/TextureWrapperImage.cpp
+++ b/gfx/layers/TextureWrapperImage.cpp
@@ -17,23 +17,23 @@ TextureWrapperImage::TextureWrapperImage
 {
 }
 
 TextureWrapperImage::~TextureWrapperImage()
 {
 }
 
 gfx::IntSize
-TextureWrapperImage::GetSize()
+TextureWrapperImage::GetSize() const
 {
   return mTextureClient->GetSize();
 }
 
 gfx::IntRect
-TextureWrapperImage::GetPictureRect()
+TextureWrapperImage::GetPictureRect() const
 {
   return mPictureRect;
 }
 
 already_AddRefed<gfx::SourceSurface>
 TextureWrapperImage::GetAsSourceSurface()
 {
   TextureClientAutoLock autoLock(mTextureClient, OpenMode::OPEN_READ);
--- a/gfx/layers/TextureWrapperImage.h
+++ b/gfx/layers/TextureWrapperImage.h
@@ -15,20 +15,20 @@ namespace mozilla {
 namespace layers {
 
 // Wraps a TextureClient into an Image. This may only be used on the main
 // thread, and only with TextureClients that support BorrowDrawTarget().
 class TextureWrapperImage final : public Image
 {
 public:
   TextureWrapperImage(TextureClient* aClient, const gfx::IntRect& aPictureRect);
-  ~TextureWrapperImage() override;
+  virtual ~TextureWrapperImage();
 
-  gfx::IntSize GetSize() override;
-  gfx::IntRect GetPictureRect() override;
+  gfx::IntSize GetSize() const override;
+  gfx::IntRect GetPictureRect() const override;
   already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
   TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
 
 private:
   gfx::IntRect mPictureRect;
   RefPtr<TextureClient> mTextureClient;
 };
 
--- a/gfx/layers/client/SingleTiledContentClient.h
+++ b/gfx/layers/client/SingleTiledContentClient.h
@@ -39,40 +39,40 @@ public:
 
   // ClientTiledLayerBuffer
   void PaintThebes(const nsIntRegion& aNewValidRegion,
                    const nsIntRegion& aPaintRegion,
                    const nsIntRegion& aDirtyRegion,
                    LayerManager::DrawPaintedLayerCallback aCallback,
                    void* aCallbackData,
                    TilePaintFlags aFlags = TilePaintFlags::None) override;
- 
+
   bool SupportsProgressiveUpdate() override { return false; }
   bool ProgressiveUpdate(const nsIntRegion& aValidRegion,
                          const nsIntRegion& aInvalidRegion,
                          const nsIntRegion& aOldValidRegion,
                          nsIntRegion& aOutDrawnRegion,
                          BasicTiledLayerPaintData* aPaintData,
                          LayerManager::DrawPaintedLayerCallback aCallback,
                          void* aCallbackData) override
   {
     MOZ_ASSERT(false, "ProgressiveUpdate not supported!");
     return false;
   }
-  
+
   void ResetPaintedAndValidState() override {
     mPaintedRegion.SetEmpty();
     mValidRegion.SetEmpty();
     mTile.DiscardBuffers();
   }
-  
+
   const nsIntRegion& GetValidRegion() override {
     return mValidRegion;
   }
-  
+
   bool IsLowPrecision() const override {
     return false;
   }
 
   void ReleaseTiles();
 
   void DiscardBuffers();
 
--- a/gfx/layers/client/TextureClientPool.h
+++ b/gfx/layers/client/TextureClientPool.h
@@ -37,17 +37,17 @@ public:
    */
   virtual void ReturnTextureClientDeferred(TextureClient *aClient) = 0;
 
   virtual void ReportClientLost() = 0;
 };
 
 class TextureClientPool final : public TextureClientAllocator
 {
-  ~TextureClientPool();
+  virtual ~TextureClientPool();
 
 public:
   TextureClientPool(LayersBackend aBackend,
                     int32_t aMaxTextureSize,
                     gfx::SurfaceFormat aFormat,
                     gfx::IntSize aSize,
                     TextureFlags aFlags,
                     uint32_t aShrinkTimeoutMsec,
@@ -90,17 +90,17 @@ public:
    * mInitialPoolSize outstanding.
    */
   void ShrinkToMaximumSize();
 
   /**
    * Report that a client retrieved via GetTextureClient() has become
    * unusable, so that it will no longer be tracked.
    */
-  virtual void ReportClientLost() override;
+  void ReportClientLost() override;
 
   /**
    * Calling this will cause the pool to attempt to relinquish any unused
    * clients.
    */
   void Clear();
 
   LayersBackend GetBackend() const { return mBackend; }
--- a/gfx/layers/ipc/KnowsCompositor.h
+++ b/gfx/layers/ipc/KnowsCompositor.h
@@ -49,17 +49,18 @@ public:
     aResource->NotifyInactive();
   }
 };
 
 /**
  * An abstract interface for classes that are tied to a specific Compositor across
  * IPDL and uses TextureFactoryIdentifier to describe this Compositor.
  */
-class KnowsCompositor {
+class KnowsCompositor
+{
 public:
   NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
 
   KnowsCompositor();
   ~KnowsCompositor();
 
   void IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier);
 
@@ -112,21 +113,22 @@ public:
     return mTextureFactoryIdentifier.mCompositorUseANGLE;
   }
 
   const TextureFactoryIdentifier& GetTextureFactoryIdentifier() const
   {
     return mTextureFactoryIdentifier;
   }
 
-  bool DeviceCanReset() const {
+  bool DeviceCanReset() const
+  {
     return GetCompositorBackendType() != LayersBackend::LAYERS_BASIC;
   }
 
-  int32_t GetSerial() { return mSerial; }
+  int32_t GetSerial() const { return mSerial; }
 
   /**
    * Sends a synchronous ping to the compsoitor.
    *
    * This is bad for performance and should only be called as a last resort if the
    * compositor may be blocked for a long period of time, to avoid that the content
    * process accumulates resource allocations that the compositor is not consuming
    * and releasing.
--- a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
+++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
@@ -24,22 +24,23 @@
 #include "mozilla/ipc/Shmem.h"
 
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::ipc;
 
 SharedPlanarYCbCrImage::SharedPlanarYCbCrImage(ImageClient* aCompositable)
-: mCompositable(aCompositable)
+  : mCompositable(aCompositable)
 {
   MOZ_COUNT_CTOR(SharedPlanarYCbCrImage);
 }
 
-SharedPlanarYCbCrImage::~SharedPlanarYCbCrImage() {
+SharedPlanarYCbCrImage::~SharedPlanarYCbCrImage()
+{
   MOZ_COUNT_DTOR(SharedPlanarYCbCrImage);
 }
 
 size_t
 SharedPlanarYCbCrImage::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
 {
   // NB: Explicitly skipping mTextureClient, the memory is already reported
   //     at time of allocation in GfxMemoryImageReporter.
@@ -50,17 +51,17 @@ SharedPlanarYCbCrImage::SizeOfExcludingT
 
 TextureClient*
 SharedPlanarYCbCrImage::GetTextureClient(KnowsCompositor* aForwarder)
 {
   return mTextureClient.get();
 }
 
 uint8_t*
-SharedPlanarYCbCrImage::GetBuffer()
+SharedPlanarYCbCrImage::GetBuffer() const
 {
   // This should never be used
   MOZ_ASSERT(false);
   return nullptr;
 }
 
 already_AddRefed<gfx::SourceSurface>
 SharedPlanarYCbCrImage::GetAsSourceSurface()
@@ -129,17 +130,18 @@ SharedPlanarYCbCrImage::AdoptData(const 
                                    aData.mYUVColorSpace,
                                    aData.mBitDepth,
                                    hasIntermediateBuffer));
 
   return true;
 }
 
 bool
-SharedPlanarYCbCrImage::IsValid() {
+SharedPlanarYCbCrImage::IsValid() const
+{
   return mTextureClient && mTextureClient->IsValid();
 }
 
 bool
 SharedPlanarYCbCrImage::Allocate(PlanarYCbCrData& aData)
 {
   MOZ_ASSERT(!mTextureClient,
              "This image already has allocated data");
--- a/gfx/layers/ipc/SharedPlanarYCbCrImage.h
+++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.h
@@ -26,33 +26,33 @@ class SharedPlanarYCbCrImage : public Pl
 {
 public:
   explicit SharedPlanarYCbCrImage(ImageClient* aCompositable);
 
 protected:
   virtual ~SharedPlanarYCbCrImage();
 
 public:
-  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
-  virtual uint8_t* GetBuffer() override;
+  TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
+  uint8_t* GetBuffer() const override;
 
-  virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
-  virtual bool CopyData(const PlanarYCbCrData& aData) override;
-  virtual bool AdoptData(const Data& aData) override;
+  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
+  bool CopyData(const PlanarYCbCrData& aData) override;
+  bool AdoptData(const Data& aData) override;
 
-  virtual bool Allocate(PlanarYCbCrData& aData);
+  bool Allocate(PlanarYCbCrData& aData);
 
-  virtual bool IsValid() override;
+  bool IsValid() const override;
 
-  virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
+  size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override
   {
     return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 
-  virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
+  size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
 
 private:
   RefPtr<TextureClient> mTextureClient;
   RefPtr<ImageClient> mCompositable;
 };
 
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/SharedRGBImage.cpp
+++ b/gfx/layers/ipc/SharedRGBImage.cpp
@@ -72,27 +72,27 @@ SharedRGBImage::Allocate(gfx::IntSize aS
   mSize = aSize;
   mTextureClient = mCompositable->CreateBufferTextureClient(aFormat, aSize,
                                                             gfx::BackendType::NONE,
                                                             TextureFlags::DEFAULT);
   return !!mTextureClient;
 }
 
 uint8_t*
-SharedRGBImage::GetBuffer()
+SharedRGBImage::GetBuffer() const
 {
   MappedTextureData mapped;
   if (mTextureClient && mTextureClient->BorrowMappedData(mapped)) {
     return mapped.data;
   }
   return 0;
 }
 
 gfx::IntSize
-SharedRGBImage::GetSize()
+SharedRGBImage::GetSize() const
 {
   return mSize;
 }
 
 TextureClient*
 SharedRGBImage::GetTextureClient(KnowsCompositor* aForwarder)
 {
   return mTextureClient.get();
--- a/gfx/layers/ipc/SharedRGBImage.h
+++ b/gfx/layers/ipc/SharedRGBImage.h
@@ -35,21 +35,21 @@ class SharedRGBImage : public Image
 {
 public:
   explicit SharedRGBImage(ImageClient* aCompositable);
 
 protected:
   virtual ~SharedRGBImage();
 
 public:
-  virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
+  TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
 
-  virtual uint8_t* GetBuffer() override;
+  uint8_t* GetBuffer() const override;
 
-  gfx::IntSize GetSize() override;
+  gfx::IntSize GetSize() const override;
 
   already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
 
   bool Allocate(gfx::IntSize aSize, gfx::SurfaceFormat aFormat);
 private:
   gfx::IntSize mSize;
   RefPtr<ImageClient> mCompositable;
   RefPtr<TextureClient> mTextureClient;