Commit 62430de2 authored by Markus Stange's avatar Markus Stange
Browse files

Bug 1491442 - Add CompositorWidget::DoCompositorCleanup() to give the widget a...

Bug 1491442 - Add CompositorWidget::DoCompositorCleanup() to give the widget a chance to clean up any state from PreRender/PostRender on the correct thread. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D40514

--HG--
extra : moz-landing-system : lando
parent 327b689a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -76,6 +76,9 @@ Compositor::Compositor(widget::CompositorWidget* aWidget,

Compositor::~Compositor() { ReadUnlockTextures(); }

// Called just before DetachWidget.
void Compositor::DoWidgetCleanup() { mWidget->DoCompositorCleanup(); }

void Compositor::Destroy() {
  TextureSourceProvider::Destroy();
  mIsDestroyed = true;
+1 −0
Original line number Diff line number Diff line
@@ -190,6 +190,7 @@ class Compositor : public TextureSourceProvider {
  void Destroy() override;
  bool IsDestroyed() const { return mIsDestroyed; }

  virtual void DoWidgetCleanup();
  virtual void DetachWidget() { mWidget = nullptr; }

  /**
+1 −0
Original line number Diff line number Diff line
@@ -499,6 +499,7 @@ void CompositorBridgeParent::StopAndClearResources() {
  }

  if (mCompositor) {
    mCompositor->DoWidgetCleanup();
    mCompositor->DetachWidget();
    mCompositor->Destroy();
    mCompositor = nullptr;
+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ RendererOGL::~RendererOGL() {
    // Leak resources!
    return;
  }
  mCompositor->GetWidget()->DoCompositorCleanup();
  wr_renderer_delete(mRenderer);
}

+7 −0
Original line number Diff line number Diff line
@@ -116,6 +116,13 @@ class CompositorWidget {
   */
  virtual void PostRender(WidgetRenderingContext* aContext) {}

  /**
   * Called on the same thread as PreRender/PostRender during destruction.
   * This method gives the widget a chance to do any cleanup for state that it
   * created during PreRender / PostRender.
   */
  virtual void DoCompositorCleanup() {}

  /**
   * Called before the LayerManager draws the layer tree.
   *
Loading