Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (more xpcom and gonk parts); r=jrmuizel

This commit is contained in:
Ehsan Akhgari 2012-06-19 23:41:56 -04:00
parent 8e4039f7a3
commit 49bc93c755
11 changed files with 28 additions and 14 deletions

View File

@ -16,6 +16,7 @@
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "xpcpublic.h"
#include "mozilla/Attributes.h"
#undef LOG
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "AutoMounterSetting" , ## args)
@ -27,7 +28,7 @@
namespace mozilla {
namespace system {
class SettingsServiceCallback : public nsISettingsServiceCallback
class SettingsServiceCallback MOZ_FINAL : public nsISettingsServiceCallback
{
public:
NS_DECL_ISUPPORTS

View File

@ -10,6 +10,7 @@
*/
#include "nsISample.h"
#include "mozilla/Attributes.h"
/**
* SampleImpl is an implementation of the nsISample interface. In XPCOM,
@ -28,7 +29,7 @@
#define NS_SAMPLE_CONTRACTID "@mozilla.org/sample;1"
class nsSampleImpl : public nsISample
class nsSampleImpl MOZ_FINAL : public nsISample
{
public:
nsSampleImpl();

View File

@ -7,6 +7,7 @@
#include "nsAutoPtr.h"
#include <stdio.h>
#include "nscore.h"
#include "mozilla/Attributes.h"
class TestObjectBaseA {
public:
@ -53,7 +54,7 @@ class TestRefObjectBaseB {
virtual nsrefcnt Release() = 0;
};
class TestRefObject : public TestRefObjectBaseA, public TestRefObjectBaseB {
class TestRefObject MOZ_FINAL : public TestRefObjectBaseA, public TestRefObjectBaseB {
public:
TestRefObject()
: mRefCount(0)

View File

@ -6,6 +6,7 @@
#include "TestHarness.h"
#include "nsCOMArray.h"
#include "mozilla/Attributes.h"
// {9e70a320-be02-11d1-8031-006008159b5a}
#define NS_IFOO_IID \
@ -23,7 +24,7 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(IFoo, NS_IFOO_IID)
class Foo : public IFoo {
class Foo MOZ_FINAL : public IFoo {
public:
Foo(PRInt32 aID);
@ -73,7 +74,7 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(IBar, NS_IBAR_IID)
class Bar : public IBar {
class Bar MOZ_FINAL : public IBar {
public:
explicit Bar(nsCOMArray<IBar>& aArray);

View File

@ -20,6 +20,7 @@
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsAutoPtr.h"
#include "mozilla/Attributes.h"
#define NS_ITESTSERVICE_IID \
{0x127b5253, 0x37b1, 0x43c7, \
@ -32,7 +33,8 @@ class NS_NO_VTABLE nsITestService : public nsISupports {
NS_DEFINE_STATIC_IID_ACCESSOR(nsITestService, NS_ITESTSERVICE_IID)
class nsTestService : public nsITestService, public nsSupportsWeakReference
class nsTestService MOZ_FINAL : public nsITestService,
public nsSupportsWeakReference
{
public:
NS_DECL_ISUPPORTS

View File

@ -12,6 +12,7 @@
#include "nsCOMPtr.h"
#include "nsISupports.h"
#include "nsCOMArray.h"
#include "mozilla/Attributes.h"
#include <stdio.h>
@ -191,7 +192,7 @@ nsCEnum(const nsACString& aKey, nsAutoPtr<TestUniChar>& aData, void* userArg) {
{ 0x6f7652e0, 0xee43, 0x11d1, \
{ 0x9c, 0xc3, 0x00, 0x60, 0x08, 0x8c, 0xa6, 0xb3 } }
class IFoo : public nsISupports
class IFoo MOZ_FINAL : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFOO_IID)

View File

@ -11,6 +11,7 @@
#include "nsStringGlue.h"
#include "nsWeakReference.h"
#include "nsComponentManagerUtils.h"
#include "mozilla/Attributes.h"
#include <stdio.h>
@ -29,7 +30,9 @@ void printString(nsString &str) {
printf("%s", NS_ConvertUTF16toUTF8(str).get());
}
class TestObserver : public nsIObserver, public nsSupportsWeakReference {
class TestObserver MOZ_FINAL : public nsIObserver,
public nsSupportsWeakReference
{
public:
TestObserver( const nsAString &name )
: mName( name ) {

View File

@ -7,6 +7,7 @@
#include "nsIPipe.h"
#include "nsIMemory.h"
#include "mozilla/Attributes.h"
/** NS_NewPipe2 reimplemented, because it's not exported by XPCOM */
nsresult TP_NewPipe2(nsIAsyncInputStream** input,
@ -41,7 +42,7 @@ nsresult TP_NewPipe2(nsIAsyncInputStream** input,
* which <size>-byte locations in mMemory are empty and which are filled.
* Pretty stupid, but enough to test bug 394692.
*/
class BackwardsAllocator : public nsIMemory
class BackwardsAllocator MOZ_FINAL : public nsIMemory
{
public:
BackwardsAllocator()

View File

@ -15,6 +15,7 @@
#include "nsThreadUtils.h"
#include "nsXPCOMCIDInternal.h"
#include "prmon.h"
#include "mozilla/Attributes.h"
#include "mozilla/ReentrantMonitor.h"
using namespace mozilla;
@ -83,7 +84,7 @@ private:
ReentrantMonitor** mReentrantMonitorPtr;
};
class Factory : public nsIFactory
class Factory MOZ_FINAL : public nsIFactory
{
public:
NS_DECL_ISUPPORTS
@ -103,7 +104,7 @@ public:
NS_IMPL_THREADSAFE_ISUPPORTS1(Factory, nsIFactory)
class Component1 : public nsISupports
class Component1 MOZ_FINAL : public nsISupports
{
public:
NS_DECL_ISUPPORTS
@ -123,7 +124,7 @@ NS_INTERFACE_MAP_BEGIN(Component1)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
class Component2 : public nsISupports
class Component2 MOZ_FINAL : public nsISupports
{
public:
NS_DECL_ISUPPORTS

View File

@ -14,6 +14,7 @@
#include "prinrval.h"
#include "prmon.h"
#include "prthread.h"
#include "mozilla/Attributes.h"
#include "mozilla/ReentrantMonitor.h"
using namespace mozilla;
@ -44,7 +45,7 @@ static bool gAllThreadsShutDown = false;
PR_END_MACRO
#endif
class Listener : public nsIThreadPoolListener
class Listener MOZ_FINAL : public nsIThreadPoolListener
{
public:
NS_DECL_ISUPPORTS

View File

@ -14,6 +14,7 @@
#include "nsThreadUtils.h"
#include "prinrval.h"
#include "prmon.h"
#include "mozilla/Attributes.h"
#include "mozilla/ReentrantMonitor.h"
using namespace mozilla;
@ -68,7 +69,7 @@ private:
ReentrantMonitor* mReentrantMonitor;
};
class TimerCallback : public nsITimerCallback
class TimerCallback MOZ_FINAL : public nsITimerCallback
{
public:
NS_DECL_ISUPPORTS