mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 623255: Ensure LayerOGL::Destroy is called for "orphaned" shadow OGL layers before the GLContext is deleted. r=vlad a=b
This commit is contained in:
parent
49a79e3913
commit
ff1aab8620
@ -1067,10 +1067,7 @@ nsFrameLoader::DestroyChild()
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteBrowser) {
|
||||
mRemoteBrowser->SetOwnerElement(nsnull);
|
||||
// If this fails, it's most likely due to a content-process crash,
|
||||
// and auto-cleanup will kick in. Otherwise, the child side will
|
||||
// destroy itself and send back __delete__().
|
||||
unused << mRemoteBrowser->SendDestroy();
|
||||
mRemoteBrowser->Destroy();
|
||||
mRemoteBrowser = nsnull;
|
||||
}
|
||||
#endif
|
||||
|
@ -110,6 +110,21 @@ TabParent::SetOwnerElement(nsIDOMElement* aElement)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::Destroy()
|
||||
{
|
||||
// If this fails, it's most likely due to a content-process crash,
|
||||
// and auto-cleanup will kick in. Otherwise, the child side will
|
||||
// destroy itself and send back __delete__().
|
||||
unused << SendDestroy();
|
||||
|
||||
for (size_t i = 0; i < ManagedPRenderFrameParent().Length(); ++i) {
|
||||
RenderFrameParent* rfp =
|
||||
static_cast<RenderFrameParent*>(ManagedPRenderFrameParent()[i]);
|
||||
rfp->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
|
@ -80,6 +80,8 @@ public:
|
||||
mBrowserDOMWindow = aBrowserDOMWindow;
|
||||
}
|
||||
|
||||
void Destroy();
|
||||
|
||||
virtual bool RecvMoveFocus(const bool& aForward);
|
||||
virtual bool RecvEvent(const RemoteDOMEvent& aEvent);
|
||||
|
||||
|
@ -61,6 +61,18 @@ ShadowLayerParent::Bind(Layer* layer)
|
||||
mLayer = layer;
|
||||
}
|
||||
|
||||
void
|
||||
ShadowLayerParent::Destroy()
|
||||
{
|
||||
// It's possible for Destroy() to come in just after this has been
|
||||
// created, but just before the transaction in which Bind() would
|
||||
// have been called. In that case, we'll ignore shadow-layers
|
||||
// transactions from there on and never get a layer here.
|
||||
if (mLayer) {
|
||||
mLayer->Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
ContainerLayer*
|
||||
ShadowLayerParent::AsContainer() const
|
||||
{
|
||||
@ -76,7 +88,10 @@ ShadowLayerParent::ActorDestroy(ActorDestroyReason why)
|
||||
return; // unreached
|
||||
|
||||
case Deletion:
|
||||
mLayer->Disconnect();
|
||||
// See comment near Destroy() above.
|
||||
if (mLayer) {
|
||||
mLayer->Disconnect();
|
||||
}
|
||||
break;
|
||||
|
||||
case AbnormalShutdown:
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
virtual ~ShadowLayerParent();
|
||||
|
||||
void Bind(Layer* layer);
|
||||
void Destroy();
|
||||
|
||||
Layer* AsLayer() const { return mLayer; }
|
||||
ContainerLayer* AsContainer() const;
|
||||
|
@ -132,6 +132,16 @@ ShadowLayersParent::~ShadowLayersParent()
|
||||
MOZ_COUNT_DTOR(ShadowLayersParent);
|
||||
}
|
||||
|
||||
void
|
||||
ShadowLayersParent::Destroy()
|
||||
{
|
||||
for (size_t i = 0; i < ManagedPLayerParent().Length(); ++i) {
|
||||
ShadowLayerParent* slp =
|
||||
static_cast<ShadowLayerParent*>(ManagedPLayerParent()[i]);
|
||||
slp->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
InfallibleTArray<EditReply>* reply)
|
||||
|
@ -64,6 +64,8 @@ public:
|
||||
ShadowLayersParent(ShadowLayerManager* aManager);
|
||||
~ShadowLayersParent();
|
||||
|
||||
void Destroy();
|
||||
|
||||
ShadowLayerManager* layer_manager() const { return mLayerManager; }
|
||||
|
||||
ContainerLayer* GetRoot() const { return mRoot; }
|
||||
|
@ -301,6 +301,12 @@ ShadowCanvasLayerOGL::DestroyFrontBuffer()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ShadowCanvasLayerOGL::Disconnect()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void
|
||||
ShadowCanvasLayerOGL::Destroy()
|
||||
{
|
||||
|
@ -113,6 +113,8 @@ public:
|
||||
|
||||
virtual void DestroyFrontBuffer();
|
||||
|
||||
virtual void Disconnect();
|
||||
|
||||
// LayerOGL impl
|
||||
void Destroy();
|
||||
Layer* GetLayer();
|
||||
|
@ -751,6 +751,12 @@ ShadowImageLayerOGL::DestroyFrontBuffer()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ShadowImageLayerOGL::Disconnect()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void
|
||||
ShadowImageLayerOGL::Destroy()
|
||||
{
|
||||
|
@ -259,6 +259,8 @@ public:
|
||||
|
||||
virtual void DestroyFrontBuffer();
|
||||
|
||||
virtual void Disconnect();
|
||||
|
||||
// LayerOGL impl
|
||||
virtual void Destroy();
|
||||
|
||||
|
@ -709,6 +709,12 @@ ShadowThebesLayerOGL::DestroyFrontBuffer()
|
||||
mBuffer = nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
ShadowThebesLayerOGL::Disconnect()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void
|
||||
ShadowThebesLayerOGL::Destroy()
|
||||
{
|
||||
|
@ -105,6 +105,8 @@ public:
|
||||
OptionalThebesBuffer* aReadOnlyFront, nsIntRegion* aFrontUpdatedRegion);
|
||||
virtual void DestroyFrontBuffer();
|
||||
|
||||
virtual void Disconnect();
|
||||
|
||||
// LayerOGL impl
|
||||
void Destroy();
|
||||
Layer* GetLayer();
|
||||
|
@ -181,6 +181,20 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader)
|
||||
RenderFrameParent::~RenderFrameParent()
|
||||
{}
|
||||
|
||||
void
|
||||
RenderFrameParent::Destroy()
|
||||
{
|
||||
size_t numChildren = ManagedPLayersParent().Length();
|
||||
NS_ABORT_IF_FALSE(0 == numChildren || 1 == numChildren,
|
||||
"render frame must only have 0 or 1 layer manager");
|
||||
|
||||
if (numChildren) {
|
||||
ShadowLayersParent* layers =
|
||||
static_cast<ShadowLayersParent*>(ManagedPLayersParent()[0]);
|
||||
layers->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RenderFrameParent::ShadowLayersUpdated()
|
||||
{
|
||||
|
@ -68,6 +68,8 @@ public:
|
||||
RenderFrameParent(nsFrameLoader* aFrameLoader);
|
||||
virtual ~RenderFrameParent();
|
||||
|
||||
void Destroy();
|
||||
|
||||
void ShadowLayersUpdated();
|
||||
|
||||
already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
|
Loading…
x
Reference in New Issue
Block a user