2010-07-21 14:17:33 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2013-04-24 11:42:40 -07:00
|
|
|
#include "LayerTransactionParent.h"
|
2010-07-21 14:17:33 -07:00
|
|
|
#include "ShadowLayerParent.h"
|
|
|
|
#include "ShadowLayers.h"
|
|
|
|
|
|
|
|
#include "BasicLayers.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-07-20 01:48:55 -07:00
|
|
|
ShadowLayerParent::ShadowLayerParent() : mLayer(nullptr)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ShadowLayerParent::~ShadowLayerParent()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerParent::Bind(Layer* layer)
|
|
|
|
{
|
|
|
|
mLayer = layer;
|
|
|
|
}
|
|
|
|
|
2011-01-05 20:54:47 -08:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
ContainerLayer*
|
|
|
|
ShadowLayerParent::AsContainer() const
|
|
|
|
{
|
|
|
|
return static_cast<ContainerLayer*>(AsLayer());
|
|
|
|
}
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
void
|
|
|
|
ShadowLayerParent::ActorDestroy(ActorDestroyReason why)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
2010-08-20 16:24:41 -07:00
|
|
|
switch (why) {
|
|
|
|
case AncestorDeletion:
|
|
|
|
NS_RUNTIMEABORT("shadow layer deleted out of order!");
|
|
|
|
return; // unreached
|
|
|
|
|
|
|
|
case Deletion:
|
2011-01-05 20:54:47 -08:00
|
|
|
// See comment near Destroy() above.
|
|
|
|
if (mLayer) {
|
|
|
|
mLayer->Disconnect();
|
|
|
|
}
|
2010-08-20 16:24:41 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AbnormalShutdown:
|
2013-04-26 12:18:16 -07:00
|
|
|
if (mLayer) {
|
|
|
|
mLayer->Disconnect();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
case NormalShutdown:
|
|
|
|
// let IPDL-generated code automatically clean up Shmems and so
|
|
|
|
// forth; our channel is disconnected anyway
|
|
|
|
break;
|
2011-03-21 09:00:00 -07:00
|
|
|
|
|
|
|
case FailedConstructor:
|
2013-04-24 11:42:40 -07:00
|
|
|
NS_RUNTIMEABORT("FailedConstructor isn't possible in PLayerTransaction");
|
2011-03-21 09:00:00 -07:00
|
|
|
return; // unreached
|
2010-08-20 16:24:41 -07:00
|
|
|
}
|
|
|
|
|
2013-07-20 01:48:55 -07:00
|
|
|
mLayer = nullptr;
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|