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

--HG--
extra : rebase_source : 239ff77ec3765a3f190ed75b1645c6011e5d1dbd
This commit is contained in:
Kyle Huey 2014-04-14 12:04:24 -07:00
parent c0e2e8d723
commit 4b25f94dc9
30 changed files with 178 additions and 171 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -163,12 +163,12 @@ private:
/***************************************************************************/
class AutoMounter : public RefCounted<AutoMounter>
class AutoMounter
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(AutoMounter)
NS_INLINE_DECL_REFCOUNTING(AutoMounter)
typedef nsTArray<RefPtr<Volume> > VolumeArray;
typedef nsTArray<nsRefPtr<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++) {
RefPtr<Volume> vol = VolumeManager::GetVolume(i);
nsRefPtr<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++) {
RefPtr<Volume> vol = VolumeManager::GetVolume(volIndex);
nsRefPtr<Volume> vol = VolumeManager::GetVolume(volIndex);
if (vol) {
vol->UnregisterObserver(&mVolumeEventObserver);
}
@ -252,7 +252,7 @@ public:
void SetSharingMode(const nsACString& aVolumeName, bool aAllowSharing)
{
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
nsRefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
if (!vol) {
return;
}
@ -269,7 +269,7 @@ public:
void FormatVolume(const nsACString& aVolumeName)
{
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
nsRefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
if (!vol) {
return;
}
@ -286,7 +286,7 @@ public:
void MountVolume(const nsACString& aVolumeName)
{
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
nsRefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
if (!vol) {
return;
}
@ -302,7 +302,7 @@ public:
void UnmountVolume(const nsACString& aVolumeName)
{
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
nsRefPtr<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++) {
RefPtr<Volume> vol = VolumeManager::GetVolume(volIndex);
nsRefPtr<Volume> vol = VolumeManager::GetVolume(volIndex);
Volume::STATE volState = vol->State();
if (vol->State() == nsIVolume::STATE_MOUNTED) {
@ -692,21 +692,21 @@ UsbCableEventIOThread()
*
**************************************************************************/
class UsbCableObserver : public SwitchObserver,
public RefCounted<UsbCableObserver>
class UsbCableObserver MOZ_FINAL : public SwitchObserver
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(UsbCableObserver)
UsbCableObserver()
{
RegisterSwitchObserver(SWITCH_USB, this);
}
~UsbCableObserver()
{
UnregisterSwitchObserver(SWITCH_USB, this);
}
public:
NS_INLINE_DECL_REFCOUNTING(UsbCableObserver)
UsbCableObserver()
{
RegisterSwitchObserver(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 "mozilla/RefPtr.h"
#include "nsISupportsImpl.h"
#include "nsWhitespaceTokenizer.h"
namespace mozilla {
@ -24,10 +24,11 @@ namespace system {
*
***************************************************************************/
class Volume : public RefCounted<Volume>
class Volume MOZ_FINAL
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(Volume)
NS_INLINE_DECL_REFCOUNTING(Volume)
Volume(const nsCSubstring& aVolumeName);
typedef long STATE; // States are now defined in nsIVolume.idl

View File

@ -6,6 +6,7 @@
#define mozilla_system_volumecommand_h__
#include "nsString.h"
#include "nsISupportsImpl.h"
#include "mozilla/RefPtr.h"
#include <algorithm>
#include <vold/ResponseCode.h>
@ -32,15 +33,16 @@ class VolumeCommand;
*
***************************************************************************/
class VolumeResponseCallback : public RefCounted<VolumeResponseCallback>
class VolumeResponseCallback
{
protected:
virtual ~VolumeResponseCallback() {}
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeResponseCallback)
NS_INLINE_DECL_REFCOUNTED(VolumeResponseCallback)
VolumeResponseCallback()
: mResponseCode(0), mPending(false) {}
virtual ~VolumeResponseCallback() {}
bool Done() const
{
// Response codes from the 200, 400, and 500 series all indicated that
@ -106,10 +108,14 @@ private:
*
***************************************************************************/
class VolumeCommand : public RefCounted<VolumeCommand>
class VolumeCommand
{
protected:
virtual ~VolumeCommand() {}
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeCommand)
NS_INLINE_DECL_REFCOUNTED(VolumeCommand)
VolumeCommand(VolumeResponseCallback* aCallback)
: mBytesConsumed(0),
mCallback(aCallback)
@ -124,8 +130,6 @@ 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 "mozilla/RefPtr.h"
#include "nsISupportsImpl.h"
#include "nsString.h"
#include "nsTArray.h"
@ -73,16 +73,16 @@ namespace system {
*
***************************************************************************/
class VolumeManager : public MessageLoopForIO::LineWatcher,
public RefCounted<VolumeManager>
class VolumeManager MOZ_FINAL : public MessageLoopForIO::LineWatcher
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeManager)
virtual ~VolumeManager();
typedef nsTArray<RefPtr<Volume> > VolumeArray;
public:
NS_INLINE_DECL_REFCOUNTING(VolumeManager)
typedef nsTArray<RefPtr<Volume>> VolumeArray;
VolumeManager();
virtual ~VolumeManager();
//-----------------------------------------------------------------------
//

View File

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

View File

@ -137,18 +137,12 @@ enum SurfaceInitMode
/**
* A base class for a platform-dependent helper for use by TextureHost.
*/
class CompositorBackendSpecificData : public RefCounted<CompositorBackendSpecificData>
class CompositorBackendSpecificData
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositorBackendSpecificData)
CompositorBackendSpecificData()
{
MOZ_COUNT_CTOR(CompositorBackendSpecificData);
}
virtual ~CompositorBackendSpecificData()
{
MOZ_COUNT_DTOR(CompositorBackendSpecificData);
}
NS_INLINE_DECL_REFCOUNTING(CompositorBackendSpecificData)
protected:
virtual ~CompositorBackendSpecificData() {}
};
/**
@ -195,21 +189,20 @@ public:
* The target and viewport methods can be called before any DrawQuad call and
* affect any subsequent DrawQuad calls.
*/
class Compositor : public RefCounted<Compositor>
class Compositor
{
protected:
virtual ~Compositor() {}
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(Compositor)
NS_INLINE_DECL_REFCOUNTING(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,15 +37,18 @@ namespace layers {
* to the compositor by the compositable host as a parameter to DrawQuad.
*/
struct Effect : public RefCounted<Effect>
struct Effect
{
MOZ_DECLARE_REFCOUNTED_TYPENAME(Effect)
NS_INLINE_DECL_REFCOUNTING(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

@ -19,14 +19,8 @@ namespace layers {
class ISurfaceAllocator;
class SimpleTextureClientPool : public RefCounted<SimpleTextureClientPool>
class 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) {
@ -34,6 +28,12 @@ public:
}
}
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

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

View File

@ -61,22 +61,21 @@ 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 : public RefCounted<AsyncCompositionManager>
class AsyncCompositionManager MOZ_FINAL
{
friend class AutoResolveRefLayers;
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(AsyncCompositionManager)
NS_INLINE_DECL_REFCOUNTING(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 : public RefCounted<CompositableBackendSpecificData>
class CompositableBackendSpecificData
{
protected:
virtual ~CompositableBackendSpecificData() { }
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableBackendSpecificData)
NS_INLINE_DECL_REFCOUNTING(CompositableBackendSpecificData)
CompositableBackendSpecificData()
{
MOZ_COUNT_CTOR(CompositableBackendSpecificData);
}
virtual ~CompositableBackendSpecificData()
{
MOZ_COUNT_DTOR(CompositableBackendSpecificData);
}
virtual void SetCompositor(Compositor* aCompositor) {}
virtual void ClearData()
{
@ -124,14 +124,15 @@ protected:
* will use its TextureHost(s) and call Compositor::DrawQuad to do the actual
* rendering.
*/
class CompositableHost : public RefCounted<CompositableHost>
class CompositableHost
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableHost)
CompositableHost(const TextureInfo& aTextureInfo);
protected:
virtual ~CompositableHost();
public:
NS_INLINE_DECL_REFCOUNTING(CompositableHost)
CompositableHost(const TextureInfo& aTextureInfo);
static TemporaryRef<CompositableHost> Create(const TextureInfo& aTextureInfo);
virtual CompositableType GetType() = 0;

View File

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

View File

@ -80,13 +80,16 @@ public:
*
* This class is used on the compositor side.
*/
class TextureSource : public RefCounted<TextureSource>
class TextureSource
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureSource)
TextureSource();
protected:
virtual ~TextureSource();
public:
NS_INLINE_DECL_REFCOUNTING(TextureSource)
TextureSource();
/**
* Return the size of the texture in texels.
* If this is a tile iterator, GetSize must return the size of the current tile.

View File

@ -64,13 +64,14 @@ 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 : public RefCounted<CompositorTexturePoolOGL>
class CompositorTexturePoolOGL
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositorTexturePoolOGL)
protected:
virtual ~CompositorTexturePoolOGL() {}
public:
NS_INLINE_DECL_REFCOUNTING(CompositorTexturePoolOGL)
virtual void Clear() = 0;
virtual GLuint GetTexture(GLenum aTarget, GLenum aEnum) = 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 : public RefCounted<FilterCachedColorModels>
class FilterCachedColorModels
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(FilterCachedColorModels)
NS_INLINE_DECL_REFCOUNTING(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,
public RefCounted<BatteryObserver>
class BatteryObserver : public IUeventObserver
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(BatteryObserver)
NS_INLINE_DECL_REFCOUNTING(BatteryObserver)
BatteryObserver()
:mUpdater(new BatteryUpdater())
{

View File

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

View File

@ -110,10 +110,11 @@ private:
* A CachedSurface associates a surface with a key that uniquely identifies that
* surface.
*/
class CachedSurface : public RefCounted<CachedSurface>
class CachedSurface
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CachedSurface)
NS_INLINE_DECL_REFCOUNTING(CachedSurface)
CachedSurface(DrawTarget* aTarget,
const IntSize aTargetSize,
const Cost aCost,
@ -156,10 +157,11 @@ 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 : public RefCounted<ImageSurfaceCache>
class ImageSurfaceCache
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(ImageSurfaceCache)
NS_INLINE_DECL_REFCOUNTING(ImageSurfaceCache)
typedef nsRefPtrHashtable<nsGenericHashKey<SurfaceKey>, CachedSurface> SurfaceTable;
bool IsEmpty() const { return mSurfaces.Count() == 0; }

View File

@ -16,6 +16,7 @@
#include "nsAutoPtr.h"
#include "nsString.h"
#include "nsThreadUtils.h"
#include "mozilla/RefPtr.h"
#define CHROMIUM_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args)

View File

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

View File

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