mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 897452 - Part 0.1 - Make it possible for TextureClient to call virtual methods just before its destructor. r=bjacob
This commit is contained in:
parent
d7114d0408
commit
fc2a2730d2
@ -111,7 +111,8 @@ ShmemTextureClient::DropTextureData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextureClient::TextureClient(TextureFlags aFlags)
|
TextureClient::TextureClient(TextureFlags aFlags)
|
||||||
: mID(0)
|
: mRefCount(0)
|
||||||
|
, mID(0)
|
||||||
, mFlags(aFlags)
|
, mFlags(aFlags)
|
||||||
, mShared(false)
|
, mShared(false)
|
||||||
, mValid(true)
|
, mValid(true)
|
||||||
|
@ -149,12 +149,28 @@ public:
|
|||||||
* In order to send several different buffers to the compositor side, use
|
* In order to send several different buffers to the compositor side, use
|
||||||
* several TextureClients.
|
* several TextureClients.
|
||||||
*/
|
*/
|
||||||
class TextureClient : public AtomicRefCounted<TextureClient>
|
class TextureClient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextureClient(TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
|
TextureClient(TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
|
||||||
virtual ~TextureClient();
|
virtual ~TextureClient();
|
||||||
|
|
||||||
|
void AddRef() {
|
||||||
|
MOZ_ASSERT(mRefCount >= 0);
|
||||||
|
++mRefCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Release() {
|
||||||
|
MOZ_ASSERT(mRefCount > 0);
|
||||||
|
if (0 == --mRefCount) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
mRefCount = detail::DEAD;
|
||||||
|
#endif
|
||||||
|
Finalize();
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual TextureClientSurface* AsTextureClientSurface() { return nullptr; }
|
virtual TextureClientSurface* AsTextureClientSurface() { return nullptr; }
|
||||||
virtual TextureClientDrawTarget* AsTextureClientDrawTarget() { return nullptr; }
|
virtual TextureClientDrawTarget* AsTextureClientDrawTarget() { return nullptr; }
|
||||||
virtual TextureClientYCbCr* AsTextureClientYCbCr() { return nullptr; }
|
virtual TextureClientYCbCr* AsTextureClientYCbCr() { return nullptr; }
|
||||||
@ -253,6 +269,20 @@ public:
|
|||||||
// method to forget about the shmem _without_ releasing it.
|
// method to forget about the shmem _without_ releasing it.
|
||||||
virtual void OnActorDestroy() {}
|
virtual void OnActorDestroy() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Atomic<int> mRefCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called once, just before the destructor.
|
||||||
|
*
|
||||||
|
* Here goes the shut-down code that uses virtual methods.
|
||||||
|
* Must only be called by Release().
|
||||||
|
*/
|
||||||
|
void Finalize()
|
||||||
|
{
|
||||||
|
// XXX Bug 897452 - Coming soon
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddFlags(TextureFlags aFlags)
|
void AddFlags(TextureFlags aFlags)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user