Bug 991812: Remove uses of AtomicRefCounted<T> that live in Gecko. r=ehsan

--HG--
extra : rebase_source : 0d14e02c64d548fd3177681248d722683aaa87c3
This commit is contained in:
Kyle Huey 2014-04-14 12:04:25 -07:00
parent 384121563d
commit 2c8f15bb95
10 changed files with 48 additions and 43 deletions

View File

@ -23,12 +23,14 @@ class SharedThreadPool;
// they're received, and are guaranteed to not be executed concurrently.
// They may be executed on different threads, and a memory barrier is used
// to make this threadsafe for objects that aren't already threadsafe.
class MediaTaskQueue : public AtomicRefCounted<MediaTaskQueue> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MediaTaskQueue)
MediaTaskQueue(TemporaryRef<SharedThreadPool> aPool);
class MediaTaskQueue MOZ_FINAL {
~MediaTaskQueue();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaTaskQueue)
MediaTaskQueue(TemporaryRef<SharedThreadPool> aPool);
nsresult Dispatch(nsIRunnable* aRunnable);
// Removes all pending tasks from the task queue, and blocks until

View File

@ -143,11 +143,13 @@ public:
// MediaTaskQueue passed into the PlatformDecoderModules's Create*Decoder()
// function. This may not be necessary for platforms with async APIs
// for decoding.
class MediaDataDecoder : public AtomicRefCounted<MediaDataDecoder> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MediaDataDecoder)
class MediaDataDecoder {
protected:
virtual ~MediaDataDecoder() {};
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaDataDecoder)
// Initialize the decoder. The decoder should be ready to decode after
// this returns. The decoder should do any initialization here, rather
// than in its constructor or PlatformDecoderModule::Create*Decoder(),

View File

@ -14,12 +14,14 @@
namespace mozilla {
class MFTDecoder : public AtomicRefCounted<MFTDecoder> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MTFDecoder)
MFTDecoder();
class MFTDecoder MOZ_FINAL {
~MFTDecoder();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MFTDecoder)
MFTDecoder();
// Creates the MFT. First thing to do as part of setup.
//
// Params:

View File

@ -68,14 +68,16 @@ class TextureClientData;
* where we have a different way of interfacing with the textures - in terms of
* drawing into the compositable and/or passing its contents to the compostior.
*/
class CompositableClient : public AtomicRefCounted<CompositableClient>
class CompositableClient
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableClient)
CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = 0);
protected:
virtual ~CompositableClient();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositableClient)
CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = 0);
virtual TextureInfo GetTextureInfo() const = 0;
LayersBackend GetCompositorBackendType() const;

View File

@ -75,23 +75,17 @@ namespace layers {
* TextureClient's data until the compositor side confirmed that it is safe to
* deallocte or recycle the it.
*/
class TextureChild : public PTextureChild
, public AtomicRefCounted<TextureChild>
class TextureChild MOZ_FINAL : public PTextureChild
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureChild)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureChild)
TextureChild()
: mForwarder(nullptr)
, mTextureData(nullptr)
, mTextureClient(nullptr)
, mIPCOpen(false)
{
MOZ_COUNT_CTOR(TextureChild);
}
~TextureChild()
{
MOZ_COUNT_DTOR(TextureChild);
}
bool Recv__delete__() MOZ_OVERRIDE;

View File

@ -47,11 +47,13 @@ class ClientLayerManager;
// A class to help implement copy-on-write semantics for shared tiles.
class gfxSharedReadLock : public AtomicRefCounted<gfxSharedReadLock> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(gfxSharedReadLock)
class gfxSharedReadLock {
protected:
virtual ~gfxSharedReadLock() {}
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxSharedReadLock)
virtual int32_t ReadLock() = 0;
virtual int32_t ReadUnlock() = 0;
virtual int32_t GetReadCount() = 0;

View File

@ -23,10 +23,9 @@ class RenderFrameChild;
namespace layers {
class LayerTransactionChild : public PLayerTransactionChild
, public AtomicRefCounted<LayerTransactionChild>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(LayerTransactionChild)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(LayerTransactionChild)
/**
* Clean this up, finishing with Send__delete__().
*
@ -43,8 +42,6 @@ protected:
: mIPCOpen(false)
{}
~LayerTransactionChild() { }
friend class AtomicRefCounted<LayerTransactionChild>;
friend class detail::RefCounted<LayerTransactionChild, detail::AtomicRefCount>;
virtual PGrallocBufferChild*
AllocPGrallocBufferChild(const IntSize&,

View File

@ -135,14 +135,16 @@ enum SocketConnectionStatus {
SOCKET_CONNECTED = 3
};
class UnixSocketConsumer : public AtomicRefCounted<UnixSocketConsumer>
class UnixSocketConsumer
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(UnixSocketConsumer)
UnixSocketConsumer();
protected:
virtual ~UnixSocketConsumer();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(UnixSocketConsumer)
UnixSocketConsumer();
SocketConnectionStatus GetConnectionStatus() const
{
MOZ_ASSERT(NS_IsMainThread());

View File

@ -11,11 +11,14 @@
namespace mozilla { namespace psm {
class SharedCertVerifier : public mozilla::psm::CertVerifier,
public mozilla::AtomicRefCounted<SharedCertVerifier>
class SharedCertVerifier : public mozilla::psm::CertVerifier
{
protected:
~SharedCertVerifier();
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SharedCertVerifier)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedCertVerifier)
SharedCertVerifier(implementation_config ic,
#ifndef NSS_NO_LIBPKIX
missing_cert_download_config ac, crl_download_config cdc,
@ -29,7 +32,6 @@ public:
odc, osc, ogc)
{
}
~SharedCertVerifier();
};
} } // namespace mozilla::psm

View File

@ -28,7 +28,7 @@ namespace mozilla {
* BackgroundHangManager is the global object that
* manages all instances of BackgroundHangThread.
*/
class BackgroundHangManager : public AtomicRefCounted<BackgroundHangManager>
class BackgroundHangManager
{
private:
// Background hang monitor thread function
@ -62,7 +62,7 @@ private:
void RunMonitorThread();
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(BackgroundHangManager)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BackgroundHangManager)
static StaticRefPtr<BackgroundHangManager> sInstance;
// Lock for access to members of this class