Backed out changesets ddbac34527fe and fa82f32d0c39 (bug 991812) for B2G bustage.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-04-14 16:16:18 -04:00
parent 983249072a
commit 98cf3141ca
39 changed files with 204 additions and 215 deletions

View File

@ -23,13 +23,11 @@ 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 MOZ_FINAL {
~MediaTaskQueue();
class MediaTaskQueue : public AtomicRefCounted<MediaTaskQueue> {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaTaskQueue)
MOZ_DECLARE_REFCOUNTED_TYPENAME(MediaTaskQueue)
MediaTaskQueue(TemporaryRef<SharedThreadPool> aPool);
~MediaTaskQueue();
nsresult Dispatch(nsIRunnable* aRunnable);

View File

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

View File

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

View File

@ -8,7 +8,7 @@
#define mozilla_dom_bluetooth_bluetoothprofilecontroller_h__
#include "BluetoothUuid.h"
#include "nsISupportsImpl.h"
#include "mozilla/RefPtr.h"
#include "nsAutoPtr.h"
#include "nsITimer.h"
@ -57,12 +57,10 @@ class BluetoothProfileManagerBase;
class BluetoothReplyRunnable;
typedef void (*BluetoothProfileControllerCallback)();
class BluetoothProfileController MOZ_FINAL
class BluetoothProfileController : public RefCounted<BluetoothProfileController>
{
~BluetoothProfileController();
public:
NS_INLINE_DECL_REFCOUNTING(BluetoothProfileController)
MOZ_DECLARE_REFCOUNTED_TYPENAME(BluetoothProfileController)
/**
* @param aConnect: If it's a connect request, the value should be set
* to true. For disconnect request, set it to false.
@ -85,6 +83,7 @@ public:
BluetoothProfileControllerCallback aCallback,
uint16_t aServiceUuid,
uint32_t aCod = 0);
~BluetoothProfileController();
/**
* The controller starts connecting/disconnecting profiles one by one

View File

@ -19,6 +19,8 @@
#include "DeviceStorageFileDescriptor.h"
#include "CameraControlListener.h"
class DeviceStorageFileDescriptor;
namespace mozilla {
namespace layers {

View File

@ -10,7 +10,7 @@
#include "nsAutoPtr.h"
#include "nsISupportsImpl.h"
struct DeviceStorageFileDescriptor;
class DeviceStorageFileDescriptor;
class nsIFile;

View File

@ -321,7 +321,13 @@ private:
friend class WatchFileEvent;
friend class DeviceStorageRequest;
static mozilla::StaticAutoPtr<nsTArray<nsString>> sVolumeNameCache;
class VolumeNameCache : public mozilla::RefCounted<VolumeNameCache>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeNameCache)
nsTArray<nsString> mVolumeNames;
};
static mozilla::StaticRefPtr<VolumeNameCache> sVolumeNameCache;
#ifdef MOZ_WIDGET_GONK
nsString mLastStatus;

View File

@ -9,9 +9,11 @@
#include "mozilla/ipc/FileDescriptor.h"
struct DeviceStorageFileDescriptor MOZ_FINAL
class DeviceStorageFileDescriptor MOZ_FINAL
: public mozilla::RefCounted<DeviceStorageFileDescriptor>
{
NS_INLINE_DECL_REFCOUNTING(DeviceStorageFileDescriptor)
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DeviceStorageFileDescriptor)
nsRefPtr<DeviceStorageFile> mDSFile;
mozilla::ipc::FileDescriptor mFileDescriptor;
};

View File

@ -9,7 +9,7 @@
#include "mozilla/dom/devicestorage/PDeviceStorageRequestChild.h"
class DeviceStorageFile;
struct DeviceStorageFileDescriptor;
class DeviceStorageFileDescriptor;
namespace mozilla {
namespace dom {

View File

@ -115,16 +115,15 @@ DeviceStorageUsedSpaceCache::CreateOrGet()
return sDeviceStorageUsedSpaceCache;
}
already_AddRefed<DeviceStorageUsedSpaceCache::CacheEntry>
TemporaryRef<DeviceStorageUsedSpaceCache::CacheEntry>
DeviceStorageUsedSpaceCache::GetCacheEntry(const nsAString& aStorageName)
{
nsTArray<nsRefPtr<CacheEntry>>::size_type numEntries = mCacheEntries.Length();
nsTArray<nsRefPtr<CacheEntry>>::index_type i;
nsTArray<RefPtr<CacheEntry> >::size_type numEntries = mCacheEntries.Length();
nsTArray<RefPtr<CacheEntry> >::index_type i;
for (i = 0; i < numEntries; i++) {
nsRefPtr<CacheEntry>& cacheEntry = mCacheEntries[i];
RefPtr<CacheEntry> cacheEntry = mCacheEntries[i];
if (cacheEntry->mStorageName.Equals(aStorageName)) {
nsRefPtr<CacheEntry> addRefedCacheEntry = cacheEntry;
return addRefedCacheEntry.forget();
return cacheEntry;
}
}
return nullptr;
@ -150,7 +149,7 @@ DeviceStorageUsedSpaceCache::AccumUsedSizes(const nsAString& aStorageName,
uint64_t* aMusicSoFar,
uint64_t* aTotalSoFar)
{
nsRefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
RefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
if (!cacheEntry || cacheEntry->mDirty) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -175,7 +174,7 @@ DeviceStorageUsedSpaceCache::SetUsedSizes(const nsAString& aStorageName,
uint64_t aMusicSize,
uint64_t aTotalUsedSize)
{
nsRefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
RefPtr<CacheEntry> cacheEntry = GetCacheEntry(aStorageName);
if (!cacheEntry) {
cacheEntry = new CacheEntry;
cacheEntry->mStorageName = aStorageName;
@ -190,10 +189,10 @@ DeviceStorageUsedSpaceCache::SetUsedSizes(const nsAString& aStorageName,
cacheEntry->mDirty = false;
}
class GlobalDirs
class GlobalDirs : public RefCounted<GlobalDirs>
{
public:
NS_INLINE_DECL_REFCOUNTING(GlobalDirs)
MOZ_DECLARE_REFCOUNTED_TYPENAME(GlobalDirs)
#if !defined(MOZ_WIDGET_GONK)
nsCOMPtr<nsIFile> pictures;
nsCOMPtr<nsIFile> videos;
@ -3180,15 +3179,16 @@ nsDOMDeviceStorage::Shutdown()
obs->RemoveObserver(this, "disk-space-watcher");
}
StaticAutoPtr<nsTArray<nsString>> nsDOMDeviceStorage::sVolumeNameCache;
StaticRefPtr<nsDOMDeviceStorage::VolumeNameCache>
nsDOMDeviceStorage::sVolumeNameCache;
// static
void
nsDOMDeviceStorage::GetOrderedVolumeNames(
nsDOMDeviceStorage::VolumeNameArray &aVolumeNames)
{
if (sVolumeNameCache && sVolumeNameCache->Length() > 0) {
aVolumeNames.AppendElements(*sVolumeNameCache);
if (sVolumeNameCache && sVolumeNameCache->mVolumeNames.Length() > 0) {
aVolumeNames.AppendElements(sVolumeNameCache->mVolumeNames);
return;
}
#ifdef MOZ_WIDGET_GONK
@ -3209,8 +3209,8 @@ nsDOMDeviceStorage::GetOrderedVolumeNames(
if (aVolumeNames.IsEmpty()) {
aVolumeNames.AppendElement(EmptyString());
}
sVolumeNameCache = new nsTArray<nsString>;
sVolumeNameCache->AppendElements(aVolumeNames);
sVolumeNameCache = new VolumeNameCache;
sVolumeNameCache->mVolumeNames.AppendElements(aVolumeNames);
}
// static

View File

@ -29,6 +29,7 @@ class nsPIDOMWindow;
#include "prtime.h"
#include "DeviceStorage.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
#include "mozilla/RefPtr.h"
#include "mozilla/StaticPtr.h"
namespace mozilla {
@ -79,7 +80,7 @@ public:
NS_IMETHOD Run() MOZ_OVERRIDE
{
nsRefPtr<DeviceStorageUsedSpaceCache::CacheEntry> cacheEntry;
mozilla::RefPtr<DeviceStorageUsedSpaceCache::CacheEntry> cacheEntry;
cacheEntry = mCache->GetCacheEntry(mStorageName);
if (cacheEntry) {
cacheEntry->mDirty = true;
@ -119,10 +120,10 @@ public:
private:
friend class InvalidateRunnable;
struct CacheEntry
class CacheEntry : public mozilla::RefCounted<CacheEntry>
{
NS_INLINE_DECL_REFCOUNTING(DeviceStorageUsedSpaceCache::CacheEntry)
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DeviceStorageUsedSpaceCache::CacheEntry)
bool mDirty;
nsString mStorageName;
int64_t mFreeBytes;
@ -131,9 +132,9 @@ private:
uint64_t mMusicUsedSize;
uint64_t mTotalUsedSize;
};
already_AddRefed<CacheEntry> GetCacheEntry(const nsAString& aStorageName);
mozilla::TemporaryRef<CacheEntry> GetCacheEntry(const nsAString& aStorageName);
nsTArray<nsRefPtr<CacheEntry>> mCacheEntries;
nsTArray<mozilla::RefPtr<CacheEntry> > mCacheEntries;
nsCOMPtr<nsIThread> mIOThread;

View File

@ -12,7 +12,7 @@ interface nsIDOMEventListener;
interface nsIFile;
%{C++
struct DeviceStorageFileDescriptor;
class DeviceStorageFileDescriptor;
%}
[ptr] native DeviceStorageFdPtr(DeviceStorageFileDescriptor);

View File

@ -163,12 +163,12 @@ private:
/***************************************************************************/
class AutoMounter
class AutoMounter : public RefCounted<AutoMounter>
{
public:
NS_INLINE_DECL_REFCOUNTING(AutoMounter)
MOZ_DECLARE_REFCOUNTED_TYPENAME(AutoMounter)
typedef nsTArray<nsRefPtr<Volume>> VolumeArray;
typedef nsTArray<RefPtr<Volume> > VolumeArray;
AutoMounter()
: mResponseCallback(new AutoMounterResponseCallback),
@ -180,7 +180,7 @@ public:
VolumeManager::VolumeArray::size_type numVolumes = VolumeManager::NumVolumes();
VolumeManager::VolumeArray::index_type i;
for (i = 0; i < numVolumes; i++) {
nsRefPtr<Volume> vol = VolumeManager::GetVolume(i);
RefPtr<Volume> vol = VolumeManager::GetVolume(i);
if (vol) {
vol->RegisterObserver(&mVolumeEventObserver);
// We need to pick up the intial value of the
@ -198,7 +198,7 @@ public:
VolumeManager::VolumeArray::size_type numVolumes = VolumeManager::NumVolumes();
VolumeManager::VolumeArray::index_type volIndex;
for (volIndex = 0; volIndex < numVolumes; volIndex++) {
nsRefPtr<Volume> vol = VolumeManager::GetVolume(volIndex);
RefPtr<Volume> vol = VolumeManager::GetVolume(volIndex);
if (vol) {
vol->UnregisterObserver(&mVolumeEventObserver);
}
@ -252,7 +252,7 @@ public:
void SetSharingMode(const nsACString& aVolumeName, bool aAllowSharing)
{
nsRefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
if (!vol) {
return;
}
@ -269,7 +269,7 @@ public:
void FormatVolume(const nsACString& aVolumeName)
{
nsRefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
if (!vol) {
return;
}
@ -286,7 +286,7 @@ public:
void MountVolume(const nsACString& aVolumeName)
{
nsRefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
if (!vol) {
return;
}
@ -302,7 +302,7 @@ public:
void UnmountVolume(const nsACString& aVolumeName)
{
nsRefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
if (!vol) {
return;
}
@ -449,7 +449,7 @@ AutoMounter::UpdateState()
VolumeArray::index_type volIndex;
VolumeArray::size_type numVolumes = VolumeManager::NumVolumes();
for (volIndex = 0; volIndex < numVolumes; volIndex++) {
nsRefPtr<Volume> vol = VolumeManager::GetVolume(volIndex);
RefPtr<Volume> vol = VolumeManager::GetVolume(volIndex);
Volume::STATE volState = vol->State();
if (vol->State() == nsIVolume::STATE_MOUNTED) {
@ -692,21 +692,21 @@ UsbCableEventIOThread()
*
**************************************************************************/
class UsbCableObserver MOZ_FINAL : public SwitchObserver
class UsbCableObserver : public SwitchObserver,
public RefCounted<UsbCableObserver>
{
~UsbCableObserver()
{
UnregisterSwitchObserver(SWITCH_USB, this);
}
public:
NS_INLINE_DECL_REFCOUNTING(UsbCableObserver)
MOZ_DECLARE_REFCOUNTED_TYPENAME(UsbCableObserver)
UsbCableObserver()
{
RegisterSwitchObserver(SWITCH_USB, this);
}
~UsbCableObserver()
{
UnregisterSwitchObserver(SWITCH_USB, this);
}
virtual void Notify(const SwitchEvent& aEvent)
{
DBG("UsbCable switch device: %d state: %s\n",

View File

@ -9,7 +9,7 @@
#include "nsIVolume.h"
#include "nsString.h"
#include "mozilla/Observer.h"
#include "nsISupportsImpl.h"
#include "mozilla/RefPtr.h"
#include "nsWhitespaceTokenizer.h"
namespace mozilla {
@ -24,11 +24,10 @@ namespace system {
*
***************************************************************************/
class Volume MOZ_FINAL
class Volume : public RefCounted<Volume>
{
public:
NS_INLINE_DECL_REFCOUNTING(Volume)
MOZ_DECLARE_REFCOUNTED_TYPENAME(Volume)
Volume(const nsCSubstring& aVolumeName);
typedef long STATE; // States are now defined in nsIVolume.idl

View File

@ -6,7 +6,6 @@
#define mozilla_system_volumecommand_h__
#include "nsString.h"
#include "nsISupportsImpl.h"
#include "mozilla/RefPtr.h"
#include <algorithm>
#include <vold/ResponseCode.h>
@ -33,16 +32,15 @@ class VolumeCommand;
*
***************************************************************************/
class VolumeResponseCallback
class VolumeResponseCallback : public RefCounted<VolumeResponseCallback>
{
protected:
virtual ~VolumeResponseCallback() {}
public:
NS_INLINE_DECL_REFCOUNTED(VolumeResponseCallback)
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeResponseCallback)
VolumeResponseCallback()
: mResponseCode(0), mPending(false) {}
virtual ~VolumeResponseCallback() {}
bool Done() const
{
// Response codes from the 200, 400, and 500 series all indicated that
@ -108,14 +106,10 @@ private:
*
***************************************************************************/
class VolumeCommand
class VolumeCommand : public RefCounted<VolumeCommand>
{
protected:
virtual ~VolumeCommand() {}
public:
NS_INLINE_DECL_REFCOUNTED(VolumeCommand)
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeCommand)
VolumeCommand(VolumeResponseCallback* aCallback)
: mBytesConsumed(0),
mCallback(aCallback)
@ -130,6 +124,8 @@ public:
SetCmd(aCommand);
}
virtual ~VolumeCommand() {}
void SetCmd(const nsACString& aCommand)
{
mCmd.Truncate();

View File

@ -11,7 +11,7 @@
#include "base/message_loop.h"
#include "mozilla/FileUtils.h"
#include "mozilla/Observer.h"
#include "nsISupportsImpl.h"
#include "mozilla/RefPtr.h"
#include "nsString.h"
#include "nsTArray.h"
@ -73,16 +73,16 @@ namespace system {
*
***************************************************************************/
class VolumeManager MOZ_FINAL : public MessageLoopForIO::LineWatcher
class VolumeManager : public MessageLoopForIO::LineWatcher,
public RefCounted<VolumeManager>
{
virtual ~VolumeManager();
public:
NS_INLINE_DECL_REFCOUNTING(VolumeManager)
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeManager)
typedef nsTArray<RefPtr<Volume>> VolumeArray;
typedef nsTArray<RefPtr<Volume> > VolumeArray;
VolumeManager();
virtual ~VolumeManager();
//-----------------------------------------------------------------------
//

View File

@ -19,14 +19,13 @@ class nsVolumeService;
* class, but whose methods are called from IOThread.
*/
class VolumeServiceIOThread : public VolumeManager::StateObserver,
public Volume::EventObserver
public Volume::EventObserver,
public RefCounted<VolumeServiceIOThread>
{
~VolumeServiceIOThread();
public:
NS_INLINE_DECL_REFCOUNTING(VolumeServiceIOThread)
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeServiceIOThread)
VolumeServiceIOThread(nsVolumeService* aVolumeService);
~VolumeServiceIOThread();
private:
void UpdateAllVolumes();

View File

@ -137,12 +137,18 @@ enum SurfaceInitMode
/**
* A base class for a platform-dependent helper for use by TextureHost.
*/
class CompositorBackendSpecificData
class CompositorBackendSpecificData : public RefCounted<CompositorBackendSpecificData>
{
NS_INLINE_DECL_REFCOUNTING(CompositorBackendSpecificData)
protected:
virtual ~CompositorBackendSpecificData() {}
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositorBackendSpecificData)
CompositorBackendSpecificData()
{
MOZ_COUNT_CTOR(CompositorBackendSpecificData);
}
virtual ~CompositorBackendSpecificData()
{
MOZ_COUNT_DTOR(CompositorBackendSpecificData);
}
};
/**
@ -189,20 +195,21 @@ protected:
* The target and viewport methods can be called before any DrawQuad call and
* affect any subsequent DrawQuad calls.
*/
class Compositor
class Compositor : public RefCounted<Compositor>
{
protected:
virtual ~Compositor() {}
public:
NS_INLINE_DECL_REFCOUNTING(Compositor)
MOZ_DECLARE_REFCOUNTED_TYPENAME(Compositor)
Compositor(PCompositorParent* aParent = nullptr)
: mCompositorID(0)
, mDiagnosticTypes(DIAGNOSTIC_NONE)
, mParent(aParent)
, mScreenRotation(ROTATION_0)
{
MOZ_COUNT_CTOR(Compositor);
}
virtual ~Compositor()
{
MOZ_COUNT_DTOR(Compositor);
}
virtual TemporaryRef<DataTextureSource> CreateDataTextureSource(TextureFlags aFlags = 0) = 0;

View File

@ -37,18 +37,15 @@ namespace layers {
* to the compositor by the compositable host as a parameter to DrawQuad.
*/
struct Effect
struct Effect : public RefCounted<Effect>
{
NS_INLINE_DECL_REFCOUNTING(Effect)
MOZ_DECLARE_REFCOUNTED_TYPENAME(Effect)
Effect(EffectTypes aType) : mType(aType) {}
EffectTypes mType;
virtual void PrintInfo(nsACString& aTo, const char* aPrefix) = 0;
protected:
virtual ~Effect() {}
virtual void PrintInfo(nsACString& aTo, const char* aPrefix) =0;
};
// Render from a texture

View File

@ -68,16 +68,14 @@ 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
class CompositableClient : public AtomicRefCounted<CompositableClient>
{
protected:
virtual ~CompositableClient();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositableClient)
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableClient)
CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = 0);
virtual ~CompositableClient();
virtual TextureInfo GetTextureInfo() const = 0;
LayersBackend GetCompositorBackendType() const;

View File

@ -19,8 +19,14 @@ namespace layers {
class ISurfaceAllocator;
class SimpleTextureClientPool
class SimpleTextureClientPool : public RefCounted<SimpleTextureClientPool>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SimpleTextureClientPool)
SimpleTextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
ISurfaceAllocator *aAllocator);
~SimpleTextureClientPool()
{
for (auto it = mOutstandingTextureClients.begin(); it != mOutstandingTextureClients.end(); ++it) {
@ -28,12 +34,6 @@ class SimpleTextureClientPool
}
}
public:
NS_INLINE_DECL_REFCOUNTING(SimpleTextureClientPool)
SimpleTextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
ISurfaceAllocator *aAllocator);
/**
* If a TextureClient is AutoRecycled, when the last reference is
* released this object will be automatically return to the pool as

View File

@ -75,17 +75,23 @@ namespace layers {
* TextureClient's data until the compositor side confirmed that it is safe to
* deallocte or recycle the it.
*/
class TextureChild MOZ_FINAL : public PTextureChild
class TextureChild : public PTextureChild
, public AtomicRefCounted<TextureChild>
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureChild)
MOZ_DECLARE_REFCOUNTED_TYPENAME(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

@ -18,15 +18,13 @@ namespace layers {
class ISurfaceAllocator;
class TextureClientPool MOZ_FINAL
class TextureClientPool : public RefCounted<TextureClientPool>
{
~TextureClientPool();
public:
NS_INLINE_DECL_REFCOUNTING(TextureClientPool)
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureClientPool)
TextureClientPool(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
ISurfaceAllocator *aAllocator);
~TextureClientPool();
/**
* Gets an allocated TextureClient of size and format that are determined

View File

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

View File

@ -61,21 +61,22 @@ struct ViewTransform {
* short circuit that stuff to directly affect layers as they are composited,
* for example, off-main thread animation, async video, async pan/zoom.
*/
class AsyncCompositionManager MOZ_FINAL
class AsyncCompositionManager MOZ_FINAL : public RefCounted<AsyncCompositionManager>
{
friend class AutoResolveRefLayers;
public:
NS_INLINE_DECL_REFCOUNTING(AsyncCompositionManager)
MOZ_DECLARE_REFCOUNTED_TYPENAME(AsyncCompositionManager)
AsyncCompositionManager(LayerManagerComposite* aManager)
: mLayerManager(aManager)
, mIsFirstPaint(false)
, mLayersUpdated(false)
, mReadyForCompose(true)
{
MOZ_COUNT_CTOR(AsyncCompositionManager);
}
~AsyncCompositionManager()
{
MOZ_COUNT_DTOR(AsyncCompositionManager);
}
/**

View File

@ -56,18 +56,18 @@ struct EffectChain;
/**
* A base class for doing CompositableHost and platform dependent task on TextureHost.
*/
class CompositableBackendSpecificData
class CompositableBackendSpecificData : public RefCounted<CompositableBackendSpecificData>
{
protected:
virtual ~CompositableBackendSpecificData() { }
public:
NS_INLINE_DECL_REFCOUNTING(CompositableBackendSpecificData)
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableBackendSpecificData)
CompositableBackendSpecificData()
{
MOZ_COUNT_CTOR(CompositableBackendSpecificData);
}
virtual ~CompositableBackendSpecificData()
{
MOZ_COUNT_DTOR(CompositableBackendSpecificData);
}
virtual void SetCompositor(Compositor* aCompositor) {}
virtual void ClearData()
{
@ -124,15 +124,14 @@ protected:
* will use its TextureHost(s) and call Compositor::DrawQuad to do the actual
* rendering.
*/
class CompositableHost
class CompositableHost : public RefCounted<CompositableHost>
{
protected:
virtual ~CompositableHost();
public:
NS_INLINE_DECL_REFCOUNTING(CompositableHost)
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableHost)
CompositableHost(const TextureInfo& aTextureInfo);
virtual ~CompositableHost();
static TemporaryRef<CompositableHost> Create(const TextureInfo& aTextureInfo);
virtual CompositableType GetType() = 0;

View File

@ -7,7 +7,6 @@
#define GFX_TextRenderer_H
#include "mozilla/gfx/2D.h"
#include "nsISupportsImpl.h"
#include <string>
namespace mozilla {
@ -15,11 +14,10 @@ namespace layers {
class Compositor;
class TextRenderer
class TextRenderer : public RefCounted<TextRenderer>
{
public:
NS_INLINE_DECL_REFCOUNTING(TextRenderer)
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextRenderer)
TextRenderer(Compositor *aCompositor)
: mCompositor(aCompositor)
{

View File

@ -80,15 +80,12 @@ public:
*
* This class is used on the compositor side.
*/
class TextureSource
class TextureSource : public RefCounted<TextureSource>
{
protected:
virtual ~TextureSource();
public:
NS_INLINE_DECL_REFCOUNTING(TextureSource)
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureSource)
TextureSource();
virtual ~TextureSource();
/**
* Return the size of the texture in texels.

View File

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

View File

@ -64,13 +64,12 @@ struct EffectChain;
* This is primarily intended for direct texturing APIs that need to attach
* shared objects (such as an EGLImage) to a gl texture.
*/
class CompositorTexturePoolOGL
class CompositorTexturePoolOGL : public RefCounted<CompositorTexturePoolOGL>
{
protected:
virtual ~CompositorTexturePoolOGL() {}
public:
NS_INLINE_DECL_REFCOUNTING(CompositorTexturePoolOGL)
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositorTexturePoolOGL)
virtual ~CompositorTexturePoolOGL() {}
virtual void Clear() = 0;

View File

@ -230,10 +230,10 @@ namespace FilterWrappers {
// Internally, this is achieved by wrapping the original FilterNode with
// conversion FilterNodes. These filter nodes are cached in such a way that no
// repeated or back-and-forth conversions happen.
class FilterCachedColorModels
class FilterCachedColorModels : public RefCounted<FilterCachedColorModels>
{
public:
NS_INLINE_DECL_REFCOUNTING(FilterCachedColorModels)
MOZ_DECLARE_REFCOUNTED_TYPENAME(FilterCachedColorModels)
// aFilter can be null. In that case, ForColorModel will return a non-null
// completely transparent filter for all color models.
FilterCachedColorModels(DrawTarget* aDT,

View File

@ -294,11 +294,11 @@ public:
} // anonymous namespace
class BatteryObserver : public IUeventObserver
class BatteryObserver : public IUeventObserver,
public RefCounted<BatteryObserver>
{
public:
NS_INLINE_DECL_REFCOUNTING(BatteryObserver)
MOZ_DECLARE_REFCOUNTED_TYPENAME(BatteryObserver)
BatteryObserver()
:mUpdater(new BatteryUpdater())
{

View File

@ -51,11 +51,10 @@ namespace hal_impl {
* SWITCH_STATE=0
* SEQNUM=5038
*/
class SwitchHandler
class SwitchHandler : public RefCounted<SwitchHandler>
{
public:
NS_INLINE_DECL_REFCOUNTING(SwitchHandler)
MOZ_DECLARE_REFCOUNTED_TYPENAME(SwitchHandler)
SwitchHandler(const char* aDevPath, SwitchDevice aDevice)
: mDevPath(aDevPath),
mState(SWITCH_STATE_UNKNOWN),
@ -231,20 +230,21 @@ private:
SwitchEvent mEvent;
};
class SwitchEventObserver MOZ_FINAL : public IUeventObserver
class SwitchEventObserver : public IUeventObserver,
public RefCounted<SwitchEventObserver>
{
~SwitchEventObserver()
{
mHandler.Clear();
}
public:
NS_INLINE_DECL_REFCOUNTING(SwitchEventObserver)
MOZ_DECLARE_REFCOUNTED_TYPENAME(SwitchEventObserver)
SwitchEventObserver() : mEnableCount(0)
{
Init();
}
~SwitchEventObserver()
{
mHandler.Clear();
}
int GetEnableCount()
{
return mEnableCount;

View File

@ -110,11 +110,10 @@ private:
* A CachedSurface associates a surface with a key that uniquely identifies that
* surface.
*/
class CachedSurface
class CachedSurface : public RefCounted<CachedSurface>
{
public:
NS_INLINE_DECL_REFCOUNTING(CachedSurface)
MOZ_DECLARE_REFCOUNTED_TYPENAME(CachedSurface)
CachedSurface(DrawTarget* aTarget,
const IntSize aTargetSize,
const Cost aCost,
@ -157,11 +156,10 @@ private:
* destroyed or invalidated. Since this will happen frequently, it makes sense
* to make it cheap by storing the surfaces for each image separately.
*/
class ImageSurfaceCache
class ImageSurfaceCache : public RefCounted<ImageSurfaceCache>
{
public:
NS_INLINE_DECL_REFCOUNTING(ImageSurfaceCache)
MOZ_DECLARE_REFCOUNTED_TYPENAME(ImageSurfaceCache)
typedef nsRefPtrHashtable<nsGenericHashKey<SurfaceKey>, CachedSurface> SurfaceTable;
bool IsEmpty() const { return mSurfaces.Count() == 0; }

View File

@ -5,7 +5,7 @@
#ifndef mozilla_system_netd_h__
#define mozilla_system_netd_h__
#include "nsISupportsImpl.h"
#include "mozilla/RefPtr.h"
#include "nsAutoPtr.h"
#include "base/message_loop.h"
#include "mozilla/FileUtils.h"
@ -26,14 +26,11 @@ struct NetdCommand
size_t mSize;
};
class NetdConsumer
class NetdConsumer : public mozilla::RefCounted<NetdConsumer>
{
protected:
virtual ~NetdConsumer() { }
public:
NS_INLINE_DECL_REFCOUNTING(NetdConsumer)
MOZ_DECLARE_REFCOUNTED_TYPENAME(NetdConsumer)
virtual ~NetdConsumer() { }
virtual void MessageReceived(NetdCommand* aMessage) = 0;
};
@ -42,15 +39,15 @@ class NetdWriteTask : public Task
virtual void Run();
};
class NetdClient : public MessageLoopForIO::LineWatcher
class NetdClient : public MessageLoopForIO::LineWatcher,
public RefCounted<NetdClient>
{
virtual ~NetdClient();
public:
NS_INLINE_DECL_REFCOUNTING(NetdClient)
MOZ_DECLARE_REFCOUNTED_TYPENAME(NetdClient)
typedef std::queue<NetdCommand*> NetdCommandQueue;
NetdClient();
virtual ~NetdClient();
static void Start();
static void SendNetdCommandIOThread(NetdCommand* aMessage);

View File

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

View File

@ -46,10 +46,9 @@ enum LayerState {
LAYER_SVG_EFFECTS
};
class RefCountedRegion {
class RefCountedRegion : public RefCounted<RefCountedRegion> {
public:
NS_INLINE_DECL_REFCOUNTING(RefCountedRegion)
MOZ_DECLARE_REFCOUNTED_TYPENAME(RefCountedRegion)
RefCountedRegion() : mIsInfinite(false) {}
nsRegion mRegion;
bool mIsInfinite;

View File

@ -11,14 +11,11 @@
namespace mozilla { namespace psm {
class SharedCertVerifier : public mozilla::psm::CertVerifier
class SharedCertVerifier : public mozilla::psm::CertVerifier,
public mozilla::AtomicRefCounted<SharedCertVerifier>
{
protected:
~SharedCertVerifier();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SharedCertVerifier)
MOZ_DECLARE_REFCOUNTED_TYPENAME(SharedCertVerifier)
SharedCertVerifier(implementation_config ic,
#ifndef NSS_NO_LIBPKIX
missing_cert_download_config ac, crl_download_config cdc,
@ -32,6 +29,7 @@ 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
class BackgroundHangManager : public AtomicRefCounted<BackgroundHangManager>
{
private:
// Background hang monitor thread function
@ -62,7 +62,7 @@ private:
void RunMonitorThread();
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BackgroundHangManager)
MOZ_DECLARE_REFCOUNTED_TYPENAME(BackgroundHangManager)
static StaticRefPtr<BackgroundHangManager> sInstance;
// Lock for access to members of this class