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

This commit is contained in:
Ehsan Akhgari 2012-06-19 23:58:39 -04:00
parent f0e8ed53c6
commit fa771541c8
10 changed files with 42 additions and 31 deletions

View File

@ -23,6 +23,7 @@
#include "mozilla/Util.h" #include "mozilla/Util.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "mozilla/Attributes.h"
// Time between corrupt database backups. // Time between corrupt database backups.
#define RECENT_BACKUP_TIME_MICROSEC (PRInt64)86400 * PR_USEC_PER_SEC // 24H #define RECENT_BACKUP_TIME_MICROSEC (PRInt64)86400 * PR_USEC_PER_SEC // 24H
@ -208,7 +209,7 @@ SetJournalMode(nsCOMPtr<mozIStorageConnection>& aDBConn,
return JOURNAL_DELETE; return JOURNAL_DELETE;
} }
class BlockingConnectionCloseCallback : public mozIStorageCompletionCallback { class BlockingConnectionCloseCallback MOZ_FINAL : public mozIStorageCompletionCallback {
bool mDone; bool mDone;
public: public:

View File

@ -11,6 +11,7 @@
#include "nsIObserver.h" #include "nsIObserver.h"
#include "mozilla/storage.h" #include "mozilla/storage.h"
#include "mozilla/storage/StatementCache.h" #include "mozilla/storage/StatementCache.h"
#include "mozilla/Attributes.h"
// This is the schema version. Update it at any schema change and add a // This is the schema version. Update it at any schema change and add a
// corresponding migrateVxx method below. // corresponding migrateVxx method below.
@ -58,8 +59,8 @@ enum JournalMode {
, JOURNAL_WAL , JOURNAL_WAL
}; };
class Database : public nsIObserver class Database MOZ_FINAL : public nsIObserver
, public nsSupportsWeakReference , public nsSupportsWeakReference
{ {
typedef mozilla::storage::StatementCache<mozIStorageStatement> StatementCache; typedef mozilla::storage::StatementCache<mozIStorageStatement> StatementCache;
typedef mozilla::storage::StatementCache<mozIStorageAsyncStatement> AsyncStatementCache; typedef mozilla::storage::StatementCache<mozIStorageAsyncStatement> AsyncStatementCache;

View File

@ -27,6 +27,7 @@
#include "mozilla/Util.h" #include "mozilla/Util.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsIMemoryReporter.h" #include "nsIMemoryReporter.h"
#include "mozilla/Attributes.h"
// Initial size for the cache holding visited status observers. // Initial size for the cache holding visited status observers.
#define VISIT_OBSERVERS_INITIAL_CACHE_SIZE 128 #define VISIT_OBSERVERS_INITIAL_CACHE_SIZE 128
@ -1248,7 +1249,7 @@ private:
/** /**
* Adds download-specific annotations to a download page. * Adds download-specific annotations to a download page.
*/ */
class SetDownloadAnnotations : public mozIVisitInfoCallback class SetDownloadAnnotations MOZ_FINAL : public mozIVisitInfoCallback
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS

View File

@ -12,6 +12,7 @@
*/ */
#include "mozIStorageFunction.h" #include "mozIStorageFunction.h"
#include "mozilla/Attributes.h"
class mozIStorageConnection; class mozIStorageConnection;
@ -52,7 +53,7 @@ namespace places {
* @param aSearchBehavior * @param aSearchBehavior
* A bitfield dictating the search behavior. * A bitfield dictating the search behavior.
*/ */
class MatchAutoCompleteFunction : public mozIStorageFunction class MatchAutoCompleteFunction MOZ_FINAL : public mozIStorageFunction
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -189,7 +190,7 @@ private:
* @param [optional] isBookmarked * @param [optional] isBookmarked
* Whether the page is bookmarked. Default is false. * Whether the page is bookmarked. Default is false.
*/ */
class CalculateFrecencyFunction : public mozIStorageFunction class CalculateFrecencyFunction MOZ_FINAL : public mozIStorageFunction
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -210,7 +211,7 @@ public:
* *
* @return a guid for the item. * @return a guid for the item.
*/ */
class GenerateGUIDFunction : public mozIStorageFunction class GenerateGUIDFunction MOZ_FINAL : public mozIStorageFunction
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -233,7 +234,7 @@ public:
* *
* @return the unreversed host of the page. * @return the unreversed host of the page.
*/ */
class GetUnreversedHostFunction : public mozIStorageFunction class GetUnreversedHostFunction MOZ_FINAL : public mozIStorageFunction
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -261,7 +262,7 @@ public:
* @return * @return
* The same URL, with redundant parts removed. * The same URL, with redundant parts removed.
*/ */
class FixupURLFunction : public mozIStorageFunction class FixupURLFunction MOZ_FINAL : public mozIStorageFunction
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS

View File

@ -12,12 +12,13 @@
#include "nsIURI.h" #include "nsIURI.h"
#include "nsString.h" #include "nsString.h"
#include "nsWeakReference.h" #include "nsWeakReference.h"
#include "mozilla/Attributes.h"
// {e8b8bdb7-c96c-4d82-9c6f-2b3c585ec7ea} // {e8b8bdb7-c96c-4d82-9c6f-2b3c585ec7ea}
#define NS_ANNOPROTOCOLHANDLER_CID \ #define NS_ANNOPROTOCOLHANDLER_CID \
{ 0xe8b8bdb7, 0xc96c, 0x4d82, { 0x9c, 0x6f, 0x2b, 0x3c, 0x58, 0x5e, 0xc7, 0xea } } { 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: public:
nsAnnoProtocolHandler() {} nsAnnoProtocolHandler() {}

View File

@ -15,10 +15,11 @@
#include "nsToolkitCompsCID.h" #include "nsToolkitCompsCID.h"
#include "Database.h" #include "Database.h"
#include "nsString.h" #include "nsString.h"
#include "mozilla/Attributes.h"
class nsAnnotationService : public nsIAnnotationService class nsAnnotationService MOZ_FINAL : public nsIAnnotationService
, public nsIObserver , public nsIObserver
, public nsSupportsWeakReference , public nsSupportsWeakReference
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS

View File

@ -19,6 +19,7 @@
#include "nsITimer.h" #include "nsITimer.h"
#include "Database.h" #include "Database.h"
#include "mozilla/storage.h" #include "mozilla/storage.h"
#include "mozilla/Attributes.h"
#include "AsyncFaviconHelpers.h" #include "AsyncFaviconHelpers.h"
@ -50,9 +51,9 @@ public:
PRTime created; PRTime created;
}; };
class nsFaviconService : public nsIFaviconService class nsFaviconService MOZ_FINAL : public nsIFaviconService
, public mozIAsyncFavicons , public mozIAsyncFavicons
, public nsITimerCallback , public nsITimerCallback
{ {
public: public:
nsFaviconService(); nsFaviconService();

View File

@ -14,6 +14,7 @@
#include "nsCategoryCache.h" #include "nsCategoryCache.h"
#include "nsTHashtable.h" #include "nsTHashtable.h"
#include "nsWeakReference.h" #include "nsWeakReference.h"
#include "mozilla/Attributes.h"
class nsNavBookmarks; class nsNavBookmarks;
class nsIOutputStream; class nsIOutputStream;
@ -85,11 +86,11 @@ namespace places {
} // namespace places } // namespace places
} // namespace mozilla } // namespace mozilla
class nsNavBookmarks : public nsINavBookmarksService class nsNavBookmarks MOZ_FINAL : public nsINavBookmarksService
, public nsINavHistoryObserver , public nsINavHistoryObserver
, public nsIAnnotationObserver , public nsIAnnotationObserver
, public nsIObserver , public nsIObserver
, public nsSupportsWeakReference , public nsSupportsWeakReference
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
@ -367,7 +368,7 @@ private:
static const PRInt32 kGetChildrenIndex_FolderTitle; static const PRInt32 kGetChildrenIndex_FolderTitle;
static const PRInt32 kGetChildrenIndex_Guid; static const PRInt32 kGetChildrenIndex_Guid;
class RemoveFolderTransaction : public nsITransaction { class RemoveFolderTransaction MOZ_FINAL : public nsITransaction {
public: public:
RemoveFolderTransaction(PRInt64 aID) : mID(aID) {} RemoveFolderTransaction(PRInt64 aID) : mID(aID) {}

View File

@ -29,6 +29,7 @@
#include "nsNavHistoryResult.h" #include "nsNavHistoryResult.h"
#include "nsNavHistoryQuery.h" #include "nsNavHistoryQuery.h"
#include "Database.h" #include "Database.h"
#include "mozilla/Attributes.h"
#define QUERYUPDATE_TIME 0 #define QUERYUPDATE_TIME 0
#define QUERYUPDATE_SIMPLE 1 #define QUERYUPDATE_SIMPLE 1
@ -67,13 +68,13 @@ class nsIAutoCompleteController;
// nsNavHistory // nsNavHistory
class nsNavHistory : public nsSupportsWeakReference class nsNavHistory MOZ_FINAL : public nsSupportsWeakReference
, public nsINavHistoryService , public nsINavHistoryService
, public nsIObserver , public nsIObserver
, public nsIBrowserHistory , public nsIBrowserHistory
, public nsPIPlacesDatabase , public nsPIPlacesDatabase
, public nsPIPlacesHistoryListenersNotifier , public nsPIPlacesHistoryListenersNotifier
, public mozIStorageVacuumParticipant , public mozIStorageVacuumParticipant
{ {
friend class PlacesSQLQueryBuilder; friend class PlacesSQLQueryBuilder;

View File

@ -17,10 +17,12 @@
// This class encapsulates the parameters for basic history queries for // This class encapsulates the parameters for basic history queries for
// building UI, trees, lists, etc. // building UI, trees, lists, etc.
#include "mozilla/Attributes.h"
#define NS_NAVHISTORYQUERY_IID \ #define NS_NAVHISTORYQUERY_IID \
{ 0xb10185e0, 0x86eb, 0x4612, { 0x95, 0x7c, 0x09, 0x34, 0xf2, 0xb1, 0xce, 0xd7 } } { 0xb10185e0, 0x86eb, 0x4612, { 0x95, 0x7c, 0x09, 0x34, 0xf2, 0xb1, 0xce, 0xd7 } }
class nsNavHistoryQuery : public nsINavHistoryQuery class nsNavHistoryQuery MOZ_FINAL : public nsINavHistoryQuery
{ {
public: public:
nsNavHistoryQuery(); nsNavHistoryQuery();
@ -97,7 +99,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryQuery, NS_NAVHISTORYQUERY_IID)
#define NS_NAVHISTORYQUERYOPTIONS_IID \ #define NS_NAVHISTORYQUERYOPTIONS_IID \
{0x95f8ba3b, 0xd681, 0x4d89, {0xab, 0xd1, 0xfd, 0xae, 0xf2, 0xa3, 0xde, 0x18}} {0x95f8ba3b, 0xd681, 0x4d89, {0xab, 0xd1, 0xfd, 0xae, 0xf2, 0xa3, 0xde, 0x18}}
class nsNavHistoryQueryOptions : public nsINavHistoryQueryOptions class nsNavHistoryQueryOptions MOZ_FINAL : public nsINavHistoryQueryOptions
{ {
public: public:
nsNavHistoryQueryOptions() nsNavHistoryQueryOptions()