Don't attach shadowable layers if IPDL fails to construct an actor. (bug 1314349, r=mattwoodrow)

This commit is contained in:
David Anderson 2016-11-06 18:50:15 -08:00
Родитель 4558802c65
Коммит 718c1c97fe
3 изменённых файлов: 20 добавлений и 5 удалений

Просмотреть файл

@ -12,20 +12,27 @@
namespace mozilla {
namespace layers {
ShadowLayerChild::ShadowLayerChild(ShadowableLayer* aLayer)
: mLayer(aLayer)
ShadowLayerChild::ShadowLayerChild()
: mLayer(nullptr)
{ }
ShadowLayerChild::~ShadowLayerChild()
{ }
void
ShadowLayerChild::SetShadowableLayer(ShadowableLayer* aLayer)
{
MOZ_ASSERT(!mLayer);
mLayer = aLayer;
}
void
ShadowLayerChild::ActorDestroy(ActorDestroyReason why)
{
MOZ_ASSERT(AncestorDeletion != why,
"shadowable layer should have been cleaned up by now");
if (AbnormalShutdown == why) {
if (AbnormalShutdown == why && mLayer) {
// This is last-ditch emergency shutdown. Just have the layer
// forget its IPDL resources; IPDL-generated code will clean up
// automatically in this case.

Просмотреть файл

@ -20,9 +20,10 @@ class ShadowableLayer;
class ShadowLayerChild : public PLayerChild
{
public:
explicit ShadowLayerChild(ShadowableLayer* aLayer);
ShadowLayerChild();
virtual ~ShadowLayerChild();
void SetShadowableLayer(ShadowableLayer* aLayer);
ShadowableLayer* layer() const { return mLayer; }
protected:

Просмотреть файл

@ -749,7 +749,14 @@ ShadowLayerForwarder::ConstructShadowFor(ShadowableLayer* aLayer)
if (!IPCOpen()) {
return nullptr;
}
return mShadowManager->SendPLayerConstructor(new ShadowLayerChild(aLayer));
ShadowLayerChild* child = new ShadowLayerChild();
if (!mShadowManager->SendPLayerConstructor(child)) {
return nullptr;
}
child->SetShadowableLayer(aLayer);
return child;
}
#if !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)