mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-06 00:31:27 +00:00
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
This commit is contained in:
parent
327b689a51
commit
62430de27f
@ -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;
|
||||
|
@ -190,6 +190,7 @@ class Compositor : public TextureSourceProvider {
|
||||
void Destroy() override;
|
||||
bool IsDestroyed() const { return mIsDestroyed; }
|
||||
|
||||
virtual void DoWidgetCleanup();
|
||||
virtual void DetachWidget() { mWidget = nullptr; }
|
||||
|
||||
/**
|
||||
|
@ -499,6 +499,7 @@ void CompositorBridgeParent::StopAndClearResources() {
|
||||
}
|
||||
|
||||
if (mCompositor) {
|
||||
mCompositor->DoWidgetCleanup();
|
||||
mCompositor->DetachWidget();
|
||||
mCompositor->Destroy();
|
||||
mCompositor = nullptr;
|
||||
|
@ -68,6 +68,7 @@ RendererOGL::~RendererOGL() {
|
||||
// Leak resources!
|
||||
return;
|
||||
}
|
||||
mCompositor->GetWidget()->DoCompositorCleanup();
|
||||
wr_renderer_delete(mRenderer);
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -44,6 +44,10 @@ void InProcessCompositorWidget::PostRender(WidgetRenderingContext* aContext) {
|
||||
mWidget->PostRender(aContext);
|
||||
}
|
||||
|
||||
void InProcessCompositorWidget::DoCompositorCleanup() {
|
||||
mWidget->DoCompositorCleanup();
|
||||
}
|
||||
|
||||
void InProcessCompositorWidget::DrawWindowUnderlay(
|
||||
WidgetRenderingContext* aContext, LayoutDeviceIntRect aRect) {
|
||||
mWidget->DrawWindowUnderlay(aContext, aRect);
|
||||
|
@ -19,6 +19,7 @@ class InProcessCompositorWidget : public CompositorWidget {
|
||||
|
||||
virtual bool PreRender(WidgetRenderingContext* aManager) override;
|
||||
virtual void PostRender(WidgetRenderingContext* aManager) override;
|
||||
virtual void DoCompositorCleanup() override;
|
||||
virtual void DrawWindowUnderlay(WidgetRenderingContext* aContext,
|
||||
LayoutDeviceIntRect aRect) override;
|
||||
virtual void DrawWindowOverlay(WidgetRenderingContext* aContext,
|
||||
|
@ -448,6 +448,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||
return true;
|
||||
}
|
||||
virtual void PostRender(mozilla::widget::WidgetRenderingContext* aContext) {}
|
||||
virtual void DoCompositorCleanup() {}
|
||||
virtual void DrawWindowUnderlay(
|
||||
mozilla::widget::WidgetRenderingContext* aContext,
|
||||
LayoutDeviceIntRect aRect) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user