Bug 1312319 - Add a NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING macro and replace existing pure-virtual AddRef/Release declarations. r=froydnj

MozReview-Commit-ID: 5yt3O4Hoois

--HG--
extra : rebase_source : 5dad12cd8400b8a783e8407de874d4b7c75cb645
This commit is contained in:
Kartikaya Gupta 2017-01-25 14:51:34 -05:00
Родитель faba351849
Коммит 1af1a82edf
26 изменённых файлов: 40 добавлений и 80 удалений

6
dom/cache/Action.h поставляемый
Просмотреть файл

@ -28,11 +28,7 @@ public:
// Action::RunOnTarget().
virtual void Resolve(nsresult aRv) = 0;
NS_IMETHOD_(MozExternalRefCountType)
AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType)
Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
};
// Class containing data that can be opportunistically shared between

6
dom/cache/ReadStream.h поставляемый
Просмотреть файл

@ -67,11 +67,7 @@ public:
virtual bool
HasEverBeenRead() const = 0;
NS_IMETHOD_(MozExternalRefCountType)
AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType)
Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
};
static already_AddRefed<ReadStream>

Просмотреть файл

@ -20,9 +20,7 @@ class MutableBlobStorage;
class MutableBlobStorageCallback
{
public:
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual void BlobStoreCompleted(MutableBlobStorage* aBlobStorage,
Blob* aBlob,

Просмотреть файл

@ -6,6 +6,7 @@
#define mozilla_dom_FileHandleCommon_h
#include "nscore.h"
#include "nsISupportsImpl.h"
#ifdef DEBUG
#define DEBUGONLY(...) __VA_ARGS__
@ -21,11 +22,7 @@ namespace dom {
class RefCountedObject
{
public:
NS_IMETHOD_(MozExternalRefCountType)
AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType)
Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
protected:
virtual ~RefCountedObject()

Просмотреть файл

@ -35,9 +35,7 @@ class InternalResponse;
class HttpServerListener
{
public:
// switch to NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING when that lands
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual void OnServerStarted(nsresult aStatus) = 0;
virtual void OnRequest(InternalRequest* aRequest) = 0;

Просмотреть файл

@ -73,8 +73,7 @@ protected:
typedef dom::MediaKeySessionType MediaKeySessionType;
public:
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
typedef MozPromise<DecryptResult, DecryptResult, /* IsExclusive = */ true> DecryptPromise;

Просмотреть файл

@ -30,11 +30,7 @@ class UsageInfo;
class Client
{
public:
NS_IMETHOD_(MozExternalRefCountType)
AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType)
Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
enum Type {
IDB = 0,

Просмотреть файл

@ -44,11 +44,7 @@ class QuotaObject;
class NS_NO_VTABLE RefCountedObject
{
public:
NS_IMETHOD_(MozExternalRefCountType)
AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType)
Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
};
class DirectoryLock

Просмотреть файл

@ -57,11 +57,7 @@ public:
virtual bool
WaitOnPromise(Promise& aPromise) = 0;
NS_IMETHOD_(MozExternalRefCountType)
AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType)
Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
};
private:

Просмотреть файл

@ -33,11 +33,7 @@ public:
// on the main thread asynchronously after Start() completes.
virtual void JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus) = 0;
NS_IMETHOD_(MozExternalRefCountType)
AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType)
Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
};
enum class Type

Просмотреть файл

@ -211,11 +211,7 @@ public:
virtual void
FinishedWithResult(ExtendableEventResult aResult) = 0;
NS_IMETHOD_(MozExternalRefCountType)
AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType)
Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
};
class KeepAliveHandler final : public WorkerHolder

Просмотреть файл

@ -35,8 +35,7 @@ class WorkerPrivate;
class ServiceWorkerRegistrationListener
{
public:
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual void
UpdateFound() = 0;

Просмотреть файл

@ -50,8 +50,7 @@ public:
virtual void
SaveLoadFlags(nsLoadFlags aLoadFlags) = 0;
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
};
nsresult

Просмотреть файл

@ -46,8 +46,7 @@ public:
class txACompileObserver
{
public:
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual nsresult loadURI(const nsAString& aUri,
const nsAString& aReferrerUri,

Просмотреть файл

@ -7,8 +7,7 @@
#ifndef mozilla_layers_CompositorController_h
#define mozilla_layers_CompositorController_h
#include "mozilla/RefCountType.h" // for MozExternalRefCountType
#include "nscore.h" // for NS_IMETHOD_
#include "nsISupportsImpl.h" // for NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
namespace mozilla {
namespace layers {
@ -16,8 +15,7 @@ namespace layers {
class CompositorController
{
public:
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual void ScheduleRenderOnCompositorThread() = 0;
virtual void ScheduleHideAllPluginWindows() = 0;

Просмотреть файл

@ -10,8 +10,7 @@
#include "FrameMetrics.h" // for FrameMetrics
#include "mozilla/ipc/CrossProcessMutex.h" // for CrossProcessMutexHandle
#include "mozilla/ipc/SharedMemoryBasic.h" // for SharedMemoryBasic
#include "mozilla/RefCountType.h" // for MozExternalRefCountType
#include "nscore.h" // for NS_IMETHOD_
#include "nsISupportsImpl.h" // for NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
namespace mozilla {
namespace layers {
@ -19,8 +18,7 @@ namespace layers {
class MetricsSharingController
{
public:
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual base::ProcessId RemotePid() = 0;
virtual bool StartSharingMetrics(mozilla::ipc::SharedMemoryBasic::Handle aHandle,

Просмотреть файл

@ -23,8 +23,7 @@ class LayersIPCActor;
*/
class KnowsCompositor {
public:
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
KnowsCompositor();
~KnowsCompositor();

Просмотреть файл

@ -37,8 +37,7 @@ public:
class LayersIPCChannel : public LayersIPCActor
, public mozilla::ipc::IShmemAllocator {
public:
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual bool IsSameProcess() const = 0;

Просмотреть файл

@ -32,8 +32,7 @@ public:
// Subclasses may or may not be XPCOM classes, so we just require that they
// implement AddRef and Release.
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
// imgINotificationObserver methods:
virtual void Notify(int32_t aType, const nsIntRect* aRect = nullptr) = 0;

Просмотреть файл

@ -37,8 +37,7 @@ class ISurfaceProvider
public:
// Subclasses may or may not be XPCOM classes, so we just require that they
// implement AddRef and Release.
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
/// @return key data used for identifying which image this ISurfaceProvider is
/// associated with in the surface cache.

Просмотреть файл

@ -41,8 +41,7 @@ struct IResumable
// Subclasses may or may not be XPCOM classes, so we just require that they
// implement AddRef and Release.
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual void Resume() = 0;

Просмотреть файл

@ -54,8 +54,7 @@ public:
//
// The refresh driver does NOT hold references to refresh observers
// except while it is notifying them.
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual void WillRefresh(mozilla::TimeStamp aTime) = 0;
};

Просмотреть файл

@ -96,8 +96,7 @@ public:
virtual AnonymousCounterStyle* AsAnonymous() { return nullptr; }
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
protected:
int32_t mStyle;

Просмотреть файл

@ -121,8 +121,7 @@ public:
virtual int cancel(int how);
// nsISupport reference counted interface
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
uint32_t poll_flags() {
return poll_flags_;

Просмотреть файл

@ -22,8 +22,7 @@ public:
ARefBase() {}
virtual ~ARefBase() {}
NS_IMETHOD_ (MozExternalRefCountType) AddRef() = 0;
NS_IMETHOD_ (MozExternalRefCountType) Release() = 0;
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
};
} // namespace net

Просмотреть файл

@ -542,6 +542,18 @@ NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, NS_METHOD_, __VA_ARGS__)
#define NS_INLINE_DECL_THREADSAFE_VIRTUAL_REFCOUNTING(_class, ...) \
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_META(_class, NS_IMETHOD_, __VA_ARGS__)
/**
* Use this macro in interface classes that you want to be able to reference
* using RefPtr, but don't want to provide a refcounting implemenation. The
* refcounting implementation can be provided by concrete subclasses that
* implement the interface.
*/
#define NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING \
public: \
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0; \
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0; \
public:
/**
* Use this macro to implement the AddRef method for a given <i>_class</i>
* @param _class The name of the class implementing the method