Bug 1410777 - Remove unnecessary code. r=nical
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 26 Oct 2017 14:17:19 -0400
changeset 439485 cd78beac7f6f52c46d438ecd6c7e397f19f77c79
parent 439484 7b501bcc9d3f2a9d7ff3cee0a9019cb3fd2bea3f
child 439486 806540586443b1304287811c592cfcc7d90e0cb6
push id8114
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 16:33:21 +0000
treeherdermozilla-beta@73e0d89a540f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1410777
milestone58.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 1410777 - Remove unnecessary code. r=nical As per the TODO, a size change on an image is supported now, so there should be no need to delete and re-create the image key when the window overlay image changes size. And since the cleanup function is not invoked from anywhere else it can also be removed. MozReview-Commit-ID: JSmK5YmXjlX
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/nsIWidget.h
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -453,19 +453,16 @@ public:
   virtual void CreateCompositor() override;
   virtual void PrepareWindowEffects() override;
   virtual void CleanupWindowEffects() override;
 
   virtual void AddWindowOverlayWebRenderCommands(mozilla::layers::WebRenderBridgeChild* aWrBridge,
                                                  mozilla::wr::DisplayListBuilder& aBuilder,
                                                  mozilla::wr::IpcResourceUpdateQueue& aResourceUpdates) override;
 
-  virtual void CleanupWebRenderWindowOverlay(mozilla::layers::WebRenderBridgeChild* aWrBridge,
-                                             mozilla::wr::IpcResourceUpdateQueue& aResources) override;
-
   virtual bool PreRender(mozilla::widget::WidgetRenderingContext* aContext) override;
   virtual void PostRender(mozilla::widget::WidgetRenderingContext* aContext) override;
   virtual void DrawWindowOverlay(mozilla::widget::WidgetRenderingContext* aManager,
                                  LayoutDeviceIntRect aRect) override;
 
   virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
 
   virtual void UpdateWindowDraggingRegion(const LayoutDeviceIntRegion& aRegion) override;
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -2095,24 +2095,16 @@ nsChildView::AddWindowOverlayWebRenderCo
     size_t stride = CGBitmapContextGetBytesPerRow(mTitlebarCGContext);
     size_t titlebarCGContextDataLength = stride * size.height;
     gfx::SurfaceFormat format = gfx::SurfaceFormat::B8G8R8A8;
     Range<uint8_t> buffer(
       static_cast<uint8_t *>(CGBitmapContextGetData(mTitlebarCGContext)),
       titlebarCGContextDataLength
     );
 
-    if (mTitlebarImageKey &&
-        mTitlebarImageSize != size) {
-      // Delete wr::ImageKey. wr::ImageKey does not support size change.
-      // TODO: that's not true anymore! (size change is now supported).
-      CleanupWebRenderWindowOverlay(aWrBridge, aResources);
-      MOZ_ASSERT(mTitlebarImageKey.isNothing());
-    }
-
     if (!mTitlebarImageKey) {
       mTitlebarImageKey = Some(aWrBridge->GetNextImageKey());
       wr::ImageDescriptor descriptor(size, stride, format);
       aResources.AddImage(*mTitlebarImageKey, descriptor, buffer);
       mTitlebarImageSize = size;
       needUpdate = false;
     }
 
@@ -2122,26 +2114,16 @@ nsChildView::AddWindowOverlayWebRenderCo
     }
 
     wr::LayoutRect rect = wr::ToLayoutRect(mTitlebarRect);
     aBuilder.PushImage(wr::LayoutRect{ rect.origin, { float(size.width), float(size.height) } },
                        rect, true, wr::ImageRendering::Auto, *mTitlebarImageKey);
   }
 }
 
-void
-nsChildView::CleanupWebRenderWindowOverlay(layers::WebRenderBridgeChild* aWrBridge,
-                                           wr::IpcResourceUpdateQueue& aResources)
-{
-  if (mTitlebarImageKey) {
-    aResources.DeleteImage(*mTitlebarImageKey);
-    mTitlebarImageKey = Nothing();
-  }
-}
-
 bool
 nsChildView::PreRender(WidgetRenderingContext* aContext)
 {
   UniquePtr<GLManager> manager(GLManager::CreateGLManager(aContext->mLayerManager));
   gl::GLContext* gl = manager ? manager->gl() : aContext->mGL;
   if (!gl) {
     return true;
   }
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1290,23 +1290,16 @@ class nsIWidget : public nsISupports
     /**
      * Called on the main thread at the end of WebRender display list building.
      */
     virtual void AddWindowOverlayWebRenderCommands(mozilla::layers::WebRenderBridgeChild* aWrBridge,
                                                    mozilla::wr::DisplayListBuilder& aBuilder,
                                                    mozilla::wr::IpcResourceUpdateQueue& aResources) {}
 
     /**
-     * Called on the main thread when WebRender resources used for
-     * AddWindowOverlayWebRenderCommands need to be destroyed.
-     */
-    virtual void CleanupWebRenderWindowOverlay(mozilla::layers::WebRenderBridgeChild* aWrBridge,
-                                               mozilla::wr::IpcResourceUpdateQueue& aResources) {}
-
-    /**
      * Called when Gecko knows which themed widgets exist in this window.
      * The passed array contains an entry for every themed widget of the right
      * type (currently only NS_THEME_TOOLBAR) within the window, except for
      * themed widgets which are transformed or have effects applied to them
      * (e.g. CSS opacity or filters).
      * This could sometimes be called during display list construction
      * outside of painting.
      * If called during painting, it will be called before we actually