mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 933082 - Part 1: make LayerTransactionChild reference-counted - r=nical
This commit is contained in:
parent
dc444c87ab
commit
930be8d6aa
@ -87,13 +87,15 @@ CompositorChild::AllocPLayerTransactionChild(const nsTArray<LayersBackend>& aBac
|
||||
TextureFactoryIdentifier*,
|
||||
bool*)
|
||||
{
|
||||
return new LayerTransactionChild();
|
||||
LayerTransactionChild* c = new LayerTransactionChild();
|
||||
c->AddIPDLReference();
|
||||
return c;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorChild::DeallocPLayerTransactionChild(PLayerTransactionChild* actor)
|
||||
{
|
||||
delete actor;
|
||||
static_cast<LayerTransactionChild*>(actor)->ReleaseIPDLReference();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,16 +13,20 @@
|
||||
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/layers/PLayerTransactionChild.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace layout {
|
||||
class RenderFrameChild;
|
||||
}
|
||||
|
||||
namespace layers {
|
||||
|
||||
class LayerTransactionChild : public PLayerTransactionChild
|
||||
, public AtomicRefCounted<LayerTransactionChild>
|
||||
{
|
||||
public:
|
||||
LayerTransactionChild() { }
|
||||
~LayerTransactionChild() { }
|
||||
|
||||
/**
|
||||
* Clean this up, finishing with Send__delete__().
|
||||
*
|
||||
@ -32,7 +36,16 @@ public:
|
||||
*/
|
||||
void Destroy();
|
||||
|
||||
bool IPCOpen() const { return mIPCOpen; }
|
||||
|
||||
protected:
|
||||
LayerTransactionChild()
|
||||
: mIPCOpen(false)
|
||||
{}
|
||||
~LayerTransactionChild() { }
|
||||
friend class AtomicRefCounted<LayerTransactionChild>;
|
||||
friend class detail::RefCounted<LayerTransactionChild, detail::AtomicRefCount>;
|
||||
|
||||
virtual PGrallocBufferChild*
|
||||
AllocPGrallocBufferChild(const gfxIntSize&,
|
||||
const uint32_t&, const uint32_t&,
|
||||
@ -46,6 +59,21 @@ protected:
|
||||
virtual PCompositableChild* AllocPCompositableChild(const TextureInfo& aInfo) MOZ_OVERRIDE;
|
||||
virtual bool DeallocPCompositableChild(PCompositableChild* actor) MOZ_OVERRIDE;
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
||||
void AddIPDLReference() {
|
||||
MOZ_ASSERT(mIPCOpen == false);
|
||||
mIPCOpen = true;
|
||||
AddRef();
|
||||
}
|
||||
void ReleaseIPDLReference() {
|
||||
MOZ_ASSERT(mIPCOpen == true);
|
||||
mIPCOpen = false;
|
||||
Release();
|
||||
}
|
||||
friend class CompositorChild;
|
||||
friend class layout::RenderFrameChild;
|
||||
|
||||
bool mIPCOpen;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
@ -35,13 +35,15 @@ RenderFrameChild::Destroy()
|
||||
PLayerTransactionChild*
|
||||
RenderFrameChild::AllocPLayerTransactionChild()
|
||||
{
|
||||
return new LayerTransactionChild();
|
||||
LayerTransactionChild* c = new LayerTransactionChild();
|
||||
c->AddIPDLReference();
|
||||
return c;
|
||||
}
|
||||
|
||||
bool
|
||||
RenderFrameChild::DeallocPLayerTransactionChild(PLayerTransactionChild* aLayers)
|
||||
{
|
||||
delete aLayers;
|
||||
static_cast<LayerTransactionChild*>(aLayers)->ReleaseIPDLReference();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user