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 (places parts); r=mak
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 19 Jun 2012 23:58:39 -0400
changeset 98851 d9c9fe7a8d3d4970b8badfe6d4f8b529d4e7c252
parent 98850 8f6369338673ff1fcff50973431087d5c848ed99
child 98852 3a7ece100089349c65774ffb0701a8f40543267c
push id23088
push userryanvm@gmail.com
push dateWed, 11 Jul 2012 03:26:10 +0000
treeherdermozilla-central@8495e311226f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs758992
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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 (places parts); r=mak
toolkit/components/places/Database.cpp
toolkit/components/places/Database.h
toolkit/components/places/History.cpp
toolkit/components/places/SQLFunctions.h
toolkit/components/places/nsAnnoProtocolHandler.h
toolkit/components/places/nsAnnotationService.h
toolkit/components/places/nsFaviconService.h
toolkit/components/places/nsNavBookmarks.h
toolkit/components/places/nsNavHistory.h
toolkit/components/places/nsNavHistoryQuery.h
--- a/toolkit/components/places/Database.cpp
+++ b/toolkit/components/places/Database.cpp
@@ -18,16 +18,17 @@
 
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "prsystem.h"
 #include "nsPrintfCString.h"
 #include "mozilla/Util.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
+#include "mozilla/Attributes.h"
 
 // Time between corrupt database backups.
 #define RECENT_BACKUP_TIME_MICROSEC (PRInt64)86400 * PR_USEC_PER_SEC // 24H
 
 // Filename of the database.
 #define DATABASE_FILENAME NS_LITERAL_STRING("places.sqlite")
 // Filename used to backup corrupt databases.
 #define DATABASE_CORRUPT_FILENAME NS_LITERAL_STRING("places.sqlite.corrupt")
@@ -203,17 +204,17 @@ SetJournalMode(nsCOMPtr<mozIStorageConne
     }
     // This is an unknown journal.
     MOZ_ASSERT(true);
   }
 
   return JOURNAL_DELETE;
 }
 
-class BlockingConnectionCloseCallback : public mozIStorageCompletionCallback {
+class BlockingConnectionCloseCallback MOZ_FINAL : public mozIStorageCompletionCallback {
   bool mDone;
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGECOMPLETIONCALLBACK
   BlockingConnectionCloseCallback();
   void Spin();
 };
--- a/toolkit/components/places/Database.h
+++ b/toolkit/components/places/Database.h
@@ -6,16 +6,17 @@
 #define mozilla_places_Database_h_
 
 #include "nsThreadUtils.h"
 #include "nsWeakReference.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIObserver.h"
 #include "mozilla/storage.h"
 #include "mozilla/storage/StatementCache.h"
+#include "mozilla/Attributes.h"
 
 // This is the schema version. Update it at any schema change and add a
 // corresponding migrateVxx method below.
 #define DATABASE_SCHEMA_VERSION 21
 
 // Fired after Places inited.
 #define TOPIC_PLACES_INIT_COMPLETE "places-init-complete"
 // Fired when initialization fails due to a locked database.
@@ -53,18 +54,18 @@ enum JournalMode {
   // We fallback to this mode when WAL is unavailable.
 , JOURNAL_TRUNCATE
   // Unsafe in case of crashes on database swap or low memory.
 , JOURNAL_MEMORY
   // Can reduce number of fsyncs.  We try to use this mode by default.
 , JOURNAL_WAL
 };
 
-class Database : public nsIObserver
-               , public nsSupportsWeakReference
+class Database MOZ_FINAL : public nsIObserver
+                         , public nsSupportsWeakReference
 {
   typedef mozilla::storage::StatementCache<mozIStorageStatement> StatementCache;
   typedef mozilla::storage::StatementCache<mozIStorageAsyncStatement> AsyncStatementCache;
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -22,16 +22,17 @@
 #include "mozilla/Services.h"
 #include "nsThreadUtils.h"
 #include "nsNetUtil.h"
 #include "nsIXPConnect.h"
 #include "mozilla/unused.h"
 #include "mozilla/Util.h"
 #include "nsContentUtils.h"
 #include "nsIMemoryReporter.h"
+#include "mozilla/Attributes.h"
 
 // Initial size for the cache holding visited status observers.
 #define VISIT_OBSERVERS_INITIAL_CACHE_SIZE 128
 
 using namespace mozilla::dom;
 using mozilla::unused;
 
 namespace mozilla {
@@ -1243,17 +1244,17 @@ private:
    * disappear out from under us.
    */
   nsRefPtr<History> mHistory;
 };
 
 /**
  * Adds download-specific annotations to a download page.
  */
-class SetDownloadAnnotations : public mozIVisitInfoCallback
+class SetDownloadAnnotations MOZ_FINAL : public mozIVisitInfoCallback
 {
 public:
   NS_DECL_ISUPPORTS
 
   SetDownloadAnnotations(nsIURI* aDestination)
   : mDestination(aDestination)
   , mHistory(History::GetService())
   {
--- a/toolkit/components/places/SQLFunctions.h
+++ b/toolkit/components/places/SQLFunctions.h
@@ -7,16 +7,17 @@
 #define mozilla_places_SQLFunctions_h_
 
 /**
  * This file contains functions that Places adds to the database handle that can
  * be accessed by SQL queries.
  */
 
 #include "mozIStorageFunction.h"
+#include "mozilla/Attributes.h"
 
 class mozIStorageConnection;
 
 namespace mozilla {
 namespace places {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// AutoComplete Matching Function
@@ -47,17 +48,17 @@ namespace places {
  * @param aOpenPageCount
  *        The number of times aURL has been registered as being open.  (See
  *        mozIPlacesAutoComplete::registerOpenPage.)
  * @param aMatchBehavior
  *        The match behavior to use for this search.
  * @param aSearchBehavior
  *        A bitfield dictating the search behavior.
  */
-class MatchAutoCompleteFunction : public mozIStorageFunction
+class MatchAutoCompleteFunction MOZ_FINAL : public mozIStorageFunction
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
@@ -184,17 +185,17 @@ private:
  *        The id of the page.  Pass -1 if the page is being added right now.
  * @param [optional] typed
  *        Whether the page has been typed in.  Default is false.
  * @param [optional] fullVisitCount
  *        Count of all the visits (All types).  Default is 0.
  * @param [optional] isBookmarked
  *        Whether the page is bookmarked. Default is false.
  */
-class CalculateFrecencyFunction : public mozIStorageFunction
+class CalculateFrecencyFunction MOZ_FINAL : public mozIStorageFunction
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
@@ -205,17 +206,17 @@ public:
 };
 
 /**
  * SQL function to generate a GUID for a place or bookmark item.  This is just
  * a wrapper around GenerateGUID in Helpers.h.
  *
  * @return a guid for the item.
  */
-class GenerateGUIDFunction : public mozIStorageFunction
+class GenerateGUIDFunction MOZ_FINAL : public mozIStorageFunction
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
@@ -228,17 +229,17 @@ public:
 /**
  * SQL function to unreverse the rev_host of a page.
  *
  * @param rev_host
  *        The rev_host value of the page.
  *
  * @return the unreversed host of the page.
  */
-class GetUnreversedHostFunction : public mozIStorageFunction
+class GetUnreversedHostFunction MOZ_FINAL : public mozIStorageFunction
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
@@ -256,17 +257,17 @@ public:
  * Make a given URL more suitable for searches, by removing common prefixes
  * such as "www."
  *
  * @param url
  *        A URL.
  * @return
  *        The same URL, with redundant parts removed.
  */
-class FixupURLFunction : public mozIStorageFunction
+class FixupURLFunction MOZ_FINAL : public mozIStorageFunction
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
--- a/toolkit/components/places/nsAnnoProtocolHandler.h
+++ b/toolkit/components/places/nsAnnoProtocolHandler.h
@@ -7,22 +7,23 @@
 #define nsAnnoProtocolHandler_h___
 
 #include "nsCOMPtr.h"
 #include "nsIAnnotationService.h"
 #include "nsIProtocolHandler.h"
 #include "nsIURI.h"
 #include "nsString.h"
 #include "nsWeakReference.h"
+#include "mozilla/Attributes.h"
 
 // {e8b8bdb7-c96c-4d82-9c6f-2b3c585ec7ea}
 #define NS_ANNOPROTOCOLHANDLER_CID \
 { 0xe8b8bdb7, 0xc96c, 0x4d82, { 0x9c, 0x6f, 0x2b, 0x3c, 0x58, 0x5e, 0xc7, 0xea } }
 
-class nsAnnoProtocolHandler : public nsIProtocolHandler, public nsSupportsWeakReference
+class nsAnnoProtocolHandler MOZ_FINAL : public nsIProtocolHandler, public nsSupportsWeakReference
 {
 public:
   nsAnnoProtocolHandler() {}
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPROTOCOLHANDLER
 
 private:
--- a/toolkit/components/places/nsAnnotationService.h
+++ b/toolkit/components/places/nsAnnotationService.h
@@ -10,20 +10,21 @@
 #include "nsTArray.h"
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "nsWeakReference.h"
 #include "nsToolkitCompsCID.h"
 #include "Database.h"
 #include "nsString.h"
+#include "mozilla/Attributes.h"
 
-class nsAnnotationService : public nsIAnnotationService
-                          , public nsIObserver
-                          , public nsSupportsWeakReference
+class nsAnnotationService MOZ_FINAL : public nsIAnnotationService
+                                    , public nsIObserver
+                                    , public nsSupportsWeakReference
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIANNOTATIONSERVICE
   NS_DECL_NSIOBSERVER
 
   nsAnnotationService();
 
--- a/toolkit/components/places/nsFaviconService.h
+++ b/toolkit/components/places/nsFaviconService.h
@@ -14,16 +14,17 @@
 #include "nsDataHashtable.h"
 #include "nsServiceManagerUtils.h"
 #include "nsTHashtable.h"
 #include "nsToolkitCompsCID.h"
 #include "nsURIHashKey.h"
 #include "nsITimer.h"
 #include "Database.h"
 #include "mozilla/storage.h"
+#include "mozilla/Attributes.h"
 
 #include "AsyncFaviconHelpers.h"
 
 // Favicons bigger than this size should not be saved to the db to avoid
 // bloating it with large image blobs.
 // This still allows us to accept a favicon even if we cannot optimize it.
 #define MAX_FAVICON_SIZE 10240
 
@@ -45,19 +46,19 @@ public:
   : nsURIHashKey(aOther)
   {
     NS_NOTREACHED("Do not call me!");
   }
   mozilla::places::IconData iconData;
   PRTime created;
 };
 
-class nsFaviconService : public nsIFaviconService
-                       , public mozIAsyncFavicons
-                       , public nsITimerCallback
+class nsFaviconService MOZ_FINAL : public nsIFaviconService
+                                 , public mozIAsyncFavicons
+                                 , public nsITimerCallback
 {
 public:
   nsFaviconService();
 
   /**
    * Obtains the service's object.
    */
   static nsFaviconService* GetSingleton();
--- a/toolkit/components/places/nsNavBookmarks.h
+++ b/toolkit/components/places/nsNavBookmarks.h
@@ -9,16 +9,17 @@
 #include "nsINavBookmarksService.h"
 #include "nsIAnnotationService.h"
 #include "nsITransaction.h"
 #include "nsNavHistory.h"
 #include "nsToolkitCompsCID.h"
 #include "nsCategoryCache.h"
 #include "nsTHashtable.h"
 #include "nsWeakReference.h"
+#include "mozilla/Attributes.h"
 
 class nsNavBookmarks;
 class nsIOutputStream;
 
 namespace mozilla {
 namespace places {
 
   enum BookmarkStatementId {
@@ -80,21 +81,21 @@ namespace places {
   enum BookmarkDate {
     DATE_ADDED = 0
   , LAST_MODIFIED
   };
 
 } // namespace places
 } // namespace mozilla
 
-class nsNavBookmarks : public nsINavBookmarksService
-                     , public nsINavHistoryObserver
-                     , public nsIAnnotationObserver
-                     , public nsIObserver
-                     , public nsSupportsWeakReference
+class nsNavBookmarks MOZ_FINAL : public nsINavBookmarksService
+                               , public nsINavHistoryObserver
+                               , public nsIAnnotationObserver
+                               , public nsIObserver
+                               , public nsSupportsWeakReference
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSINAVBOOKMARKSSERVICE
   NS_DECL_NSINAVHISTORYOBSERVER
   NS_DECL_NSIANNOTATIONOBSERVER
   NS_DECL_NSIOBSERVER
 
@@ -362,17 +363,17 @@ private:
   PRInt64 RecursiveFindRedirectedBookmark(PRInt64 aPlaceId);
 
   static const PRInt32 kGetChildrenIndex_Position;
   static const PRInt32 kGetChildrenIndex_Type;
   static const PRInt32 kGetChildrenIndex_PlaceID;
   static const PRInt32 kGetChildrenIndex_FolderTitle;
   static const PRInt32 kGetChildrenIndex_Guid;
 
-  class RemoveFolderTransaction : public nsITransaction {
+  class RemoveFolderTransaction MOZ_FINAL : public nsITransaction {
   public:
     RemoveFolderTransaction(PRInt64 aID) : mID(aID) {}
 
     NS_DECL_ISUPPORTS
 
     NS_IMETHOD DoTransaction() {
       nsNavBookmarks* bookmarks = nsNavBookmarks::GetBookmarksService();
       NS_ENSURE_TRUE(bookmarks, NS_ERROR_OUT_OF_MEMORY);
--- a/toolkit/components/places/nsNavHistory.h
+++ b/toolkit/components/places/nsNavHistory.h
@@ -24,16 +24,17 @@
 #include "nsToolkitCompsCID.h"
 #include "nsThreadUtils.h"
 #include "nsURIHashKey.h"
 #include "nsTHashtable.h"
 
 #include "nsNavHistoryResult.h"
 #include "nsNavHistoryQuery.h"
 #include "Database.h"
+#include "mozilla/Attributes.h"
 
 #define QUERYUPDATE_TIME 0
 #define QUERYUPDATE_SIMPLE 1
 #define QUERYUPDATE_COMPLEX 2
 #define QUERYUPDATE_COMPLEX_WITH_BOOKMARKS 3
 #define QUERYUPDATE_HOST 4
 
 // This magic number specified an uninitialized value for the
@@ -62,23 +63,23 @@ class nsNavHistory;
 class QueryKeyValuePair;
 class nsIEffectiveTLDService;
 class nsIIDNService;
 class PlacesSQLQueryBuilder;
 class nsIAutoCompleteController;
 
 // nsNavHistory
 
-class nsNavHistory : public nsSupportsWeakReference
-                   , public nsINavHistoryService
-                   , public nsIObserver
-                   , public nsIBrowserHistory
-                   , public nsPIPlacesDatabase
-                   , public nsPIPlacesHistoryListenersNotifier
-                   , public mozIStorageVacuumParticipant
+class nsNavHistory MOZ_FINAL : public nsSupportsWeakReference
+                             , public nsINavHistoryService
+                             , public nsIObserver
+                             , public nsIBrowserHistory
+                             , public nsPIPlacesDatabase
+                             , public nsPIPlacesHistoryListenersNotifier
+                             , public mozIStorageVacuumParticipant
 {
   friend class PlacesSQLQueryBuilder;
 
 public:
   nsNavHistory();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSINAVHISTORYSERVICE
--- a/toolkit/components/places/nsNavHistoryQuery.h
+++ b/toolkit/components/places/nsNavHistoryQuery.h
@@ -12,20 +12,22 @@
 #ifndef nsNavHistoryQuery_h_
 #define nsNavHistoryQuery_h_
 
 // nsNavHistoryQuery
 //
 //    This class encapsulates the parameters for basic history queries for
 //    building UI, trees, lists, etc.
 
+#include "mozilla/Attributes.h"
+
 #define NS_NAVHISTORYQUERY_IID \
 { 0xb10185e0, 0x86eb, 0x4612, { 0x95, 0x7c, 0x09, 0x34, 0xf2, 0xb1, 0xce, 0xd7 } }
 
-class nsNavHistoryQuery : public nsINavHistoryQuery
+class nsNavHistoryQuery MOZ_FINAL : public nsINavHistoryQuery
 {
 public:
   nsNavHistoryQuery();
   // note: we use a copy constructor in Clone(), the default is good enough
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_NAVHISTORYQUERY_IID)
   NS_DECL_ISUPPORTS
   NS_DECL_NSINAVHISTORYQUERY
@@ -92,17 +94,17 @@ protected:
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryQuery, NS_NAVHISTORYQUERY_IID)
 
 // nsNavHistoryQueryOptions
 
 #define NS_NAVHISTORYQUERYOPTIONS_IID \
 {0x95f8ba3b, 0xd681, 0x4d89, {0xab, 0xd1, 0xfd, 0xae, 0xf2, 0xa3, 0xde, 0x18}}
 
-class nsNavHistoryQueryOptions : public nsINavHistoryQueryOptions
+class nsNavHistoryQueryOptions MOZ_FINAL : public nsINavHistoryQueryOptions
 {
 public:
   nsNavHistoryQueryOptions()
   : mSort(0)
   , mResultType(0)
   , mExcludeItems(false)
   , mExcludeQueries(false)
   , mExcludeReadOnlyFolders(false)