зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1280297 - Add refcount logging support for AtomicRefCountedWithFinalize. r=nical,froydnj
MozReview-Commit-ID: JC6zq3Mit97
This commit is contained in:
Родитель
de7347ec1a
Коммит
3877e9861b
|
@ -33,7 +33,7 @@ template<typename T>
|
|||
class AtomicRefCountedWithFinalize
|
||||
{
|
||||
protected:
|
||||
AtomicRefCountedWithFinalize()
|
||||
explicit AtomicRefCountedWithFinalize(const char* aName)
|
||||
: mRecycleCallback(nullptr)
|
||||
, mRefCount(0)
|
||||
, mMessageLoopToPostDestructionTo(nullptr)
|
||||
|
@ -41,6 +41,7 @@ protected:
|
|||
, mSpew(false)
|
||||
, mManualAddRefs(0)
|
||||
, mManualReleases(0)
|
||||
, mName(aName)
|
||||
#endif
|
||||
{}
|
||||
|
||||
|
@ -109,7 +110,8 @@ public:
|
|||
private:
|
||||
void AddRef() {
|
||||
MOZ_ASSERT(mRefCount >= 0, "AddRef() during/after Finalize()/dtor.");
|
||||
++mRefCount;
|
||||
DebugOnly<int> count = ++mRefCount;
|
||||
NS_LOG_ADDREF(this, count, mName, sizeof(*this));
|
||||
}
|
||||
|
||||
void Release() {
|
||||
|
@ -125,6 +127,7 @@ private:
|
|||
++mRefCount;
|
||||
return;
|
||||
}
|
||||
NS_LOG_RELEASE(this, currCount, mName);
|
||||
|
||||
if (0 == currCount) {
|
||||
mRefCount = detail::DEAD;
|
||||
|
@ -201,6 +204,7 @@ public:
|
|||
private:
|
||||
Atomic<uint32_t> mManualAddRefs;
|
||||
Atomic<uint32_t> mManualReleases;
|
||||
const char* mName;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -1093,7 +1093,8 @@ TextureClient::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
|
|||
}
|
||||
|
||||
TextureClient::TextureClient(TextureData* aData, TextureFlags aFlags, ClientIPCAllocator* aAllocator)
|
||||
: mAllocator(aAllocator)
|
||||
: AtomicRefCountedWithFinalize("TextureClient")
|
||||
, mAllocator(aAllocator)
|
||||
, mActor(nullptr)
|
||||
, mData(aData)
|
||||
, mFlags(aFlags)
|
||||
|
|
|
@ -313,12 +313,12 @@ CreateBackendIndependentTextureHost(const SurfaceDescriptor& aDesc,
|
|||
}
|
||||
|
||||
TextureHost::TextureHost(TextureFlags aFlags)
|
||||
: mActor(nullptr)
|
||||
: AtomicRefCountedWithFinalize("TextureHost")
|
||||
, mActor(nullptr)
|
||||
, mFlags(aFlags)
|
||||
, mCompositableCount(0)
|
||||
, mFwdTransactionId(0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TextureHost);
|
||||
}
|
||||
|
||||
TextureHost::~TextureHost()
|
||||
|
@ -328,7 +328,6 @@ TextureHost::~TextureHost()
|
|||
// destroyed by now. But we will hit assertions if we don't ReadUnlock before
|
||||
// destroying the lock itself.
|
||||
ReadUnlock();
|
||||
MOZ_COUNT_DTOR(TextureHost);
|
||||
}
|
||||
|
||||
void TextureHost::Finalize()
|
||||
|
|
|
@ -46,8 +46,9 @@ class CompositableForwarder : public ClientIPCAllocator
|
|||
{
|
||||
public:
|
||||
|
||||
CompositableForwarder()
|
||||
: mSerial(++sSerialCounter)
|
||||
CompositableForwarder(const char* aName)
|
||||
: ClientIPCAllocator(aName)
|
||||
, mSerial(++sSerialCounter)
|
||||
{}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,8 @@ typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
|
|||
class CompositableParentManager : public HostIPCAllocator
|
||||
{
|
||||
public:
|
||||
CompositableParentManager(const char* aName) : HostIPCAllocator(aName) {}
|
||||
|
||||
void DestroyActor(const OpDestroy& aOp);
|
||||
|
||||
void UpdateFwdTransactionId(uint64_t aTransactionId)
|
||||
|
|
|
@ -588,7 +588,8 @@ CompositorBridgeParent::CompositorBridgeParent(widget::CompositorWidgetProxy* aW
|
|||
bool aUseAPZ,
|
||||
bool aUseExternalSurfaceSize,
|
||||
int aSurfaceWidth, int aSurfaceHeight)
|
||||
: mWidgetProxy(aWidget)
|
||||
: CompositorBridgeParentIPCAllocator("CompositorBridgeParent")
|
||||
, mWidgetProxy(aWidget)
|
||||
, mIsTesting(false)
|
||||
, mPendingTransaction(0)
|
||||
, mPaused(false)
|
||||
|
@ -611,7 +612,6 @@ CompositorBridgeParent::CompositorBridgeParent(widget::CompositorWidgetProxy* aW
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(CompositorThread(),
|
||||
"The compositor thread must be Initialized before instanciating a CompositorBridgeParent.");
|
||||
MOZ_COUNT_CTOR(CompositorBridgeParent);
|
||||
|
||||
// Always run destructor on the main thread
|
||||
SetMessageLoopToPostDestructionTo(MessageLoop::current());
|
||||
|
@ -652,7 +652,6 @@ CompositorBridgeParent::RootLayerTreeId()
|
|||
CompositorBridgeParent::~CompositorBridgeParent()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_COUNT_DTOR(CompositorBridgeParent);
|
||||
|
||||
InfallibleTArray<PTextureParent*> textures;
|
||||
ManagedPTextureParent(textures);
|
||||
|
@ -1822,7 +1821,8 @@ class CrossProcessCompositorBridgeParent final : public PCompositorBridgeParent,
|
|||
|
||||
public:
|
||||
explicit CrossProcessCompositorBridgeParent(Transport* aTransport)
|
||||
: mTransport(aTransport)
|
||||
: CompositorBridgeParentIPCAllocator("CrossProcessCompositorBridgeParent")
|
||||
, mTransport(aTransport)
|
||||
, mSubprocess(nullptr)
|
||||
, mNotifyAfterRemotePaint(false)
|
||||
, mDestroyCalled(false)
|
||||
|
|
|
@ -81,6 +81,8 @@ class ISurfaceAllocator : public AtomicRefCountedWithFinalize<ISurfaceAllocator>
|
|||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_TYPENAME(ISurfaceAllocator)
|
||||
|
||||
ISurfaceAllocator(const char* aName) : AtomicRefCountedWithFinalize(aName) {}
|
||||
|
||||
// down-casting
|
||||
|
||||
virtual ShmemAllocator* AsShmemAllocator() { return nullptr; }
|
||||
|
@ -118,6 +120,8 @@ protected:
|
|||
class ClientIPCAllocator : public ISurfaceAllocator
|
||||
{
|
||||
public:
|
||||
ClientIPCAllocator(const char* aName) : ISurfaceAllocator(aName) {}
|
||||
|
||||
virtual ClientIPCAllocator* AsClientAllocator() override { return this; }
|
||||
|
||||
virtual MessageLoop * GetMessageLoop() const = 0;
|
||||
|
@ -131,6 +135,8 @@ public:
|
|||
class HostIPCAllocator : public ISurfaceAllocator
|
||||
{
|
||||
public:
|
||||
HostIPCAllocator(const char* aName) : ISurfaceAllocator(aName) {}
|
||||
|
||||
virtual HostIPCAllocator* AsHostIPCAllocator() override { return this; }
|
||||
|
||||
/**
|
||||
|
@ -165,6 +171,7 @@ protected:
|
|||
class CompositorBridgeParentIPCAllocator : public HostIPCAllocator
|
||||
{
|
||||
public:
|
||||
CompositorBridgeParentIPCAllocator(const char* aName) : HostIPCAllocator(aName) {}
|
||||
virtual void NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -481,7 +481,8 @@ static void ConnectImageBridge(ImageBridgeChild * child, ImageBridgeParent * par
|
|||
}
|
||||
|
||||
ImageBridgeChild::ImageBridgeChild()
|
||||
: mShuttingDown(false)
|
||||
: CompositableForwarder("ImageBridgeChild")
|
||||
, mShuttingDown(false)
|
||||
, mFwdTransactionId(0)
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
, mWaitingFenceHandleMutex("ImageBridgeChild::mWaitingFenceHandleMutex")
|
||||
|
|
|
@ -53,7 +53,8 @@ CompositorThreadHolder* GetCompositorThreadHolder();
|
|||
ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
|
||||
Transport* aTransport,
|
||||
ProcessId aChildProcessId)
|
||||
: mMessageLoop(aLoop)
|
||||
: CompositableParentManager("ImageBridgeParent")
|
||||
, mMessageLoop(aLoop)
|
||||
, mTransport(aTransport)
|
||||
, mSetChildThreadPriority(false)
|
||||
, mClosed(false)
|
||||
|
|
|
@ -146,7 +146,8 @@ ShadowChild(const OpRaiseToTopChild& op)
|
|||
LayerTransactionParent::LayerTransactionParent(LayerManagerComposite* aManager,
|
||||
ShadowLayersManager* aLayersManager,
|
||||
uint64_t aId)
|
||||
: mLayerManager(aManager)
|
||||
: CompositableParentManager("LayerTransactionParent")
|
||||
, mLayerManager(aManager)
|
||||
, mShadowLayersManager(aLayersManager)
|
||||
, mId(aId)
|
||||
, mPendingTransaction(0)
|
||||
|
@ -154,12 +155,10 @@ LayerTransactionParent::LayerTransactionParent(LayerManagerComposite* aManager,
|
|||
, mDestroyed(false)
|
||||
, mIPCOpen(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(LayerTransactionParent);
|
||||
}
|
||||
|
||||
LayerTransactionParent::~LayerTransactionParent()
|
||||
{
|
||||
MOZ_COUNT_DTOR(LayerTransactionParent);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -385,7 +385,8 @@ CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIden
|
|||
}
|
||||
|
||||
ShadowLayerForwarder::ShadowLayerForwarder(ClientLayerManager* aClientLayerManager)
|
||||
: mClientLayerManager(aClientLayerManager)
|
||||
: CompositableForwarder("ShadowLayerForwarder")
|
||||
, mClientLayerManager(aClientLayerManager)
|
||||
, mMessageLoop(MessageLoop::current())
|
||||
, mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
|
||||
, mIsFirstPaint(false)
|
||||
|
|
Загрузка…
Ссылка в новой задаче