diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 22:32:27 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-07 22:32:27 +0000 |
commit | 525074deccb1954b01152c2925a81ab2359f9d58 (patch) | |
tree | ff013f639e84d46d14f953a073c239542eadc13d /chrome/browser | |
parent | 5543f281ec7c230497fd5d7437721d41a31bb1b5 (diff) | |
download | chromium_src-525074deccb1954b01152c2925a81ab2359f9d58.zip chromium_src-525074deccb1954b01152c2925a81ab2359f9d58.tar.gz chromium_src-525074deccb1954b01152c2925a81ab2359f9d58.tar.bz2 |
Cleanup: Use more specific friend struct / make destructors non-public for classes with DeleteOnFooThread trait.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6627007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77201 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
15 files changed, 44 insertions, 25 deletions
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 77ca7af..4934ce4 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -155,7 +155,7 @@ class AutomationProvider DictionaryValue* GetDictionaryFromDownloadItem(const DownloadItem* download); protected: - friend class BrowserThread; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class DeleteTask<AutomationProvider>; virtual ~AutomationProvider(); diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index b42b71d3..6e51d5b 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -9,6 +9,8 @@ #include <deque> #include <map> #include <set> +#include <string> +#include <vector> #include "base/scoped_ptr.h" #include "base/weak_ptr.h" @@ -1126,7 +1128,7 @@ class WaitForProcessLauncherThreadToGoIdleObserver AutomationProvider* automation, IPC::Message* reply_message); private: - friend class BrowserThread; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class DeleteTask<WaitForProcessLauncherThreadToGoIdleObserver>; virtual ~WaitForProcessLauncherThreadToGoIdleObserver(); diff --git a/chrome/browser/content_settings/host_content_settings_map.h b/chrome/browser/content_settings/host_content_settings_map.h index cb21cf4..cf326d7 100644 --- a/chrome/browser/content_settings/host_content_settings_map.h +++ b/chrome/browser/content_settings/host_content_settings_map.h @@ -45,7 +45,6 @@ class HostContentSettingsMap typedef std::vector<PatternSettingPair> SettingsForOneType; explicit HostContentSettingsMap(Profile* profile); - ~HostContentSettingsMap(); static void RegisterUserPrefs(PrefService* prefs); @@ -171,7 +170,10 @@ class HostContentSettingsMap const NotificationDetails& details); private: - friend class base::RefCountedThreadSafe<HostContentSettingsMap>; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; + friend class DeleteTask<HostContentSettingsMap>; + + ~HostContentSettingsMap(); // Informs observers that content settings have changed. Make sure that // |lock_| is not held when calling this, as listeners will usually call one diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h index 5dbfb26..b7fc417 100644 --- a/chrome/browser/download/download_manager.h +++ b/chrome/browser/download/download_manager.h @@ -254,7 +254,7 @@ class DownloadManager DownloadManager* observed_download_manager_; }; - friend class BrowserThread; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class DeleteTask<DownloadManager>; friend class OtherDownloadManagerObserver; diff --git a/chrome/browser/extensions/extension_data_deleter.h b/chrome/browser/extensions/extension_data_deleter.h index bd23f5f..c921304 100644 --- a/chrome/browser/extensions/extension_data_deleter.h +++ b/chrome/browser/extensions/extension_data_deleter.h @@ -31,7 +31,6 @@ class ExtensionDataDeleter BrowserThread::DeleteOnUIThread> { public: ExtensionDataDeleter(Profile* profile, const GURL& extension_url); - ~ExtensionDataDeleter(); // Start removing data. The extension should not be running when this is // called. Cookies are deleted on the current thread, local storage and @@ -40,6 +39,11 @@ class ExtensionDataDeleter void StartDeleting(); private: + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; + friend class DeleteTask<ExtensionDataDeleter>; + + ~ExtensionDataDeleter(); + // Deletes the cookies for the extension. May only be called on the io // thread. void DeleteCookiesOnIOThread(); diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 4c9702a..97d5f6c 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -413,7 +413,7 @@ class ExtensionService ExtensionIdSet GetAppIds() const; private: - friend class BrowserThread; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class DeleteTask<ExtensionService>; // Contains Extension data that can change during the life of the process, diff --git a/chrome/browser/file_path_watcher/file_path_watcher.h b/chrome/browser/file_path_watcher/file_path_watcher.h index 869b002..530962e 100644 --- a/chrome/browser/file_path_watcher/file_path_watcher.h +++ b/chrome/browser/file_path_watcher/file_path_watcher.h @@ -44,8 +44,6 @@ class FilePathWatcher { : public base::RefCountedThreadSafe<PlatformDelegate, BrowserThread::DeleteOnFileThread> { public: - virtual ~PlatformDelegate() {} - // Start watching for the given |path| and notify |delegate| about changes. virtual bool Watch(const FilePath& path, Delegate* delegate) WARN_UNUSED_RESULT = 0; @@ -53,6 +51,12 @@ class FilePathWatcher { // Stop watching. This is called from FilePathWatcher's dtor in order to // allow to shut down properly while the object is still alive. virtual void Cancel() {} + + protected: + friend struct BrowserThread::DeleteOnThread<BrowserThread::FILE>; + friend class DeleteTask<PlatformDelegate>; + + virtual ~PlatformDelegate() {} }; private: diff --git a/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc b/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc index 19a18a69..f067481 100644 --- a/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc +++ b/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc @@ -82,7 +82,6 @@ class InotifyReader { class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate { public: FilePathWatcherImpl(); - virtual ~FilePathWatcherImpl() {} // Called for each event coming from the watch. |fired_watch| identifies the // watch that fired, |child| indicates what has changed, and is relative to @@ -102,6 +101,8 @@ class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate { virtual void Cancel(); private: + virtual ~FilePathWatcherImpl() {} + // Inotify watches are installed for all directory components of |target_|. A // WatchEntry instance holds the watch descriptor for a component and the // subdirectory for that identifies the next component. diff --git a/chrome/browser/file_path_watcher/file_path_watcher_mac.cc b/chrome/browser/file_path_watcher/file_path_watcher_mac.cc index 86c5bb58..e89cf87 100644 --- a/chrome/browser/file_path_watcher/file_path_watcher_mac.cc +++ b/chrome/browser/file_path_watcher/file_path_watcher_mac.cc @@ -23,7 +23,6 @@ const CFAbsoluteTime kEventLatencySeconds = 0.3; class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate { public: FilePathWatcherImpl(); - virtual ~FilePathWatcherImpl() {} // Called from the FSEvents callback whenever there is a change to the paths void OnFilePathChanged(); @@ -37,6 +36,8 @@ class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate { virtual void Cancel(); private: + virtual ~FilePathWatcherImpl() {} + // Destroy the event stream. void DestroyEventStream(); diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 1d30889..de4b205 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -4,6 +4,8 @@ #include "chrome/browser/profiles/profile_io_data.h" +#include <string> + #include "base/basictypes.h" #include "base/command_line.h" #include "base/logging.h" @@ -90,7 +92,7 @@ class ChromeCookieMonsterDelegate : public net::CookieMonster::Delegate { } private: - friend class ::BrowserThread; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class DeleteTask<ProfileGetter>; virtual ~ProfileGetter() {} diff --git a/chrome/browser/sync/glue/data_type_controller.h b/chrome/browser/sync/glue/data_type_controller.h index 1e9ae11..adedad7 100644 --- a/chrome/browser/sync/glue/data_type_controller.h +++ b/chrome/browser/sync/glue/data_type_controller.h @@ -89,15 +89,12 @@ class DataTypeController // Current state of the data type controller. virtual State state() = 0; - // TODO(sync): Make this protected. It currently causes a build error on - // Linux to do so. - virtual ~DataTypeController() {} - protected: - friend class base::RefCountedThreadSafe<DataTypeController>; - friend class BrowserThread; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class DeleteTask<DataTypeController>; friend class ShutdownTask; + + virtual ~DataTypeController() {} }; } // namespace browser_sync diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h index bfd8880..3712c19 100644 --- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h +++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h @@ -67,7 +67,7 @@ class CreateApplicationShortcutsDialogGtk GtkWidget* error_dialog_; private: - friend class BrowserThread; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class DeleteTask<CreateApplicationShortcutsDialogGtk>; DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutsDialogGtk); }; diff --git a/chrome/browser/ui/webui/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals_ui.cc index 9463c62f..b36d122 100644 --- a/chrome/browser/ui/webui/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals_ui.cc @@ -222,8 +222,6 @@ class NetInternalsMessageHandler::IOThreadImpl IOThread* io_thread, URLRequestContextGetter* context_getter); - ~IOThreadImpl(); - // Creates a callback that will run |method| on the IO thread. // // This can be used with WebUI::RegisterMessageCallback() to bind to a method @@ -292,6 +290,11 @@ class NetInternalsMessageHandler::IOThreadImpl void CallJavascriptFunction(const std::wstring& function_name, Value* arg); private: + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; + friend class DeleteTask<IOThreadImpl>; + + ~IOThreadImpl(); + class CallbackHelper; // Helper that runs |method| with |arg|, and deletes |arg| on completion. @@ -330,7 +333,6 @@ class NetInternalsMessageHandler::IOThreadImpl // True if we have attached an observer to the NetLog already. bool is_observing_log_; - friend class base::RefCountedThreadSafe<IOThreadImpl>; // Log entries that have yet to be passed along to Javascript page. Non-NULL // when and only when there is a pending delayed task to call diff --git a/chrome/browser/user_style_sheet_watcher.h b/chrome/browser/user_style_sheet_watcher.h index 1572561..8fc594d 100644 --- a/chrome/browser/user_style_sheet_watcher.h +++ b/chrome/browser/user_style_sheet_watcher.h @@ -25,7 +25,6 @@ class UserStyleSheetWatcher public NotificationObserver { public: explicit UserStyleSheetWatcher(const FilePath& profile_path); - virtual ~UserStyleSheetWatcher(); void Init(); @@ -37,6 +36,11 @@ class UserStyleSheetWatcher const NotificationDetails& details); private: + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; + friend class DeleteTask<UserStyleSheetWatcher>; + + virtual ~UserStyleSheetWatcher(); + // The directory containing User StyleSheets/Custom.css. FilePath profile_path_; diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index d7d8f3b..8e8b211 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -7,6 +7,7 @@ #pragma once #include <map> +#include <string> #include <vector> #include "app/sql/init_status.h" @@ -502,8 +503,7 @@ class WebDataService // ////////////////////////////////////////////////////////////////////////////// private: - friend class base::RefCountedThreadSafe<WebDataService>; - friend class BrowserThread; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; friend class DeleteTask<WebDataService>; friend class ShutdownTask; |