2010-08-20 16:24:41 -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-08-20 16:24:41 -07:00
|
|
|
|
2013-04-24 11:42:40 -07:00
|
|
|
#include "LayerTransactionChild.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/layers/CompositableClient.h" // for CompositableChild
|
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for PGrallocBufferChild
|
|
|
|
#include "mozilla/layers/PCompositableChild.h" // for PCompositableChild
|
|
|
|
#include "mozilla/layers/PLayerChild.h" // for PLayerChild
|
|
|
|
#include "mozilla/mozalloc.h" // for operator delete, etc
|
|
|
|
#include "nsDebug.h" // for NS_RUNTIMEABORT, etc
|
|
|
|
#include "nsTArray.h" // for nsTArray
|
2013-12-11 17:44:44 -08:00
|
|
|
#include "mozilla/layers/TextureClient.h"
|
2010-08-20 16:24:41 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
class PGrallocBufferChild;
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
void
|
2013-04-24 11:42:40 -07:00
|
|
|
LayerTransactionChild::Destroy()
|
2010-08-20 16:24:41 -07:00
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(0 == ManagedPLayerChild().Length(),
|
|
|
|
"layers should have been cleaned up by now");
|
2013-04-24 11:42:40 -07:00
|
|
|
PLayerTransactionChild::Send__delete__(this);
|
2010-08-20 16:24:41 -07:00
|
|
|
// WARNING: |this| has gone to the great heap in the sky
|
|
|
|
}
|
|
|
|
|
2012-07-12 05:51:58 -07:00
|
|
|
PGrallocBufferChild*
|
2013-12-20 08:46:29 -08:00
|
|
|
LayerTransactionChild::AllocPGrallocBufferChild(const IntSize&,
|
|
|
|
const uint32_t&,
|
|
|
|
const uint32_t&,
|
|
|
|
MaybeMagicGrallocBufferHandle*)
|
2012-07-12 05:51:58 -07:00
|
|
|
{
|
|
|
|
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
|
|
|
return GrallocBufferActor::Create();
|
|
|
|
#else
|
|
|
|
NS_RUNTIMEABORT("No gralloc buffers for you");
|
2012-07-30 07:20:58 -07:00
|
|
|
return nullptr;
|
2012-07-12 05:51:58 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 08:48:39 -07:00
|
|
|
LayerTransactionChild::DeallocPGrallocBufferChild(PGrallocBufferChild* actor)
|
2012-07-12 05:51:58 -07:00
|
|
|
{
|
|
|
|
#ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC
|
|
|
|
delete actor;
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
NS_RUNTIMEABORT("Um, how did we get here?");
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
PLayerChild*
|
2013-07-08 08:48:39 -07:00
|
|
|
LayerTransactionChild::AllocPLayerChild()
|
2010-08-20 16:24:41 -07:00
|
|
|
{
|
|
|
|
// we always use the "power-user" ctor
|
|
|
|
NS_RUNTIMEABORT("not reached");
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
return nullptr;
|
2010-08-20 16:24:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 08:48:39 -07:00
|
|
|
LayerTransactionChild::DeallocPLayerChild(PLayerChild* actor)
|
2010-08-20 16:24:41 -07:00
|
|
|
{
|
|
|
|
delete actor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
PCompositableChild*
|
2013-07-08 08:48:39 -07:00
|
|
|
LayerTransactionChild::AllocPCompositableChild(const TextureInfo& aInfo)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
{
|
|
|
|
return new CompositableChild();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 08:48:39 -07:00
|
|
|
LayerTransactionChild::DeallocPCompositableChild(PCompositableChild* actor)
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
{
|
|
|
|
delete actor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-04-12 13:25:04 -07:00
|
|
|
void
|
2013-04-24 11:42:40 -07:00
|
|
|
LayerTransactionChild::ActorDestroy(ActorDestroyReason why)
|
2013-04-12 13:25:04 -07:00
|
|
|
{
|
2013-10-10 09:44:03 -07:00
|
|
|
#ifdef MOZ_B2G
|
|
|
|
// Due to poor lifetime management of gralloc (and possibly shmems) we will
|
|
|
|
// crash at some point in the future when we get destroyed due to abnormal
|
|
|
|
// shutdown. Its better just to crash here. On desktop though, we have a chance
|
|
|
|
// of recovering.
|
2013-04-12 13:25:04 -07:00
|
|
|
if (why == AbnormalShutdown) {
|
2013-04-24 11:42:40 -07:00
|
|
|
NS_RUNTIMEABORT("ActorDestroy by IPC channel failure at LayerTransactionChild");
|
2013-04-12 13:25:04 -07:00
|
|
|
}
|
2013-10-10 09:44:03 -07:00
|
|
|
#endif
|
2013-04-12 13:25:04 -07:00
|
|
|
}
|
|
|
|
|
2013-12-11 17:44:44 -08:00
|
|
|
PTextureChild*
|
2014-01-21 14:06:18 -08:00
|
|
|
LayerTransactionChild::AllocPTextureChild(const SurfaceDescriptor&,
|
|
|
|
const TextureFlags&)
|
2013-12-11 17:44:44 -08:00
|
|
|
{
|
|
|
|
return TextureClient::CreateIPDLActor();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
LayerTransactionChild::DeallocPTextureChild(PTextureChild* actor)
|
|
|
|
{
|
|
|
|
return TextureClient::DestroyIPDLActor(actor);
|
|
|
|
}
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|