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 7963619b25
commit 2f3ae6ae0c
11 changed files with 28 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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