diff options
author | ziadh@chromium.org <ziadh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-30 20:39:31 +0000 |
---|---|---|
committer | ziadh@chromium.org <ziadh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-30 20:39:31 +0000 |
commit | 1bc6c551f14f237d5d56b18afb87ea1570483c1c (patch) | |
tree | 3a5b2c22e19d3d06d82580a88754e944d3aac7c3 | |
parent | de1e675607fb3f8fb34f90093f3b9500cf3f2e46 (diff) | |
download | chromium_src-1bc6c551f14f237d5d56b18afb87ea1570483c1c.zip chromium_src-1bc6c551f14f237d5d56b18afb87ea1570483c1c.tar.gz chromium_src-1bc6c551f14f237d5d56b18afb87ea1570483c1c.tar.bz2 |
Add undeclared virtual destructors part 3
Preventative maintenance for abstract classes that do not declare virtual
destructors. Base classes that do not declare their destructors as virtual
could potentially lead to memory leaks.
These files were discovered using the -Wnon-virtual-dtor flag in g++.
r=jar
BUG=47469
Review URL: http://codereview.chromium.org/3072010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54373 0039d316-1c4b-4281-b951-d872f2087c98
36 files changed, 77 insertions, 17 deletions
diff --git a/chrome/browser/autofill/auto_fill_editor_gtk.cc b/chrome/browser/autofill/auto_fill_editor_gtk.cc index f3d0e9f..e909d62 100644 --- a/chrome/browser/autofill/auto_fill_editor_gtk.cc +++ b/chrome/browser/autofill/auto_fill_editor_gtk.cc @@ -160,7 +160,7 @@ class AutoFillProfileEditor { private: friend class DeleteTask<AutoFillProfileEditor>; - ~AutoFillProfileEditor() {} + virtual ~AutoFillProfileEditor() {} void Init(); @@ -541,7 +541,7 @@ class AutoFillCreditCardEditor { COL_COUNT }; - ~AutoFillCreditCardEditor() {} + virtual ~AutoFillCreditCardEditor() {} // Creates the GtkListStore used to show the billing addresses. GtkListStore* CreateAddressStore(); diff --git a/chrome/browser/bug_report_util.cc b/chrome/browser/bug_report_util.cc index 0694593..d60ef4e 100644 --- a/chrome/browser/bug_report_util.cc +++ b/chrome/browser/bug_report_util.cc @@ -56,6 +56,10 @@ class BugReportUtil::PostCleanup : public URLFetcher::Delegate { int response_code, const ResponseCookies& cookies, const std::string& data); + + protected: + virtual ~PostCleanup() {} + private: DISALLOW_COPY_AND_ASSIGN(PostCleanup); }; diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc index 806ffe2..81e4c26 100644 --- a/chrome/browser/chrome_plugin_host.cc +++ b/chrome/browser/chrome_plugin_host.cc @@ -305,7 +305,7 @@ class ModelessHtmlDialogDelegate : public HtmlDialogUIDelegate { main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &ModelessHtmlDialogDelegate::Show)); } - ~ModelessHtmlDialogDelegate() { + virtual ~ModelessHtmlDialogDelegate() { DCHECK(ChromePluginLib::IsPluginThread()); } diff --git a/chrome/browser/dom_ui/html_dialog_ui.h b/chrome/browser/dom_ui/html_dialog_ui.h index 63961a6..e4220ed 100644 --- a/chrome/browser/dom_ui/html_dialog_ui.h +++ b/chrome/browser/dom_ui/html_dialog_ui.h @@ -52,7 +52,7 @@ class HtmlDialogUIDelegate { virtual void OnCloseContents(TabContents* source, bool* out_close_dialog) = 0; protected: - ~HtmlDialogUIDelegate() {} + virtual ~HtmlDialogUIDelegate() {} }; // Displays file URL contents inside a modal HTML dialog. diff --git a/chrome/browser/extensions/extension_context_menu_model.h b/chrome/browser/extensions/extension_context_menu_model.h index 49a4bb9..bec8d37 100644 --- a/chrome/browser/extensions/extension_context_menu_model.h +++ b/chrome/browser/extensions/extension_context_menu_model.h @@ -28,6 +28,9 @@ class ExtensionContextMenuModel // Called when the user selects the menu item which requests that the // popup be shown and inspected. virtual void InspectPopup(ExtensionAction* action) = 0; + + protected: + virtual ~PopupDelegate() {} }; // Creates a menu model for the given extension action. If diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h index 08fb3ea..001d0e0 100644 --- a/chrome/browser/extensions/extension_install_ui.h +++ b/chrome/browser/extensions/extension_install_ui.h @@ -48,6 +48,9 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { // We call this method after ConfirmInstall()/ConfirmUninstall() to signal // that the installation/uninstallation should stop. virtual void InstallUIAbort() = 0; + + protected: + virtual ~Delegate() {} }; explicit ExtensionInstallUI(Profile* profile); diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h index 6ea2e3b..028c8b5 100644 --- a/chrome/browser/extensions/extension_toolbar_model.h +++ b/chrome/browser/extensions/extension_toolbar_model.h @@ -36,6 +36,9 @@ class ExtensionToolbarModel : public NotificationObserver { // Called when the model has finished loading. virtual void ModelLoaded() {} + + protected: + virtual ~Observer() {} }; // Functions called by the view. diff --git a/chrome/browser/gtk/certificate_manager.cc b/chrome/browser/gtk/certificate_manager.cc index 51d1c7b..c148166 100644 --- a/chrome/browser/gtk/certificate_manager.cc +++ b/chrome/browser/gtk/certificate_manager.cc @@ -50,6 +50,7 @@ std::string Stringize(char* nss_text) { class CertificatePage { public: explicit CertificatePage(psm::CertType type); + virtual ~CertificatePage() {} void PopulateTree(CERTCertList* cert_list); @@ -349,7 +350,7 @@ void CertificatePage::OnViewClicked(GtkWidget* button) { class CertificateManager { public: explicit CertificateManager(gfx::NativeWindow parent, Profile* profile); - ~CertificateManager(); + virtual ~CertificateManager(); // Shows the Tab corresponding to the specified |page|. void ShowCertificatePage(CertificateManagerPage page); diff --git a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h index a8ab071..0e6f92d 100644 --- a/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h +++ b/chrome/browser/gtk/create_application_shortcuts_dialog_gtk.h @@ -33,7 +33,7 @@ class CreateApplicationShortcutsDialogGtk CreateApplicationShortcutsDialogGtk(GtkWindow* parent, TabContents* tab_contents); - ~CreateApplicationShortcutsDialogGtk(); + virtual ~CreateApplicationShortcutsDialogGtk(); CHROMEGTK_CALLBACK_1(CreateApplicationShortcutsDialogGtk, void, OnCreateDialogResponse, int); diff --git a/chrome/browser/gtk/download_in_progress_dialog_gtk.h b/chrome/browser/gtk/download_in_progress_dialog_gtk.h index 9d74f85..86f736a 100644 --- a/chrome/browser/gtk/download_in_progress_dialog_gtk.h +++ b/chrome/browser/gtk/download_in_progress_dialog_gtk.h @@ -17,6 +17,9 @@ class DownloadInProgressDialogGtk { public: explicit DownloadInProgressDialogGtk(Browser* browser); + protected: + virtual ~DownloadInProgressDialogGtk() {} + private: CHROMEGTK_CALLBACK_1(DownloadInProgressDialogGtk, void, OnResponse, int); diff --git a/chrome/browser/gtk/edit_search_engine_dialog.cc b/chrome/browser/gtk/edit_search_engine_dialog.cc index a91ad05..6b23a26 100644 --- a/chrome/browser/gtk/edit_search_engine_dialog.cc +++ b/chrome/browser/gtk/edit_search_engine_dialog.cc @@ -77,6 +77,8 @@ EditSearchEngineDialog::EditSearchEngineDialog( Init(parent_window, profile); } +EditSearchEngineDialog::~EditSearchEngineDialog() {} + void EditSearchEngineDialog::Init(GtkWindow* parent_window, Profile* profile) { std::string dialog_name = l10n_util::GetStringUTF8( controller_->template_url() ? diff --git a/chrome/browser/gtk/edit_search_engine_dialog.h b/chrome/browser/gtk/edit_search_engine_dialog.h index b02ae4f..6fe2b53 100644 --- a/chrome/browser/gtk/edit_search_engine_dialog.h +++ b/chrome/browser/gtk/edit_search_engine_dialog.h @@ -25,6 +25,7 @@ class EditSearchEngineDialog { const TemplateURL* template_url, EditSearchEngineControllerDelegate* delegate, Profile* profile); + virtual ~EditSearchEngineDialog(); private: // Create and show the window. diff --git a/chrome/browser/gtk/external_protocol_dialog_gtk.h b/chrome/browser/gtk/external_protocol_dialog_gtk.h index 6416b30..0703bc8 100644 --- a/chrome/browser/gtk/external_protocol_dialog_gtk.h +++ b/chrome/browser/gtk/external_protocol_dialog_gtk.h @@ -18,6 +18,9 @@ class ExternalProtocolDialogGtk { public: explicit ExternalProtocolDialogGtk(const GURL& url); + protected: + virtual ~ExternalProtocolDialogGtk() {} + private: CHROMEGTK_CALLBACK_1(ExternalProtocolDialogGtk, void, OnDialogResponse, int); diff --git a/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h b/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h index 456d9a1..91be3ef 100644 --- a/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h +++ b/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h @@ -20,7 +20,7 @@ class FullscreenExitBubbleGtk { public: // We place the bubble in |container|. explicit FullscreenExitBubbleGtk(GtkFloatingContainer* container); - ~FullscreenExitBubbleGtk(); + virtual ~FullscreenExitBubbleGtk(); void InitWidgets(); diff --git a/chrome/browser/gtk/gconf_titlebar_listener.h b/chrome/browser/gtk/gconf_titlebar_listener.h index 658da54..4b37588 100644 --- a/chrome/browser/gtk/gconf_titlebar_listener.h +++ b/chrome/browser/gtk/gconf_titlebar_listener.h @@ -32,6 +32,9 @@ class GConfTitlebarListener { // notifications. void RemoveObserver(BrowserTitlebar* titlebar); + protected: + virtual ~GConfTitlebarListener() {} + private: // Private constructor to enforce singleton access. GConfTitlebarListener(); diff --git a/chrome/browser/gtk/gtk_tree.h b/chrome/browser/gtk/gtk_tree.h index 7ed79b9..c9ae35e 100644 --- a/chrome/browser/gtk/gtk_tree.h +++ b/chrome/browser/gtk/gtk_tree.h @@ -114,6 +114,9 @@ class TreeAdapter : public TreeModelObserver { // Called after any change to the GtkTreeStore. virtual void OnAnyModelUpdate() {} + + protected: + virtual ~Delegate() {} }; TreeAdapter(Delegate* delegate, TreeModel* tree_model); diff --git a/chrome/browser/gtk/menu_bar_helper.h b/chrome/browser/gtk/menu_bar_helper.h index 69de87e..286b669 100644 --- a/chrome/browser/gtk/menu_bar_helper.h +++ b/chrome/browser/gtk/menu_bar_helper.h @@ -32,7 +32,7 @@ class MenuBarHelper { // |delegate| cannot be null. explicit MenuBarHelper(Delegate* delegate); - ~MenuBarHelper(); + virtual ~MenuBarHelper(); // Must be called whenever a button's menu starts showing. It triggers the // MenuBarHelper to start listening for certain events. diff --git a/chrome/browser/gtk/options/content_exception_editor.h b/chrome/browser/gtk/options/content_exception_editor.h index 3de04bf..5d375c6 100644 --- a/chrome/browser/gtk/options/content_exception_editor.h +++ b/chrome/browser/gtk/options/content_exception_editor.h @@ -43,6 +43,7 @@ class ContentExceptionEditor { const HostContentSettingsMap::Pattern& pattern, ContentSetting setting, bool is_off_the_record); + virtual ~ContentExceptionEditor() {} private: // Returns true if we're adding a new item. diff --git a/chrome/browser/gtk/options/languages_page_gtk.cc b/chrome/browser/gtk/options/languages_page_gtk.cc index 59eaacf..4b8d8e3 100644 --- a/chrome/browser/gtk/options/languages_page_gtk.cc +++ b/chrome/browser/gtk/options/languages_page_gtk.cc @@ -42,6 +42,8 @@ GtkWidget* NewComboboxFromModel(ComboboxModel* model) { class AddLanguageDialog { public: AddLanguageDialog(Profile* profile, LanguagesPageGtk* delegate); + virtual ~AddLanguageDialog() {} + private: // Callback for dialog buttons. CHROMEGTK_CALLBACK_1(AddLanguageDialog, void, OnResponse, int); diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h index 5fcee8d..c25060a 100644 --- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h +++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h @@ -20,7 +20,7 @@ class PasswordsExceptionsPageGtk { public: explicit PasswordsExceptionsPageGtk(Profile* profile); - ~PasswordsExceptionsPageGtk(); + virtual ~PasswordsExceptionsPageGtk(); GtkWidget* get_page_widget() const { return page_; } diff --git a/chrome/browser/gtk/options/passwords_page_gtk.h b/chrome/browser/gtk/options/passwords_page_gtk.h index 80ff8969..229c55d 100644 --- a/chrome/browser/gtk/options/passwords_page_gtk.h +++ b/chrome/browser/gtk/options/passwords_page_gtk.h @@ -17,7 +17,7 @@ class PasswordsPageGtk { public: explicit PasswordsPageGtk(Profile* profile); - ~PasswordsPageGtk(); + virtual ~PasswordsPageGtk(); GtkWidget* get_page_widget() const { return page_; } diff --git a/chrome/browser/gtk/sad_tab_gtk.h b/chrome/browser/gtk/sad_tab_gtk.h index 1661217..6d7b9d5 100644 --- a/chrome/browser/gtk/sad_tab_gtk.h +++ b/chrome/browser/gtk/sad_tab_gtk.h @@ -16,7 +16,7 @@ class TabContents; class SadTabGtk { public: explicit SadTabGtk(TabContents* tab_contents); - ~SadTabGtk(); + virtual ~SadTabGtk(); GtkWidget* widget() const { return event_box_.get(); } diff --git a/chrome/browser/gtk/tabs/tab_gtk.h b/chrome/browser/gtk/tabs/tab_gtk.h index 8a2786c..54a7a5a 100644 --- a/chrome/browser/gtk/tabs/tab_gtk.h +++ b/chrome/browser/gtk/tabs/tab_gtk.h @@ -80,7 +80,7 @@ class TabGtk : public TabRendererGtk, virtual ThemeProvider* GetThemeProvider() = 0; protected: - ~TabDelegate() {} + virtual ~TabDelegate() {} }; explicit TabGtk(TabDelegate* delegate); diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h index c3b2502..c47c894 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h @@ -173,7 +173,7 @@ class TabStripGtk : public TabStripModelObserver, class DropInfo { public: DropInfo(int index, bool drop_before, bool point_down); - ~DropInfo(); + virtual ~DropInfo(); // TODO(jhawkins): Factor out this code into a TransparentContainer class. diff --git a/chrome/browser/pref_service.h b/chrome/browser/pref_service.h index 3fec4eb..62d01f8 100644 --- a/chrome/browser/pref_service.h +++ b/chrome/browser/pref_service.h @@ -107,7 +107,7 @@ class PrefService : public NonThreadSafe { // preference values. explicit PrefService(PrefValueStore* pref_value_store); - ~PrefService(); + virtual ~PrefService(); // Reloads the data from file. This should only be called when the importer // is running during first run, and the main process may not change pref diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h index 8547656..98dd0b0 100644 --- a/chrome/browser/safe_browsing/protocol_manager.h +++ b/chrome/browser/safe_browsing/protocol_manager.h @@ -70,7 +70,7 @@ class SafeBrowsingProtocolManager : public URLFetcher::Delegate { const std::string& info_url_prefix, const std::string& mackey_url_prefix, bool disable_auto_update); - ~SafeBrowsingProtocolManager(); + virtual ~SafeBrowsingProtocolManager(); // Sets up the update schedule and internal state for making periodic requests // of the SafeBrowsing service. diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h index 55d72f6..7ca6384 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h @@ -146,7 +146,7 @@ class SafeBrowsingBlockingPage : public InterstitialPage { // Factory for creating SafeBrowsingBlockingPage. Useful for tests. class SafeBrowsingBlockingPageFactory { public: - ~SafeBrowsingBlockingPageFactory() { } + virtual ~SafeBrowsingBlockingPageFactory() { } virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( SafeBrowsingService* service, diff --git a/chrome/browser/search_engines/edit_search_engine_controller.h b/chrome/browser/search_engines/edit_search_engine_controller.h index ec6e56a..b250afe 100644 --- a/chrome/browser/search_engines/edit_search_engine_controller.h +++ b/chrome/browser/search_engines/edit_search_engine_controller.h @@ -24,6 +24,9 @@ class EditSearchEngineControllerDelegate { const std::wstring& title, const std::wstring& keyword, const std::string& url) = 0; + + protected: + virtual ~EditSearchEngineControllerDelegate() {} }; // EditSearchEngineController provides the core platform independent logic diff --git a/chrome/browser/search_engines/template_url_parser.h b/chrome/browser/search_engines/template_url_parser.h index b1b29b0..d978da5 100644 --- a/chrome/browser/search_engines/template_url_parser.h +++ b/chrome/browser/search_engines/template_url_parser.h @@ -22,6 +22,9 @@ class TemplateURLParser { // methods returns false, the parameter is not included. virtual bool KeepParameter(const std::string& key, const std::string& value) = 0; + + protected: + virtual ~ParameterFilter() {} }; // Decodes the chunk of data representing a TemplateURL. If data does // not describe a valid TemplateURL false is returned. Additionally, if the diff --git a/chrome/browser/sessions/tab_restore_service.h b/chrome/browser/sessions/tab_restore_service.h index 8237876a..31f22e4 100644 --- a/chrome/browser/sessions/tab_restore_service.h +++ b/chrome/browser/sessions/tab_restore_service.h @@ -44,6 +44,9 @@ class TabRestoreService : public BaseSessionService { // Sent to all remaining Observers when TabRestoreService's // destructor is run. virtual void TabRestoreServiceDestroyed(TabRestoreService* service) = 0; + + protected: + virtual ~Observer() {} }; // Interface used to allow the test to provide a custom time. diff --git a/chrome/browser/shell_dialogs.h b/chrome/browser/shell_dialogs.h index f2857b8..eac3f5e 100644 --- a/chrome/browser/shell_dialogs.h +++ b/chrome/browser/shell_dialogs.h @@ -34,6 +34,9 @@ class BaseShellDialog { // Notifies the dialog box that the listener has been destroyed and it should // no longer be sent notifications. virtual void ListenerDestroyed() = 0; + + protected: + virtual ~BaseShellDialog() {} }; // Shows a dialog box for selecting a file or a folder. @@ -69,6 +72,9 @@ class SelectFileDialog // the user canceling or closing the selection dialog box, for example). // |params| is contextual passed to SelectFile. virtual void FileSelectionCanceled(void* params) {} + + protected: + virtual ~Listener() {} }; // Creates a dialog box helper. This object is ref-counted, but the returned @@ -152,6 +158,9 @@ class SelectFontDialog // canceling or closing the selection dialog box, for example). |params| is // contextual passed to SelectFont. virtual void FontSelectionCanceled(void* params) {} + + protected: + virtual ~Listener() {} }; // Creates a dialog box helper. This object is ref-counted, but the returned diff --git a/chrome/browser/ssl/ssl_blocking_page.h b/chrome/browser/ssl/ssl_blocking_page.h index 65081ca..0e76152 100644 --- a/chrome/browser/ssl/ssl_blocking_page.h +++ b/chrome/browser/ssl/ssl_blocking_page.h @@ -32,6 +32,9 @@ class SSLBlockingPage : public InterstitialPage { // Notification that the user chose to accept the certificate. virtual void OnAllowCertificate(SSLCertErrorHandler* handler) = 0; + + protected: + virtual ~Delegate() {} }; // The severity of the certificate error. diff --git a/chrome/browser/tab_contents/page_navigator.h b/chrome/browser/tab_contents/page_navigator.h index 2bc9150..8773146 100644 --- a/chrome/browser/tab_contents/page_navigator.h +++ b/chrome/browser/tab_contents/page_navigator.h @@ -22,6 +22,9 @@ class PageNavigator { virtual void OpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition, PageTransition::Type transition) = 0; + + protected: + virtual ~PageNavigator() {} }; #endif // CHROME_BROWSER_TAB_CONTENTS_PAGE_NAVIGATOR_H_ diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.h b/chrome/browser/tab_contents/render_view_host_delegate_helper.h index d6f0cce..331f086 100644 --- a/chrome/browser/tab_contents/render_view_host_delegate_helper.h +++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.h @@ -35,6 +35,7 @@ class TabContents; class RenderViewHostDelegateViewHelper { public: RenderViewHostDelegateViewHelper() {} + virtual ~RenderViewHostDelegateViewHelper() {} // Creates a new renderer for window.open. This will either be a // BackgroundContents (if the window_container_type == diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index 3a96e1a..9b30f7b 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -53,6 +53,9 @@ class TestInterstitialPage : public InterstitialPage { public: virtual void TestInterstitialPageDeleted( TestInterstitialPage* interstitial) = 0; + + protected: + virtual ~Delegate() {} }; // IMPORTANT NOTE: if you pass stack allocated values for |state| and diff --git a/chrome/browser/tab_contents/web_drag_dest_gtk.h b/chrome/browser/tab_contents/web_drag_dest_gtk.h index 3367a81..b302e79 100644 --- a/chrome/browser/tab_contents/web_drag_dest_gtk.h +++ b/chrome/browser/tab_contents/web_drag_dest_gtk.h @@ -24,7 +24,7 @@ class TabContents; class WebDragDestGtk { public: WebDragDestGtk(TabContents* tab_contents, GtkWidget* widget); - ~WebDragDestGtk(); + virtual ~WebDragDestGtk(); // This is called when the renderer responds to a drag motion event. We must // update the system drag cursor. |