Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 758992 - Make the classes which use the XPCOM nsISupports impleme…
Browse files Browse the repository at this point in the history
…ntation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (XPCOM parts); r=bsmedberg
  • Loading branch information
ehsan committed Jun 5, 2012
1 parent 4ed6a10 commit c30b776
Show file tree
Hide file tree
Showing 48 changed files with 122 additions and 73 deletions.
3 changes: 2 additions & 1 deletion intl/uconv/src/nsConverterOutputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "nsIOutputStream.h"
#include "nsIConverterOutputStream.h"
#include "nsCOMPtr.h"
#include "mozilla/Attributes.h"

class nsIUnicodeEncoder;
class nsIOutputStream;
Expand All @@ -18,7 +19,7 @@ class nsIOutputStream;
{ 0xff8780a5, 0xbbb1, 0x4bc5, \
{ 0x8e, 0xe7, 0x05, 0x7e, 0x7b, 0xc5, 0xc9, 0x25 } }

class nsConverterOutputStream : public nsIConverterOutputStream {
class nsConverterOutputStream MOZ_FINAL : public nsIConverterOutputStream {
public:
nsConverterOutputStream() {}

Expand Down
4 changes: 3 additions & 1 deletion intl/uconv/src/nsUnicodeToUTF8.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef nsUnicodeToUTF8_h___
#define nsUnicodeToUTF8_h___

#include "mozilla/Attributes.h"

// Class ID for our UnicodeToUTF8 charset converter
// {7C657D18-EC5E-11d2-8AAC-00600811A836}
#define NS_UNICODETOUTF8_CID \
Expand All @@ -25,7 +27,7 @@
* @created 05/Apr/1999
* @author Catalin Rotaru [CATA]
*/
class nsUnicodeToUTF8 : public nsIUnicodeEncoder
class nsUnicodeToUTF8 MOZ_FINAL : public nsIUnicodeEncoder
{
NS_DECL_ISUPPORTS

Expand Down
3 changes: 2 additions & 1 deletion xpcom/base/nsCycleCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
#include "nsThreadUtils.h"
#include "nsTArray.h"
#include "mozilla/Services.h"
#include "mozilla/Attributes.h"
#include "nsICycleCollectorListener.h"
#include "nsIXPConnect.h"
#include "nsIJSRuntimeService.h"
Expand Down Expand Up @@ -1264,7 +1265,7 @@ struct CCGraphDescriber
Type mType;
};

class nsCycleCollectorLogger : public nsICycleCollectorListener
class nsCycleCollectorLogger MOZ_FINAL : public nsICycleCollectorListener
{
public:
nsCycleCollectorLogger() :
Expand Down
3 changes: 2 additions & 1 deletion xpcom/base/nsInterfaceRequestorAgg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

#include "nsInterfaceRequestorAgg.h"
#include "nsCOMPtr.h"
#include "mozilla/Attributes.h"

class nsInterfaceRequestorAgg : public nsIInterfaceRequestor
class nsInterfaceRequestorAgg MOZ_FINAL : public nsIInterfaceRequestor
{
public:
NS_DECL_ISUPPORTS
Expand Down
3 changes: 2 additions & 1 deletion xpcom/base/nsMacUtilsImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

#include "nsIMacUtils.h"
#include "nsString.h"
#include "mozilla/Attributes.h"

class nsMacUtilsImpl : public nsIMacUtils
class nsMacUtilsImpl MOZ_FINAL : public nsIMacUtils
{
public:
NS_DECL_ISUPPORTS
Expand Down
5 changes: 3 additions & 2 deletions xpcom/base/nsMemoryReporterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "nsArrayEnumerator.h"
#include "nsISimpleEnumerator.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Attributes.h"

using namespace mozilla;

Expand Down Expand Up @@ -687,15 +688,15 @@ struct MemoryReport {
#ifdef DEBUG
// This is just a wrapper for PRInt64 that implements nsISupports, so it can be
// passed to nsIMemoryMultiReporter::CollectReports.
class PRInt64Wrapper : public nsISupports {
class PRInt64Wrapper MOZ_FINAL : public nsISupports {
public:
NS_DECL_ISUPPORTS
PRInt64Wrapper() : mValue(0) { }
PRInt64 mValue;
};
NS_IMPL_ISUPPORTS0(PRInt64Wrapper)

class ExplicitNonHeapCountingCallback : public nsIMemoryMultiReporterCallback
class ExplicitNonHeapCountingCallback MOZ_FINAL : public nsIMemoryMultiReporterCallback
{
public:
NS_DECL_ISUPPORTS
Expand Down
3 changes: 2 additions & 1 deletion xpcom/base/nsMemoryReporterManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#include "nsIMemoryReporter.h"
#include "nsCOMArray.h"
#include "mozilla/Mutex.h"
#include "mozilla/Attributes.h"
#include "nsString.h"

using mozilla::Mutex;

class nsMemoryReporter : public nsIMemoryReporter
class nsMemoryReporter MOZ_FINAL : public nsIMemoryReporter
{
public:
NS_DECL_ISUPPORTS
Expand Down
3 changes: 2 additions & 1 deletion xpcom/components/nsComponentManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "nsTArray.h"

#include "mozilla/Omnijar.h"
#include "mozilla/Attributes.h"

struct nsFactoryEntry;
class nsIServiceManager;
Expand Down Expand Up @@ -68,7 +69,7 @@ struct nsLoaderdata {
nsCString type;
};

class nsComponentManagerImpl
class nsComponentManagerImpl MOZ_FINAL
: public nsIComponentManager
, public nsIServiceManager
, public nsSupportsWeakReference
Expand Down
5 changes: 3 additions & 2 deletions xpcom/ds/nsArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "nsCOMArray.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h"

#define NS_ARRAY_CLASSNAME \
"nsIArray implementation"
Expand All @@ -36,12 +37,12 @@ class nsArray : public nsIMutableArray
NS_DECL_NSIMUTABLEARRAY

protected:
~nsArray();
virtual ~nsArray(); // nsArrayCC inherits from this

nsCOMArray_base mArray;
};

class nsArrayCC : public nsArray
class nsArrayCC MOZ_FINAL : public nsArray
{
public:
nsArrayCC() : nsArray() { }
Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsAtomService.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#define __nsAtomService_h

#include "nsIAtomService.h"
#include "mozilla/Attributes.h"

class nsAtomService : public nsIAtomService
class nsAtomService MOZ_FINAL : public nsIAtomService
{
public:
nsAtomService();
Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsAtomTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/HashFunctions.h"

#include "nsAtomTable.h"
Expand Down Expand Up @@ -102,7 +103,7 @@ class AtomImpl : public nsIAtom {
* A non-refcounted implementation of nsIAtom.
*/

class PermanentAtomImpl : public AtomImpl {
class PermanentAtomImpl MOZ_FINAL : public AtomImpl {
public:
PermanentAtomImpl(const nsAString& aString, PLDHashNumber aKeyHash)
: AtomImpl(aString, aKeyHash)
Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsHashPropertyBag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "nsIVariant.h"
#include "nsIProperty.h"
#include "nsVariant.h"
#include "mozilla/Attributes.h"

nsresult
NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval)
Expand Down Expand Up @@ -110,7 +111,7 @@ nsHashPropertyBag::DeleteProperty(const nsAString& name)
// nsSimpleProperty class and impl; used for GetEnumerator
//

class nsSimpleProperty : public nsIProperty {
class nsSimpleProperty MOZ_FINAL : public nsIProperty {
public:
nsSimpleProperty(const nsAString& aName, nsIVariant* aValue)
: mName(aName), mValue(aValue)
Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsINIParserImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
#include "nsINIParser.h"
#include "nsStringEnumerator.h"
#include "nsTArray.h"
#include "mozilla/Attributes.h"

class nsINIParserImpl :
class nsINIParserImpl MOZ_FINAL :
public nsIINIParser
{
public:
Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsINIParserImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "nsIINIParser.h"
#include "nsIFactory.h"
#include "mozilla/Attributes.h"

#define NS_INIPARSERFACTORY_CID \
{ 0xdfac10a9, 0xdd24, 0x43cf, \
Expand All @@ -15,7 +16,7 @@
#define NS_INIPARSERFACTORY_CONTRACTID \
"@mozilla.org/xpcom/ini-parser-factory;1"

class nsINIParserFactory :
class nsINIParserFactory MOZ_FINAL :
public nsIINIParserFactory,
public nsIFactory
{
Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsObserverList.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "nsIWeakReference.h"
#include "nsHashKeys.h"
#include "nsISimpleEnumerator.h"
#include "mozilla/Attributes.h"

struct ObserverRef
{
Expand Down Expand Up @@ -67,7 +68,7 @@ class nsObserverList : public nsCharPtrHashKey
nsTArray<ObserverRef> mObservers;
};

class nsObserverEnumerator : public nsISimpleEnumerator
class nsObserverEnumerator MOZ_FINAL : public nsISimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsObserverService.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
#include "nsIObserverService.h"
#include "nsObserverList.h"
#include "nsTHashtable.h"
#include "mozilla/Attributes.h"

#define NS_OBSERVERSERVICE_CLASSNAME "Observer Service"

// {D07F5195-E3D1-11d2-8ACD-00105A1B8860}
#define NS_OBSERVERSERVICE_CID \
{ 0xd07f5195, 0xe3d1, 0x11d2, { 0x8a, 0xcd, 0x0, 0x10, 0x5a, 0x1b, 0x88, 0x60 } }

class nsObserverService : public nsIObserverService {
class nsObserverService MOZ_FINAL : public nsIObserverService {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_OBSERVERSERVICE_CID)

Expand Down
5 changes: 3 additions & 2 deletions xpcom/ds/nsPersistentProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
#include "plarena.h"
#include "nsString.h"
#include "nsCOMPtr.h"
#include "mozilla/Attributes.h"

#include "nsIUnicharInputStream.h"


class nsPersistentProperties : public nsIPersistentProperties
class nsPersistentProperties MOZ_FINAL : public nsIPersistentProperties
{
public:
nsPersistentProperties();
Expand All @@ -39,7 +40,7 @@ class nsPersistentProperties : public nsIPersistentProperties
PLArenaPool mArena;
};

class nsPropertyElement : public nsIPropertyElement
class nsPropertyElement MOZ_FINAL : public nsIPropertyElement
{
public:
nsPropertyElement()
Expand Down
5 changes: 3 additions & 2 deletions xpcom/ds/nsProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "nsInterfaceHashtable.h"
#include "nsHashKeys.h"
#include "nsAgg.h"
#include "mozilla/Attributes.h"

#define NS_PROPERTIES_CID \
{ /* 4de2bc90-b1bf-11d3-93b6-00104ba0fd40 */ \
Expand All @@ -24,8 +25,8 @@ class nsIUnicharInputStream;
typedef nsInterfaceHashtable<nsCharPtrHashKey, nsISupports>
nsProperties_HashBase;

class nsProperties : public nsIProperties,
public nsProperties_HashBase {
class nsProperties MOZ_FINAL : public nsIProperties,
public nsProperties_HashBase {
public:

NS_DECL_AGGREGATED
Expand Down
7 changes: 4 additions & 3 deletions xpcom/ds/nsStringEnumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
#include "nsReadableUtils.h"
#include "nsISimpleEnumerator.h"
#include "nsSupportsPrimitives.h"
#include "mozilla/Attributes.h"

//
// nsStringEnumerator
//

class nsStringEnumerator : public nsIStringEnumerator,
public nsIUTF8StringEnumerator,
public nsISimpleEnumerator
class nsStringEnumerator MOZ_FINAL : public nsIStringEnumerator,
public nsIUTF8StringEnumerator,
public nsISimpleEnumerator
{
public:
nsStringEnumerator(const nsTArray<nsString>* aArray, bool aOwnsArray) :
Expand Down
2 changes: 1 addition & 1 deletion xpcom/ds/nsSupportsArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult)
return rv;
}

class nsArrayEnumerator : public nsISimpleEnumerator
class nsArrayEnumerator MOZ_FINAL : public nsISimpleEnumerator
{
public:
// nsISupports interface
Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsSupportsArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
//#define DEBUG_SUPPORTSARRAY 1

#include "nsISupportsArray.h"
#include "mozilla/Attributes.h"

static const PRUint32 kAutoArraySize = 8;

class nsSupportsArray : public nsISupportsArray {
class nsSupportsArray MOZ_FINAL : public nsISupportsArray {
public:
nsSupportsArray(void);
~nsSupportsArray(void); // nonvirtual since we're not subclassed
Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsSupportsArrayEnumerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
#define nsSupportsArrayEnumerator_h___

#include "nsIEnumerator.h"
#include "mozilla/Attributes.h"

class nsISupportsArray;

class nsSupportsArrayEnumerator : public nsIBidirectionalEnumerator {
class nsSupportsArrayEnumerator MOZ_FINAL : public nsIBidirectionalEnumerator {
public:
NS_DECL_ISUPPORTS

Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsUnicharBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#define nsUnicharBuffer_h__

#include "nsIUnicharBuffer.h"
#include "mozilla/Attributes.h"

class UnicharBufferImpl : public nsIUnicharBuffer {
class UnicharBufferImpl MOZ_FINAL : public nsIUnicharBuffer {
public:
UnicharBufferImpl();

Expand Down
3 changes: 2 additions & 1 deletion xpcom/ds/nsVariant.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "nsIVariant.h"
#include "nsStringFwd.h"
#include "xpt_struct.h"
#include "mozilla/Attributes.h"

class nsCycleCollectionTraversalCallback;

Expand Down Expand Up @@ -83,7 +84,7 @@ struct nsDiscriminatedUnion
* use to help them do all the 'standard' nsIVariant data conversions.
*/

class nsVariant : public nsIWritableVariant
class nsVariant MOZ_FINAL : public nsIWritableVariant
{
public:
NS_DECL_ISUPPORTS
Expand Down
2 changes: 1 addition & 1 deletion xpcom/glue/nsEnumeratorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ NS_NewSingletonEnumerator(nsISimpleEnumerator* *result,

////////////////////////////////////////////////////////////////////////////////

class nsUnionEnumerator : public nsISimpleEnumerator
class nsUnionEnumerator MOZ_FINAL : public nsISimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
Expand Down
Loading

0 comments on commit c30b776

Please sign in to comment.