From 4984997def64a88c35916af306b1670b32534bd9 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 19 Jun 2012 23:58:39 -0400 Subject: [PATCH] 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 | 3 ++- toolkit/components/places/Database.h | 5 +++-- toolkit/components/places/History.cpp | 3 ++- toolkit/components/places/SQLFunctions.h | 11 ++++++----- toolkit/components/places/nsAnnoProtocolHandler.h | 3 ++- toolkit/components/places/nsAnnotationService.h | 7 ++++--- toolkit/components/places/nsFaviconService.h | 7 ++++--- toolkit/components/places/nsNavBookmarks.h | 13 +++++++------ toolkit/components/places/nsNavHistory.h | 15 ++++++++------- toolkit/components/places/nsNavHistoryQuery.h | 6 ++++-- 10 files changed, 42 insertions(+), 31 deletions(-) diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index ad84372493d5..940c9540b2b0 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -23,6 +23,7 @@ #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 @@ -208,7 +209,7 @@ SetJournalMode(nsCOMPtr& aDBConn, return JOURNAL_DELETE; } -class BlockingConnectionCloseCallback : public mozIStorageCompletionCallback { +class BlockingConnectionCloseCallback MOZ_FINAL : public mozIStorageCompletionCallback { bool mDone; public: diff --git a/toolkit/components/places/Database.h b/toolkit/components/places/Database.h index 7c7d460409c0..be74249a2ad9 100644 --- a/toolkit/components/places/Database.h +++ b/toolkit/components/places/Database.h @@ -11,6 +11,7 @@ #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. @@ -58,8 +59,8 @@ enum JournalMode { , JOURNAL_WAL }; -class Database : public nsIObserver - , public nsSupportsWeakReference +class Database MOZ_FINAL : public nsIObserver + , public nsSupportsWeakReference { typedef mozilla::storage::StatementCache StatementCache; typedef mozilla::storage::StatementCache AsyncStatementCache; diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index aeb6c52151be..7154c24250bc 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -27,6 +27,7 @@ #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 @@ -1248,7 +1249,7 @@ private: /** * Adds download-specific annotations to a download page. */ -class SetDownloadAnnotations : public mozIVisitInfoCallback +class SetDownloadAnnotations MOZ_FINAL : public mozIVisitInfoCallback { public: NS_DECL_ISUPPORTS diff --git a/toolkit/components/places/SQLFunctions.h b/toolkit/components/places/SQLFunctions.h index f55dbb5ecca1..aac3ba7f42d4 100644 --- a/toolkit/components/places/SQLFunctions.h +++ b/toolkit/components/places/SQLFunctions.h @@ -12,6 +12,7 @@ */ #include "mozIStorageFunction.h" +#include "mozilla/Attributes.h" class mozIStorageConnection; @@ -52,7 +53,7 @@ namespace places { * @param aSearchBehavior * A bitfield dictating the search behavior. */ -class MatchAutoCompleteFunction : public mozIStorageFunction +class MatchAutoCompleteFunction MOZ_FINAL : public mozIStorageFunction { public: NS_DECL_ISUPPORTS @@ -189,7 +190,7 @@ private: * @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 @@ -210,7 +211,7 @@ public: * * @return a guid for the item. */ -class GenerateGUIDFunction : public mozIStorageFunction +class GenerateGUIDFunction MOZ_FINAL : public mozIStorageFunction { public: NS_DECL_ISUPPORTS @@ -233,7 +234,7 @@ public: * * @return the unreversed host of the page. */ -class GetUnreversedHostFunction : public mozIStorageFunction +class GetUnreversedHostFunction MOZ_FINAL : public mozIStorageFunction { public: NS_DECL_ISUPPORTS @@ -261,7 +262,7 @@ public: * @return * The same URL, with redundant parts removed. */ -class FixupURLFunction : public mozIStorageFunction +class FixupURLFunction MOZ_FINAL : public mozIStorageFunction { public: NS_DECL_ISUPPORTS diff --git a/toolkit/components/places/nsAnnoProtocolHandler.h b/toolkit/components/places/nsAnnoProtocolHandler.h index 221007c15955..705a5b3102f3 100644 --- a/toolkit/components/places/nsAnnoProtocolHandler.h +++ b/toolkit/components/places/nsAnnoProtocolHandler.h @@ -12,12 +12,13 @@ #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() {} diff --git a/toolkit/components/places/nsAnnotationService.h b/toolkit/components/places/nsAnnotationService.h index 35c3f9cffae2..d8fae24e2348 100644 --- a/toolkit/components/places/nsAnnotationService.h +++ b/toolkit/components/places/nsAnnotationService.h @@ -15,10 +15,11 @@ #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 diff --git a/toolkit/components/places/nsFaviconService.h b/toolkit/components/places/nsFaviconService.h index 686b6cca38ba..529f0c54e262 100644 --- a/toolkit/components/places/nsFaviconService.h +++ b/toolkit/components/places/nsFaviconService.h @@ -19,6 +19,7 @@ #include "nsITimer.h" #include "Database.h" #include "mozilla/storage.h" +#include "mozilla/Attributes.h" #include "AsyncFaviconHelpers.h" @@ -50,9 +51,9 @@ public: PRTime created; }; -class nsFaviconService : public nsIFaviconService - , public mozIAsyncFavicons - , public nsITimerCallback +class nsFaviconService MOZ_FINAL : public nsIFaviconService + , public mozIAsyncFavicons + , public nsITimerCallback { public: nsFaviconService(); diff --git a/toolkit/components/places/nsNavBookmarks.h b/toolkit/components/places/nsNavBookmarks.h index 5bc73c8af541..4e2fade1eadb 100644 --- a/toolkit/components/places/nsNavBookmarks.h +++ b/toolkit/components/places/nsNavBookmarks.h @@ -14,6 +14,7 @@ #include "nsCategoryCache.h" #include "nsTHashtable.h" #include "nsWeakReference.h" +#include "mozilla/Attributes.h" class nsNavBookmarks; class nsIOutputStream; @@ -85,11 +86,11 @@ namespace places { } // 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 @@ -367,7 +368,7 @@ private: 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) {} diff --git a/toolkit/components/places/nsNavHistory.h b/toolkit/components/places/nsNavHistory.h index a96dd023adea..c973b72d1ba9 100644 --- a/toolkit/components/places/nsNavHistory.h +++ b/toolkit/components/places/nsNavHistory.h @@ -29,6 +29,7 @@ #include "nsNavHistoryResult.h" #include "nsNavHistoryQuery.h" #include "Database.h" +#include "mozilla/Attributes.h" #define QUERYUPDATE_TIME 0 #define QUERYUPDATE_SIMPLE 1 @@ -67,13 +68,13 @@ 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; diff --git a/toolkit/components/places/nsNavHistoryQuery.h b/toolkit/components/places/nsNavHistoryQuery.h index 1aaa186dcc32..4292a4d873a8 100644 --- a/toolkit/components/places/nsNavHistoryQuery.h +++ b/toolkit/components/places/nsNavHistoryQuery.h @@ -17,10 +17,12 @@ // 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(); @@ -97,7 +99,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryQuery, NS_NAVHISTORYQUERY_IID) #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()