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 (startupcache parts); r=jrmuizel
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 19 Jun 2012 23:45:32 -0400
changeset 101156 bf8a77e238f0a6ddc6bfaee9d3b67b6bb38e3be2
parent 101155 debdfc7a3de8b580b66c6e5ecffa5f701e3cf628
child 101157 952cd748c30eb96219329e696e44b725459813ad
push idunknown
push userunknown
push dateunknown
reviewersjrmuizel
bugs758992
milestone16.0a1
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 (startupcache parts); r=jrmuizel
startupcache/StartupCache.h
--- a/startupcache/StartupCache.h
+++ b/startupcache/StartupCache.h
@@ -16,16 +16,17 @@
 #include "nsZipArchive.h"
 #include "nsIStartupCache.h"
 #include "nsIStorageStream.h"
 #include "nsITimer.h"
 #include "nsIObserverService.h"
 #include "nsIObserver.h"
 #include "nsIOutputStream.h"
 #include "nsIFile.h"
+#include "mozilla/Attributes.h"
 
 /**
  * The StartupCache is a persistent cache of simple key-value pairs,
  * where the keys are null-terminated c-strings and the values are 
  * arbitrary data, passed as a (char*, size) tuple. 
  *
  * Clients should use the GetSingleton() static method to access the cache. It 
  * will be available from the end of XPCOM init (NS_InitXPCOM3 in nsXPComInit.cpp), 
@@ -83,17 +84,17 @@ struct CacheEntry
 
   size_t SizeOfExcludingThis(nsMallocSizeOfFun mallocSizeOf) {
     return mallocSizeOf(data);
   }
 };
 
 // We don't want to refcount StartupCache, and ObserverService wants to
 // refcount its listeners, so we'll let it refcount this instead.
-class StartupCacheListener : public nsIObserver
+class StartupCacheListener MOZ_FINAL : public nsIObserver
 {
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 };
 
 class StartupCache
 {
 
@@ -174,17 +175,17 @@ private:
   nsIMemoryReporter* mMappingMemoryReporter;
   nsIMemoryReporter* mDataMemoryReporter;
 };
 
 // This debug outputstream attempts to detect if clients are writing multiple
 // references to the same object. We only support that if that object
 // is a singleton.
 #ifdef DEBUG
-class StartupCacheDebugOutputStream
+class StartupCacheDebugOutputStream MOZ_FINAL
   : public nsIObjectOutputStream
 {  
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBJECTOUTPUTSTREAM
 
   StartupCacheDebugOutputStream (nsIObjectOutputStream* binaryStream,
                                    nsTHashtable<nsISupportsHashKey>* objectMap)
   : mBinaryStream(binaryStream), mObjectMap(objectMap) { }
@@ -200,17 +201,17 @@ class StartupCacheDebugOutputStream
 #endif // DEBUG
 
 // XPCOM wrapper interface provided for tests only.
 #define NS_STARTUPCACHE_CID \
       {0xae4505a9, 0x87ab, 0x477c, \
       {0xb5, 0x77, 0xf9, 0x23, 0x57, 0xed, 0xa8, 0x84}}
 // contract id: "@mozilla.org/startupcache/cache;1"
 
-class StartupCacheWrapper 
+class StartupCacheWrapper MOZ_FINAL
   : public nsIStartupCache
 {
   NS_DECL_ISUPPORTS
   NS_DECL_NSISTARTUPCACHE
 
   static StartupCacheWrapper* GetSingleton();
   static StartupCacheWrapper *gStartupCacheWrapper;
 };