Bug 897452 - Part 13 - Host-side cleanup: remove OnActorDestroy and DestroyTextureHost* - r=nrc
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 11 Dec 2013 20:45:07 -0500
changeset 170237 c57f9c2a5459cd97e6f37b50657baed932c57637
parent 170236 146bd659d1778925ba10938210fcd05f6a8d19fc
child 170238 f7eb2a0b79f4a550cd10508650e341947e016d9a
push idunknown
push userunknown
push dateunknown
reviewersnrc
bugs897452
milestone29.0a1
Bug 897452 - Part 13 - Host-side cleanup: remove OnActorDestroy and DestroyTextureHost* - r=nrc
gfx/layers/composite/CompositableHost.h
gfx/layers/composite/ContentHost.cpp
gfx/layers/composite/ContentHost.h
gfx/layers/composite/ImageHost.h
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TiledContentHost.h
--- a/gfx/layers/composite/CompositableHost.h
+++ b/gfx/layers/composite/CompositableHost.h
@@ -103,22 +103,16 @@ public:
     return mBackendData;
   }
 
   virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
   {
     mBackendData = aBackendData;
   }
 
-  /**
-   * Our IPDL actor is being destroyed, get rid of any shmem resources now and
-   * don't worry about compositing anymore.
-   */
-  virtual void OnActorDestroy() {};
-
   // If base class overrides, it should still call the parent implementation
   virtual void SetCompositor(Compositor* aCompositor);
 
   // composite the contents of this buffer host to the compositor's surface
   virtual void Composite(EffectChain& aEffectChain,
                          float aOpacity,
                          const gfx::Matrix4x4& aTransform,
                          const gfx::Filter& aFilter,
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -27,38 +27,24 @@ namespace layers {
 ContentHostBase::ContentHostBase(const TextureInfo& aTextureInfo)
   : ContentHost(aTextureInfo)
   , mPaintWillResample(false)
   , mInitialised(false)
 {}
 
 ContentHostBase::~ContentHostBase()
 {
-  DestroyTextureHost();
-  DestroyTextureHostOnWhite();
 }
 
 TextureHost*
 ContentHostBase::GetAsTextureHost()
 {
   return mTextureHost;
 }
 
-void
-ContentHostBase::DestroyTextureHost()
-{
-  mTextureHost = nullptr;
-}
-
-void
-ContentHostBase::DestroyTextureHostOnWhite()
-{
-  mTextureHostOnWhite = nullptr;
-}
-
 class MOZ_STACK_CLASS AutoLockTextureHost
 {
 public:
   AutoLockTextureHost(TextureHost* aHost)
     : mHost(aHost)
   {
     mLockSuccess = mHost ? mHost->Lock() : true;
   }
@@ -249,20 +235,20 @@ ContentHostBase::Composite(EffectChain& 
   GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect, aTransform);
 }
 
 
 void
 ContentHostBase::UseTextureHost(TextureHost* aTexture)
 {
   if (aTexture->GetFlags() & TEXTURE_ON_WHITE) {
-    DestroyTextureHost();
+    mTextureHost = nullptr;
     mTextureHostOnWhite = aTexture;
   } else {
-    DestroyTextureHostOnWhite();
+    mTextureHostOnWhite = nullptr;
     mTextureHost = aTexture;
   }
 }
 
 void
 ContentHostBase::SetCompositor(Compositor* aCompositor)
 {
   CompositableHost::SetCompositor(aCompositor);
@@ -298,22 +284,16 @@ ContentHostBase::Dump(FILE* aFile,
     fprintf(aFile, "<li> <a href=");
     DumpTextureHost(aFile, mTextureHostOnWhite);
     fprintf(aFile, "> Front buffer on white </a> </li> ");
   }
   fprintf(aFile, "</ul>");
 }
 #endif
 
-void
-ContentHostBase::OnActorDestroy()
-{
-  CompositableHost::OnActorDestroy();
-}
-
 DeprecatedContentHostBase::DeprecatedContentHostBase(const TextureInfo& aTextureInfo)
   : ContentHost(aTextureInfo)
   , mPaintWillResample(false)
   , mInitialised(false)
 {}
 
 DeprecatedContentHostBase::~DeprecatedContentHostBase()
 {}
@@ -331,21 +311,16 @@ DeprecatedContentHostBase::DestroyFrontH
              "We won't be able to destroy our SurfaceDescriptor");
   MOZ_ASSERT(!mDeprecatedTextureHostOnWhite || mDeprecatedTextureHostOnWhite->GetDeAllocator(),
              "We won't be able to destroy our SurfaceDescriptor");
   mDeprecatedTextureHost = nullptr;
   mDeprecatedTextureHostOnWhite = nullptr;
 }
 
 void
-DeprecatedContentHostBase::OnActorDestroy()
-{
-}
-
-void
 DeprecatedContentHostBase::Composite(EffectChain& aEffectChain,
                            float aOpacity,
                            const gfx::Matrix4x4& aTransform,
                            const Filter& aFilter,
                            const Rect& aClipRect,
                            const nsIntRegion* aVisibleRegion,
                            TiledLayerProperties* aLayerProperties)
 {
@@ -794,21 +769,16 @@ DeprecatedContentHostDoubleBuffered::Des
                "We won't be able to destroy our SurfaceDescriptor");
     mBackHostOnWhite = nullptr;
   }
 
   // don't touch mDeprecatedTextureHost, we might need it for compositing
 }
 
 void
-DeprecatedContentHostDoubleBuffered::OnActorDestroy()
-{
-}
-
-void
 DeprecatedContentHostDoubleBuffered::UpdateThebes(const ThebesBufferData& aData,
                                         const nsIntRegion& aUpdated,
                                         const nsIntRegion& aOldValidRegionBack,
                                         nsIntRegion* aUpdatedRegionBack)
 {
   if (!mDeprecatedTextureHost && !mNewFrontHost) {
     mInitialised = false;
 
--- a/gfx/layers/composite/ContentHost.h
+++ b/gfx/layers/composite/ContentHost.h
@@ -114,30 +114,24 @@ public:
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
 
   virtual TextureHost* GetAsTextureHost() MOZ_OVERRIDE;
 
   virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
 
   virtual void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; }
 
-  virtual void OnActorDestroy() MOZ_OVERRIDE;
-
 protected:
   virtual nsIntPoint GetOriginOffset()
   {
     return mBufferRect.TopLeft() - mBufferRotation;
   }
 
   bool PaintWillResample() { return mPaintWillResample; }
 
-  // These must be called before forgetting mTextureHost or mTextureHostOnWhite
-  void DestroyTextureHost();
-  void DestroyTextureHostOnWhite();
-
   nsIntRect mBufferRect;
   nsIntPoint mBufferRotation;
   RefPtr<TextureHost> mTextureHost;
   RefPtr<TextureHost> mTextureHostOnWhite;
   bool mPaintWillResample;
   bool mInitialised;
 };
 class DeprecatedContentHostBase : public ContentHost
@@ -178,18 +172,16 @@ public:
   virtual DeprecatedTextureHost* GetDeprecatedTextureHost() MOZ_OVERRIDE;
 
   virtual void SetPaintWillResample(bool aResample) { mPaintWillResample = aResample; }
   // The client has destroyed its texture clients and we should destroy our
   // texture hosts and SurfaceDescriptors. Note that we don't immediately
   // destroy our front buffer so that we can continue to composite.
   virtual void DestroyTextures() = 0;
 
-  virtual void OnActorDestroy() MOZ_OVERRIDE;
-
 protected:
   virtual nsIntPoint GetOriginOffset()
   {
     return mBufferRect.TopLeft() - mBufferRotation;
   }
 
   bool PaintWillResample() { return mPaintWillResample; }
 
@@ -252,18 +244,16 @@ public:
                             nsIntRegion* aUpdatedRegionBack);
 
   virtual void EnsureDeprecatedTextureHost(TextureIdentifier aTextureId,
                                  const SurfaceDescriptor& aSurface,
                                  ISurfaceAllocator* aAllocator,
                                  const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
   virtual void DestroyTextures() MOZ_OVERRIDE;
 
-  virtual void OnActorDestroy() MOZ_OVERRIDE;
-
 #ifdef MOZ_DUMP_PAINTING
   virtual void Dump(FILE* aFile=nullptr,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
 #endif
 
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 protected:
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -122,18 +122,16 @@ public:
     mPictureRect = aPictureRect;
     mHasPictureRect = true;
   }
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
 
-  virtual void OnActorDestroy() MOZ_OVERRIDE {}
-
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 
 #ifdef MOZ_DUMP_PAINTING
   virtual void Dump(FILE* aFile=nullptr,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
 
   virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -40,17 +40,17 @@ public:
                 const TextureFlags& aFlags) MOZ_OVERRIDE;
 
   virtual bool RecvRemoveTexture() MOZ_OVERRIDE;
 
   virtual bool RecvRemoveTextureSync() MOZ_OVERRIDE;
 
   TextureHost* GetTextureHost() { return mTextureHost; }
 
-  void ActorDestroy(ActorDestroyReason why);
+  void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
 
   ISurfaceAllocator* mAllocator;
   RefPtr<TextureHost> mTextureHost;
 };
 
 // static
 PTextureParent*
 TextureHost::CreateIPDLActor(ISurfaceAllocator* aAllocator)
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -114,18 +114,16 @@ public:
   // by the sum of the resolutions of all parent layers' FrameMetrics.
   const CSSToScreenScale& GetFrameResolution() { return mFrameResolution; }
 
   void SetCompositor(Compositor* aCompositor)
   {
     mCompositor = aCompositor;
   }
 
-  void OnActorDestroy() {}
-
 protected:
   TiledTexture ValidateTile(TiledTexture aTile,
                             const nsIntPoint& aTileRect,
                             const nsIntRegion& dirtyRect);
 
   // do nothing, the desctructor in the texture host takes care of releasing resources
   void ReleaseTile(TiledTexture aTile) {}
 
@@ -236,22 +234,16 @@ public:
     mVideoMemoryTiledBuffer.SetCompositor(aCompositor);
     mLowPrecisionVideoMemoryTiledBuffer.SetCompositor(aCompositor);
   }
 
   virtual void Attach(Layer* aLayer,
                       Compositor* aCompositor,
                       AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
 
-  virtual void OnActorDestroy() MOZ_OVERRIDE
-  {
-    mVideoMemoryTiledBuffer.OnActorDestroy();
-    mLowPrecisionVideoMemoryTiledBuffer.OnActorDestroy();
-  }
-
 #ifdef MOZ_DUMP_PAINTING
   virtual void Dump(FILE* aFile=nullptr,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
 #endif
 
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);