diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 00:31:36 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 00:31:36 +0000 |
commit | b1f498e33399652b128d9801ad7d96bbeee4ba87 (patch) | |
tree | c6ebb70ec1495990f9f3cd028717b0742b9f4614 /chrome | |
parent | 666b8f577de314cfe3b232345063248878b0150e (diff) | |
download | chromium_src-b1f498e33399652b128d9801ad7d96bbeee4ba87.zip chromium_src-b1f498e33399652b128d9801ad7d96bbeee4ba87.tar.gz chromium_src-b1f498e33399652b128d9801ad7d96bbeee4ba87.tar.bz2 |
Fifth patch in making destructors of refcounted objects private.
BUG=26749
Review URL: http://codereview.chromium.org/361025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
26 files changed, 74 insertions, 16 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h index 0416328..0193b8c 100644 --- a/chrome/browser/autocomplete/autocomplete.h +++ b/chrome/browser/autocomplete/autocomplete.h @@ -483,8 +483,6 @@ class AutocompleteProvider name_(name) { } - virtual ~AutocompleteProvider(); - // Invoked when the profile changes. // NOTE: Do not access any previous Profile* at this point as it may have // already been deleted. @@ -538,6 +536,10 @@ class AutocompleteProvider static size_t max_matches() { return max_matches_; } protected: + friend class base::RefCountedThreadSafe<AutocompleteProvider>; + + virtual ~AutocompleteProvider(); + // Trims "http:" and up to two subsequent slashes from |url|. Returns the // number of characters that were trimmed. static size_t TrimHttpPrefix(std::wstring* url); diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc index adff59c..0e8671a 100644 --- a/chrome/browser/autocomplete/autocomplete_unittest.cc +++ b/chrome/browser/autocomplete/autocomplete_unittest.cc @@ -35,6 +35,8 @@ class TestProvider : public AutocompleteProvider { } private: + ~TestProvider() {} + void Run(); void AddResults(int start_at, int num); diff --git a/chrome/browser/autocomplete/history_contents_provider.h b/chrome/browser/autocomplete/history_contents_provider.h index 49ca83e..18a4b36 100644 --- a/chrome/browser/autocomplete/history_contents_provider.h +++ b/chrome/browser/autocomplete/history_contents_provider.h @@ -49,6 +49,8 @@ class HistoryContentsProvider : public AutocompleteProvider { static const size_t kMaxMatchCount = 50; private: + ~HistoryContentsProvider() {} + void QueryComplete(HistoryService::Handle handle, history::QueryResults* results); diff --git a/chrome/browser/autocomplete/history_url_provider.h b/chrome/browser/autocomplete/history_url_provider.h index b87a2e3..50f6ba7 100644 --- a/chrome/browser/autocomplete/history_url_provider.h +++ b/chrome/browser/autocomplete/history_url_provider.h @@ -177,6 +177,8 @@ class HistoryURLProvider : public AutocompleteProvider { void QueryComplete(HistoryURLProviderParams* params_gets_deleted); private: + ~HistoryURLProvider() {} + struct Prefix { Prefix(std::wstring prefix, int num_components) : prefix(prefix), diff --git a/chrome/browser/autocomplete/keyword_provider.h b/chrome/browser/autocomplete/keyword_provider.h index 6caa2b1..adf81d8 100644 --- a/chrome/browser/autocomplete/keyword_provider.h +++ b/chrome/browser/autocomplete/keyword_provider.h @@ -69,6 +69,8 @@ class KeywordProvider : public AutocompleteProvider { bool minimal_changes); private: + ~KeywordProvider() {} + // Extracts the keyword from |input| into |keyword|. Any remaining characters // after the keyword are placed in |remaining_input|. Returns true if |input| // is valid and has a keyword. This makes use of SplitKeywordFromInput to diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h index f333c4f..f36c070 100644 --- a/chrome/browser/autocomplete/search_provider.h +++ b/chrome/browser/autocomplete/search_provider.h @@ -75,6 +75,8 @@ class SearchProvider : public AutocompleteProvider, static const int kKeywordProviderURLFetcherID; private: + ~SearchProvider() {} + // Manages the providers (TemplateURLs) used by SearchProvider. Two providers // may be used: // . The default provider. This corresponds to the user's default search diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index dc540da..418c804 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -56,7 +56,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, public IPC::Message::Sender { public: explicit AutomationProvider(Profile* profile); - virtual ~AutomationProvider(); Profile* profile() const { return profile_; } @@ -131,6 +130,10 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, // Adds the external tab passed in to the tab tracker. bool AddExternalTab(ExternalTabContainer* external_tab); + protected: + friend class base::RefCounted<AutomationProvider>; + virtual ~AutomationProvider(); + private: // IPC Message callbacks. void CloseBrowser(int handle, IPC::Message* reply_message); @@ -567,7 +570,6 @@ class TestingAutomationProvider : public AutomationProvider, public NotificationObserver { public: explicit TestingAutomationProvider(Profile* profile); - virtual ~TestingAutomationProvider(); // BrowserList::Observer implementation // Called immediately after a browser is added to the list @@ -580,6 +582,8 @@ class TestingAutomationProvider : public AutomationProvider, virtual void OnChannelError(); private: + virtual ~TestingAutomationProvider(); + virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details); diff --git a/chrome/browser/automation/ui_controls_win.cc b/chrome/browser/automation/ui_controls_win.cc index 29ca089..43e8b32 100644 --- a/chrome/browser/automation/ui_controls_win.cc +++ b/chrome/browser/automation/ui_controls_win.cc @@ -24,8 +24,6 @@ class InputDispatcher : public base::RefCounted<InputDispatcher> { public: InputDispatcher(Task* task, WPARAM message_waiting_for); - ~InputDispatcher(); - // Invoked from the hook. If mouse_message matches message_waiting_for_ // MatchingMessageFound is invoked. void DispatchedMessage(WPARAM mouse_message); @@ -35,6 +33,10 @@ class InputDispatcher : public base::RefCounted<InputDispatcher> { void MatchingMessageFound(); private: + friend class base::RefCounted<InputDispatcher>; + + ~InputDispatcher(); + // Notifies the task and release this (which should delete it). void NotifyTask(); diff --git a/chrome/browser/bookmarks/bookmark_storage.h b/chrome/browser/bookmarks/bookmark_storage.h index d41b2c5..e3e1337 100644 --- a/chrome/browser/bookmarks/bookmark_storage.h +++ b/chrome/browser/bookmarks/bookmark_storage.h @@ -92,7 +92,6 @@ class BookmarkStorage : public NotificationObserver, // Creates a BookmarkStorage for the specified model BookmarkStorage(Profile* profile, BookmarkModel* model); - ~BookmarkStorage(); // Loads the bookmarks into the model, notifying the model when done. This // takes ownership of |details|. See LoadDetails for details. @@ -109,6 +108,10 @@ class BookmarkStorage : public NotificationObserver, virtual bool SerializeData(std::string* output); private: + friend class base::RefCountedThreadSafe<BookmarkStorage>; + + ~BookmarkStorage(); + class LoadTask; // Callback from backend with the results of the bookmark file. diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 21b166e..54bd4f0 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -112,7 +112,6 @@ class AboutSource : public ChromeURLDataManager::DataSource { public: // Creates our datasource. AboutSource(); - virtual ~AboutSource(); // Called when the network layer has requested a resource underneath // the path we registered. @@ -126,6 +125,8 @@ class AboutSource : public ChromeURLDataManager::DataSource { void FinishDataRequest(const std::string& html, int request_id); private: + virtual ~AboutSource(); + DISALLOW_COPY_AND_ASSIGN(AboutSource); }; diff --git a/chrome/browser/chromeos/version_loader.h b/chrome/browser/chromeos/version_loader.h index f118934..1b6e693 100644 --- a/chrome/browser/chromeos/version_loader.h +++ b/chrome/browser/chromeos/version_loader.h @@ -53,6 +53,10 @@ class VersionLoader : public CancelableRequestProvider { void GetVersion(scoped_refptr<GetVersionRequest> request); private: + friend class base::RefCountedThreadSafe<Backend>; + + ~Backend(); + DISALLOW_COPY_AND_ASSIGN(Backend); }; diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.h b/chrome/browser/dom_ui/chrome_url_data_manager.h index c159190..f553a3f 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.h +++ b/chrome/browser/dom_ui/chrome_url_data_manager.h @@ -44,7 +44,6 @@ class ChromeURLDataManager { DataSource(const std::string& source_name, MessageLoop* message_loop) : source_name_(source_name), message_loop_(message_loop) {} - virtual ~DataSource() {} // Sent by the DataManager to request data at |path|. The source should // call SendResponse() when the data is available or if the request could @@ -76,6 +75,11 @@ class ChromeURLDataManager { static void SetFontAndTextDirection(DictionaryValue* localized_strings); + protected: + friend class base::RefCountedThreadSafe<DataSource>; + + virtual ~DataSource() {} + private: // The name of this source. // E.g., for favicons, this could be "favicon", which results in paths for diff --git a/chrome/browser/dom_ui/dom_ui_favicon_source.h b/chrome/browser/dom_ui/dom_ui_favicon_source.h index 6556c39..0d42eaf 100644 --- a/chrome/browser/dom_ui/dom_ui_favicon_source.h +++ b/chrome/browser/dom_ui/dom_ui_favicon_source.h @@ -20,7 +20,6 @@ class Profile; class DOMUIFavIconSource : public ChromeURLDataManager::DataSource { public: explicit DOMUIFavIconSource(Profile* profile); - virtual ~DOMUIFavIconSource() { } // Called when the network layer has requested a resource underneath // the path we registered. @@ -40,6 +39,8 @@ class DOMUIFavIconSource : public ChromeURLDataManager::DataSource { GURL url); private: + virtual ~DOMUIFavIconSource() {} + Profile* profile_; CancelableRequestConsumerT<int, 0> cancelable_consumer_; diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.h b/chrome/browser/dom_ui/dom_ui_theme_source.h index 65f83e7..f20d104 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source.h +++ b/chrome/browser/dom_ui/dom_ui_theme_source.h @@ -26,6 +26,9 @@ class DOMUIThemeSource : public ChromeURLDataManager::DataSource { virtual MessageLoop* MessageLoopForRequestPath(const std::string& path) const; + protected: + virtual ~DOMUIThemeSource() {} + private: // Populate new_tab_css_ and new_incognito_tab_css. These must be called // from the UI thread because they involve profile and theme access. diff --git a/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc b/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc index f33bf27..09e98b2 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc +++ b/chrome/browser/dom_ui/dom_ui_theme_source_unittest.cc @@ -26,6 +26,9 @@ class MockThemeSource : public DOMUIThemeSource { int result_request_id_; size_t result_data_size_; + + private: + ~MockThemeSource() {} }; class DOMUISourcesTest : public testing::Test { diff --git a/chrome/browser/dom_ui/dom_ui_thumbnail_source.h b/chrome/browser/dom_ui/dom_ui_thumbnail_source.h index 48f2879..03263b2 100644 --- a/chrome/browser/dom_ui/dom_ui_thumbnail_source.h +++ b/chrome/browser/dom_ui/dom_ui_thumbnail_source.h @@ -40,6 +40,8 @@ class DOMUIThumbnailSource : public ChromeURLDataManager::DataSource, scoped_refptr<RefCountedBytes> data); private: + ~DOMUIThumbnailSource() {} + // NotificationObserver implementation virtual void Observe(NotificationType type, const NotificationSource& source, diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc index 39adf47e..5dff5b9 100644 --- a/chrome/browser/dom_ui/downloads_ui.cc +++ b/chrome/browser/dom_ui/downloads_ui.cc @@ -41,6 +41,8 @@ class DownloadsUIHTMLSource : public ChromeURLDataManager::DataSource { } private: + ~DownloadsUIHTMLSource() {} + DISALLOW_COPY_AND_ASSIGN(DownloadsUIHTMLSource); }; diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc index 0a07074..182c20a 100644 --- a/chrome/browser/dom_ui/filebrowse_ui.cc +++ b/chrome/browser/dom_ui/filebrowse_ui.cc @@ -50,6 +50,8 @@ class FileBrowseUIHTMLSource : public ChromeURLDataManager::DataSource { } private: + ~FileBrowseUIHTMLSource() {} + DISALLOW_COPY_AND_ASSIGN(FileBrowseUIHTMLSource); }; diff --git a/chrome/browser/dom_ui/fileicon_source.h b/chrome/browser/dom_ui/fileicon_source.h index a13c207..a9f43d7 100644 --- a/chrome/browser/dom_ui/fileicon_source.h +++ b/chrome/browser/dom_ui/fileicon_source.h @@ -18,7 +18,6 @@ class GURL; class FileIconSource : public ChromeURLDataManager::DataSource { public: explicit FileIconSource(); - virtual ~FileIconSource(); // Called when the network layer has requested a resource underneath // the path we registered. @@ -35,6 +34,8 @@ class FileIconSource : public ChromeURLDataManager::DataSource { SkBitmap* icon); private: + virtual ~FileIconSource(); + CancelableRequestConsumerT<int, 0> cancelable_consumer_; // Raw PNG representation of the favicon to show when the favicon diff --git a/chrome/browser/dom_ui/history_ui.h b/chrome/browser/dom_ui/history_ui.h index 3dc51c4..990c423 100644 --- a/chrome/browser/dom_ui/history_ui.h +++ b/chrome/browser/dom_ui/history_ui.h @@ -29,6 +29,8 @@ class HistoryUIHTMLSource : public ChromeURLDataManager::DataSource { } private: + ~HistoryUIHTMLSource() {} + DISALLOW_COPY_AND_ASSIGN(HistoryUIHTMLSource); }; diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 10addde..9dd8dc84 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -144,6 +144,8 @@ class IncognitoTabHTMLSource : public ChromeURLDataManager::DataSource { } private: + ~IncognitoTabHTMLSource() {} + // Populate full_html_. This must be called from the UI thread because it // involves profile access. // diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h index e4b494c..1feac2a 100644 --- a/chrome/browser/dom_ui/new_tab_ui.h +++ b/chrome/browser/dom_ui/new_tab_ui.h @@ -78,6 +78,8 @@ class NewTabUI : public DOMUI, static bool first_run() { return first_run_; } private: + ~NewTabHTMLSource() {} + // In case a file path to the new tab page was provided this tries to load // the file and returns the file content if successful. This returns an // empty string in case of failure. diff --git a/chrome/browser/dom_ui/print_ui.h b/chrome/browser/dom_ui/print_ui.h index 8443da4..508a6c4 100644 --- a/chrome/browser/dom_ui/print_ui.h +++ b/chrome/browser/dom_ui/print_ui.h @@ -31,6 +31,8 @@ class PrintUIHTMLSource : public ChromeURLDataManager::DataSource { } private: + ~PrintUIHTMLSource() {} + DISALLOW_COPY_AND_ASSIGN(PrintUIHTMLSource); }; diff --git a/chrome/browser/extensions/extensions_ui.h b/chrome/browser/extensions/extensions_ui.h index 6023255..352e42c 100644 --- a/chrome/browser/extensions/extensions_ui.h +++ b/chrome/browser/extensions/extensions_ui.h @@ -48,6 +48,8 @@ class ExtensionsUIHTMLSource : public ChromeURLDataManager::DataSource { } private: + ~ExtensionsUIHTMLSource() {} + DISALLOW_COPY_AND_ASSIGN(ExtensionsUIHTMLSource); }; diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc index af2a519..046d7f9 100644 --- a/chrome/browser/process_singleton_linux.cc +++ b/chrome/browser/process_singleton_linux.cc @@ -402,10 +402,6 @@ class ProcessSingleton::LinuxWatcher parent_(parent) { } - virtual ~LinuxWatcher() { - STLDeleteElements(&readers_); - } - // Start listening for connections on the socket. This method should be // called from the IO thread. void StartListening(int socket); @@ -430,6 +426,12 @@ class ProcessSingleton::LinuxWatcher } private: + friend class base::RefCountedThreadSafe<ProcessSingleton::LinuxWatcher>; + + virtual ~LinuxWatcher() { + STLDeleteElements(&readers_); + } + // Removes and deletes the SocketReader. void RemoveSocketReader(SocketReader* reader); diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc index 645c931..b05fe30 100644 --- a/chrome/browser/sync/sync_setup_wizard.cc +++ b/chrome/browser/sync/sync_setup_wizard.cc @@ -23,7 +23,6 @@ class SyncResourcesSource : public ChromeURLDataManager::DataSource { SyncResourcesSource() : DataSource(chrome::kSyncResourcesHost, MessageLoop::current()) { } - virtual ~SyncResourcesSource() { } virtual void StartDataRequest(const std::string& path, int request_id); @@ -33,7 +32,10 @@ class SyncResourcesSource : public ChromeURLDataManager::DataSource { else return "text/html"; } + private: + virtual ~SyncResourcesSource() {} + DISALLOW_COPY_AND_ASSIGN(SyncResourcesSource); }; |