diff options
50 files changed, 215 insertions, 76 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 54bd4f0..c49e266 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -139,6 +139,8 @@ class AboutMemoryHandler : public MemoryDetails { virtual void OnDetailsAvailable(); private: + ~AboutMemoryHandler() {} + void BindProcessMetrics(DictionaryValue* data, ProcessMemoryInformation* info); void AppendProcess(ListValue* child_data, ProcessMemoryInformation* info); diff --git a/chrome/browser/browsing_instance.h b/chrome/browser/browsing_instance.h index c067a0d..9310b6a 100644 --- a/chrome/browser/browsing_instance.h +++ b/chrome/browser/browsing_instance.h @@ -59,13 +59,6 @@ class BrowsingInstance : public base::RefCounted<BrowsingInstance> { : profile_(profile) { } - // Virtual to allow tests to extend it. - virtual ~BrowsingInstance() { - // We should only be deleted when all of the SiteInstances that refer to - // us are gone. - DCHECK(site_instance_map_.empty()); - } - // Returns whether the process-per-site model is in use (globally or just for // the given url), in which case we should ensure there is only one // SiteInstance per site for the entire profile, not just for this @@ -94,6 +87,16 @@ class BrowsingInstance : public base::RefCounted<BrowsingInstance> { // BrowsingInstance. void UnregisterSiteInstance(SiteInstance* site_instance); + protected: + friend class base::RefCounted<BrowsingInstance>; + + // Virtual to allow tests to extend it. + virtual ~BrowsingInstance() { + // We should only be deleted when all of the SiteInstances that refer to + // us are gone. + DCHECK(site_instance_map_.empty()); + } + private: // Map of site to SiteInstance, to ensure we only have one SiteInstance per // site. The site string should be the possibly_invalid_spec() of a GURL diff --git a/chrome/browser/cancelable_request.h b/chrome/browser/cancelable_request.h index 80e4afc..d081c4d 100644 --- a/chrome/browser/cancelable_request.h +++ b/chrome/browser/cancelable_request.h @@ -369,8 +369,6 @@ class CancelableRequestBase : canceled_(false) { callback_thread_ = MessageLoop::current(); } - virtual ~CancelableRequestBase() { - } CancelableRequestConsumerBase* consumer() const { return consumer_; @@ -390,6 +388,9 @@ class CancelableRequestBase : } protected: + friend class base::RefCountedThreadSafe<CancelableRequestBase>; + virtual ~CancelableRequestBase() {} + // Initializes the object with the particulars from the provider. It may only // be called once (it is called by the provider, which is a friend). void Init(CancelableRequestProvider* provider, @@ -452,6 +453,9 @@ class CancelableRequestBase : // DoodieRequest(CallbackType* callback) : CancelableRequest(callback) { // } // +// private: +// ~DoodieRequest() {} +// // int input_arg1; // std::wstring input_arg2; // }; @@ -469,8 +473,6 @@ class CancelableRequest : public CancelableRequestBase { callback_(callback) { DCHECK(callback) << "We should always have a callback"; } - virtual ~CancelableRequest() { - } // Dispatches the parameters to the correct thread so the callback can be // executed there. The caller does not need to check for cancel before @@ -503,6 +505,9 @@ class CancelableRequest : public CancelableRequestBase { } } + protected: + virtual ~CancelableRequest() {} + private: // Executes the callback and notifies the provider and the consumer that this // request has been completed. This must be called on the callback_thread_. @@ -545,11 +550,11 @@ class CancelableRequest1 : public CancelableRequest<CB> { : CancelableRequest<CB>(callback) { } - virtual ~CancelableRequest1() { - } - // The value. Type value; + + protected: + virtual ~CancelableRequest1() {} }; #endif // CHROME_BROWSER_CANCELABLE_REQUEST_H__ diff --git a/chrome/browser/debugger/debugger_wrapper.h b/chrome/browser/debugger/debugger_wrapper.h index 1a29566..11ecb0c 100644 --- a/chrome/browser/debugger/debugger_wrapper.h +++ b/chrome/browser/debugger/debugger_wrapper.h @@ -22,9 +22,11 @@ class DebuggerWrapper : public base::RefCountedThreadSafe<DebuggerWrapper> { public: explicit DebuggerWrapper(int port); + private: + friend class base::RefCountedThreadSafe<DebuggerWrapper>; + virtual ~DebuggerWrapper(); - private: scoped_refptr<DevToolsProtocolHandler> proto_handler_; }; diff --git a/chrome/browser/debugger/devtools_manager.h b/chrome/browser/debugger/devtools_manager.h index b7cdbfe..dcc2dc0 100644 --- a/chrome/browser/debugger/devtools_manager.h +++ b/chrome/browser/debugger/devtools_manager.h @@ -30,7 +30,6 @@ class DevToolsManager : public DevToolsClientHost::CloseListener, static void RegisterUserPrefs(PrefService* prefs); DevToolsManager(); - virtual ~DevToolsManager(); // Returns DevToolsClientHost registered for |inspected_rvh| or NULL if // there is no alive DevToolsClientHost registered for |inspected_rvh|. @@ -80,6 +79,10 @@ class DevToolsManager : public DevToolsClientHost::CloseListener, RenderViewHost* to_rvh); private: + friend class base::RefCounted<DevToolsManager>; + + virtual ~DevToolsManager(); + // DevToolsClientHost::CloseListener override. // This method will remove all references from the manager to the // DevToolsClientHost and unregister all listeners related to the diff --git a/chrome/browser/debugger/devtools_remote.h b/chrome/browser/debugger/devtools_remote.h index d5664a5..713df3d 100644 --- a/chrome/browser/debugger/devtools_remote.h +++ b/chrome/browser/debugger/devtools_remote.h @@ -16,12 +16,16 @@ class DevToolsRemoteListener : public base::RefCountedThreadSafe<DevToolsRemoteListener> { public: DevToolsRemoteListener() {} - virtual ~DevToolsRemoteListener() {} virtual void HandleMessage(const DevToolsRemoteMessage& message) = 0; // This method is invoked on the UI thread whenever the debugger connection // has been lost. virtual void OnConnectionLost() = 0; + protected: + friend class base::RefCountedThreadSafe<DevToolsRemoteListener>; + + virtual ~DevToolsRemoteListener() {} + private: DISALLOW_COPY_AND_ASSIGN(DevToolsRemoteListener); }; diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h index 374df13..fafc2119 100644 --- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h +++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h @@ -137,7 +137,7 @@ class DevToolsRemoteListenSocketTester : virtual ListenSocket* DoListen(); private: - virtual ~DevToolsRemoteListenSocketTester() {} + virtual ~DevToolsRemoteListenSocketTester() {} }; #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_LISTEN_SOCKET_UNITTEST_H_ diff --git a/chrome/browser/extensions/autoupdate_interceptor.h b/chrome/browser/extensions/autoupdate_interceptor.h index 4a4284a..142c46d 100644 --- a/chrome/browser/extensions/autoupdate_interceptor.h +++ b/chrome/browser/extensions/autoupdate_interceptor.h @@ -18,7 +18,6 @@ class AutoUpdateInterceptor public base::RefCountedThreadSafe<AutoUpdateInterceptor> { public: AutoUpdateInterceptor(); - virtual ~AutoUpdateInterceptor(); // When computing matches, this ignores query parameters (since the autoupdate // fetch code appends a bunch of them to manifest fetches). @@ -34,6 +33,10 @@ class AutoUpdateInterceptor void SetResponseOnIOThread(const std::string url, const FilePath& path); private: + friend class base::RefCountedThreadSafe<AutoUpdateInterceptor>; + + virtual ~AutoUpdateInterceptor(); + std::map<GURL, FilePath> responses_; DISALLOW_COPY_AND_ASSIGN(AutoUpdateInterceptor); diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h index 879a147..738cd0c 100644 --- a/chrome/browser/external_tab_container.h +++ b/chrome/browser/external_tab_container.h @@ -39,7 +39,6 @@ class ExternalTabContainer : public TabContentsDelegate, ExternalTabContainer(AutomationProvider* automation, AutomationResourceMessageFilter* filter); - ~ExternalTabContainer(); TabContents* tab_contents() const { return tab_contents_; } @@ -167,6 +166,10 @@ class ExternalTabContainer : public TabContentsDelegate, void Navigate(const GURL& url, const GURL& referrer); private: + friend class base::RefCounted<ExternalTabContainer>; + + ~ExternalTabContainer(); + // Helper function for processing keystokes coming back from the renderer // process. bool ProcessUnhandledKeyStroke(HWND window, UINT message, WPARAM wparam, diff --git a/chrome/browser/favicon_service.h b/chrome/browser/favicon_service.h index c48fc64..38c3303 100644 --- a/chrome/browser/favicon_service.h +++ b/chrome/browser/favicon_service.h @@ -87,6 +87,10 @@ class FaviconService : public CancelableRequestProvider, const std::vector<unsigned char>& image_data); private: + friend class base::RefCountedThreadSafe<FaviconService>; + + ~FaviconService() {} + Profile* profile_; // Helper to forward an empty result if we cannot get the history service. diff --git a/chrome/browser/google_update.h b/chrome/browser/google_update.h index 9dee7a3..b2b0961 100644 --- a/chrome/browser/google_update.h +++ b/chrome/browser/google_update.h @@ -82,7 +82,6 @@ class GoogleUpdateStatusListener { class GoogleUpdate : public base::RefCountedThreadSafe<GoogleUpdate> { public: GoogleUpdate(); - virtual ~GoogleUpdate(); // Ask Google Update to see if a new version is available. If the parameter // |install_if_newer| is true then Google Update will also install that new @@ -98,6 +97,10 @@ class GoogleUpdate : public base::RefCountedThreadSafe<GoogleUpdate> { void RemoveStatusChangeListener(); private: + friend class base::RefCountedThreadSafe<GoogleUpdate>; + + virtual ~GoogleUpdate(); + // We need to run the update check on another thread than the main thread, and // therefore CheckForUpdate will delegate to this function. |main_loop| points // to the message loop that we want the response to come from. diff --git a/chrome/browser/gtk/dialogs_gtk.cc b/chrome/browser/gtk/dialogs_gtk.cc index 8b2d8eb..5cd406b 100644 --- a/chrome/browser/gtk/dialogs_gtk.cc +++ b/chrome/browser/gtk/dialogs_gtk.cc @@ -32,7 +32,6 @@ static const int kPreviewHeight = 512; class SelectFileDialogImpl : public SelectFileDialog { public: explicit SelectFileDialogImpl(Listener* listener); - virtual ~SelectFileDialogImpl(); // BaseShellDialog implementation. virtual bool IsRunning(gfx::NativeWindow parent_window) const; @@ -50,6 +49,8 @@ class SelectFileDialogImpl : public SelectFileDialog { void* params); private: + virtual ~SelectFileDialogImpl(); + // Add the filters from |file_types_| to |chooser|. void AddFilters(GtkFileChooser* chooser); diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h index af4a10a..a88b268 100644 --- a/chrome/browser/icon_loader.h +++ b/chrome/browser/icon_loader.h @@ -47,12 +47,14 @@ class IconLoader : public base::RefCountedThreadSafe<IconLoader> { IconLoader(const IconGroupID& group, IconSize size, Delegate* delegate); - virtual ~IconLoader(); - // Start reading the icon on the file thread. void Start(); private: + friend class base::RefCountedThreadSafe<IconLoader>; + + virtual ~IconLoader(); + void ReadIcon(); void NotifyDelegate(); diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc index c5c78b07..32b42ca 100644 --- a/chrome/browser/jankometer.cc +++ b/chrome/browser/jankometer.cc @@ -192,6 +192,10 @@ class JankObserver : public base::RefCountedThreadSafe<JankObserver>, #endif private: + friend class base::RefCountedThreadSafe<JankObserver>; + + ~JankObserver() {} + const TimeDelta MaxMessageDelay_; // Time at which the current message processing began. diff --git a/chrome/browser/jumplist.h b/chrome/browser/jumplist.h index ed28eed..9f56cca 100644 --- a/chrome/browser/jumplist.h +++ b/chrome/browser/jumplist.h @@ -41,9 +41,6 @@ class ShellLinkItem : public base::RefCountedThreadSafe<ShellLinkItem> { ShellLinkItem() : index_(0), favicon_(false) { } - ~ShellLinkItem() { - } - const std::wstring& arguments() const { return arguments_; } const std::wstring& title() const { return title_; } const std::wstring& icon() const { return icon_; } @@ -69,6 +66,10 @@ class ShellLinkItem : public base::RefCountedThreadSafe<ShellLinkItem> { } private: + friend class base::RefCountedThreadSafe<ShellLinkItem>; + + ~ShellLinkItem() {} + std::wstring arguments_; std::wstring title_; std::wstring icon_; diff --git a/chrome/browser/login_prompt_win.cc b/chrome/browser/login_prompt_win.cc index f95a0d2..18ed7e4 100644 --- a/chrome/browser/login_prompt_win.cc +++ b/chrome/browser/login_prompt_win.cc @@ -45,9 +45,6 @@ class LoginHandlerWin : public LoginHandler, } } - ~LoginHandlerWin() { - } - void set_login_view(LoginView* login_view) { login_view_ = login_view; } @@ -186,8 +183,11 @@ class LoginHandlerWin : public LoginHandler, } private: + friend class base::RefCountedThreadSafe<LoginHandlerWin>; friend class LoginPrompt; + ~LoginHandlerWin() {} + // Calls SetAuth from the IO loop. void SetAuthDeferred(const std::wstring& username, const std::wstring& password) { diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h index 0b35b4e..bfee58e 100644 --- a/chrome/browser/memory_details.h +++ b/chrome/browser/memory_details.h @@ -78,7 +78,6 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> { public: // Constructor. MemoryDetails(); - virtual ~MemoryDetails() {} // Access to the process detail information. This data is only available // after OnDetailsAvailable() has been called. @@ -91,6 +90,11 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> { virtual void OnDetailsAvailable() {} + protected: + friend class base::RefCountedThreadSafe<MemoryDetails>; + + virtual ~MemoryDetails() {} + private: // Collect child process information on the IO thread. This is needed because // information about some child process types (i.e. plugins) can only be taken diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index dc052f9..61def28 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -274,6 +274,8 @@ class MetricsMemoryDetails : public MemoryDetails { } private: + ~MetricsMemoryDetails() {} + Task* completion_; DISALLOW_EVIL_CONSTRUCTORS(MetricsMemoryDetails); }; diff --git a/chrome/browser/renderer_host/test/site_instance_unittest.cc b/chrome/browser/renderer_host/test/site_instance_unittest.cc index 6ee1a59..2904a5e 100644 --- a/chrome/browser/renderer_host/test/site_instance_unittest.cc +++ b/chrome/browser/renderer_host/test/site_instance_unittest.cc @@ -31,10 +31,6 @@ class TestBrowsingInstance : public BrowsingInstance { deleteCounter_(deleteCounter) { } - ~TestBrowsingInstance() { - (*deleteCounter_)++; - } - // Overrides BrowsingInstance::ShouldUseProcessPerSite so that we can test // both alternatives without using command-line switches. bool ShouldUseProcessPerSite(const GURL& url) { @@ -45,6 +41,10 @@ class TestBrowsingInstance : public BrowsingInstance { bool use_process_per_site; private: + ~TestBrowsingInstance() { + (*deleteCounter_)++; + } + int* deleteCounter_; }; diff --git a/chrome/browser/sessions/base_session_service.h b/chrome/browser/sessions/base_session_service.h index 6e05094..ae4cbce 100644 --- a/chrome/browser/sessions/base_session_service.h +++ b/chrome/browser/sessions/base_session_service.h @@ -46,8 +46,6 @@ class BaseSessionService : public CancelableRequestProvider, Profile* profile, const FilePath& path); - virtual ~BaseSessionService(); - Profile* profile() const { return profile_; } // Deletes the last session. @@ -66,16 +64,22 @@ class BaseSessionService : public CancelableRequestProvider, explicit InternalGetCommandsRequest(CallbackType* callback) : CancelableRequest<InternalGetCommandsCallback>(callback) { } - virtual ~InternalGetCommandsRequest(); // The commands. The backend fills this in for us. std::vector<SessionCommand*> commands; + protected: + virtual ~InternalGetCommandsRequest(); + private: DISALLOW_COPY_AND_ASSIGN(InternalGetCommandsRequest); }; protected: + friend class base::RefCountedThreadSafe<BaseSessionService>; + + virtual ~BaseSessionService(); + // Returns the backend. SessionBackend* backend() const { return backend_; } diff --git a/chrome/browser/sessions/session_backend.h b/chrome/browser/sessions/session_backend.h index bfd446f..2ac9a97 100644 --- a/chrome/browser/sessions/session_backend.h +++ b/chrome/browser/sessions/session_backend.h @@ -81,6 +81,10 @@ class SessionBackend : public base::RefCountedThreadSafe<SessionBackend> { void MoveCurrentSessionToLastSession(); private: + friend class base::RefCountedThreadSafe<SessionBackend>; + + ~SessionBackend() {} + // If current_session_file_ is open, it is truncated so that it is essentially // empty (only contains the header). If current_session_file_ isn't open, it // is is opened and the header is written to it. After this diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 8b2575d..a4247c0 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -77,6 +77,8 @@ class InternalLastSessionRequest scoped_ptr<SessionService::LastSessionCallback> real_callback; private: + ~InternalLastSessionRequest() {} + DISALLOW_COPY_AND_ASSIGN(InternalLastSessionRequest); }; diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h index 98276fe..a687125 100644 --- a/chrome/browser/sessions/session_service.h +++ b/chrome/browser/sessions/session_service.h @@ -52,8 +52,6 @@ class SessionService : public BaseSessionService, // For testing. explicit SessionService(const FilePath& save_path); - virtual ~SessionService(); - // Resets the contents of the file from the current state of all open // browsers whose profile matches our profile. void ResetFromCurrentBrowsers(); @@ -155,6 +153,8 @@ class SessionService : public BaseSessionService, typedef std::map<SessionID::id_type,SessionTab*> IdToSessionTab; typedef std::map<SessionID::id_type,SessionWindow*> IdToSessionWindow; + virtual ~SessionService(); + // These types mirror Browser::Type, but are re-defined here because these // specific enumeration _values_ are written into the session database and // are needed to maintain forward compatibility. diff --git a/chrome/browser/sessions/tab_restore_service.h b/chrome/browser/sessions/tab_restore_service.h index 50fc0a7..ba351ab 100644 --- a/chrome/browser/sessions/tab_restore_service.h +++ b/chrome/browser/sessions/tab_restore_service.h @@ -124,8 +124,6 @@ class TabRestoreService : public BaseSessionService { explicit TabRestoreService(Profile* profile, TimeFactory* time_factory_ = NULL); - virtual ~TabRestoreService(); - // Adds/removes an observer. TabRestoreService does not take ownership of // the observer. void AddObserver(Observer* observer); @@ -193,6 +191,8 @@ class TabRestoreService : public BaseSessionService { LOADED_LAST_SESSION = 1 << 4 }; + virtual ~TabRestoreService(); + // Populates the tab's navigations from the NavigationController, and its // browser_id and tabstrip_index from the browser. void PopulateTab(Tab* tab, diff --git a/chrome/browser/shell_dialogs.h b/chrome/browser/shell_dialogs.h index 78eaf55..46218b9 100644 --- a/chrome/browser/shell_dialogs.h +++ b/chrome/browser/shell_dialogs.h @@ -41,8 +41,6 @@ class SelectFileDialog SELECT_OPEN_MULTI_FILE }; - virtual ~SelectFileDialog() {} - // An interface implemented by a Listener object wishing to know about the // the result of the Select File/Folder action. These callbacks must be // re-entrant. @@ -117,6 +115,11 @@ class SelectFileDialog const FilePath::StringType& default_extension, gfx::NativeWindow owning_window, void* params) = 0; + + protected: + friend class base::RefCountedThreadSafe<SelectFileDialog>; + + virtual ~SelectFileDialog() {} }; // Shows a dialog box for selecting a font. @@ -124,7 +127,6 @@ class SelectFontDialog : public base::RefCountedThreadSafe<SelectFileDialog>, public BaseShellDialog { public: - virtual ~SelectFontDialog() {} // An interface implemented by a Listener object wishing to know about the // the result of the Select Font action. These callbacks must be @@ -167,6 +169,11 @@ class SelectFontDialog void* params, const std::wstring& font_name, int font_size) = 0; + + protected: + friend class base::RefCountedThreadSafe<SelectFileDialog>; + + virtual ~SelectFontDialog() {} }; #endif // CHROME_BROWSER_SHELL_DIALOGS_H_ diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index 8b90d6a..7558121 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h @@ -93,7 +93,6 @@ class ShellIntegration { : public base::RefCountedThreadSafe<DefaultBrowserWorker> { public: explicit DefaultBrowserWorker(DefaultBrowserObserver* observer); - virtual ~DefaultBrowserWorker() {} // Checks if Chrome is the default browser. void StartCheckDefaultBrowser(); @@ -105,6 +104,10 @@ class ShellIntegration { void ObserverDestroyed(); private: + friend class base::RefCountedThreadSafe<DefaultBrowserWorker>; + + virtual ~DefaultBrowserWorker() {} + // Functions that track the process of checking if Chrome is the default // browser. |ExecuteCheckDefaultBrowser| checks the registry on the file // thread. |CompleteCheckDefaultBrowser| notifies the view to update on the diff --git a/chrome/browser/spellchecker.h b/chrome/browser/spellchecker.h index 303956c..630f815 100644 --- a/chrome/browser/spellchecker.h +++ b/chrome/browser/spellchecker.h @@ -60,9 +60,6 @@ class SpellChecker URLRequestContextGetter* request_context_getter, const FilePath& custom_dictionary_file_name); - // Only delete on the I/O thread (see above). - ~SpellChecker(); - // SpellCheck a word. // Returns true if spelled correctly, false otherwise. // If the spellchecker failed to initialize, always returns true. @@ -116,6 +113,8 @@ class SpellChecker static std::string GetLanguageFromLanguageRegion(std::string input_language); private: + friend class ChromeThread; + friend class DeleteTask<SpellChecker>; friend class ReadDictionaryTask; FRIEND_TEST(SpellCheckTest, SpellCheckStrings_EN_US); FRIEND_TEST(SpellCheckTest, SpellCheckSuggestions_EN_US); @@ -126,6 +125,9 @@ class SpellChecker FRIEND_TEST(SpellCheckTest, GetAutoCorrectionWord_EN_US); FRIEND_TEST(SpellCheckTest, IgnoreWords_EN_US); + // Only delete on the I/O thread (see above). + ~SpellChecker(); + // URLFetcher::Delegate implementation. Called when we finish downloading the // spellcheck dictionary; saves the dictionary to disk. virtual void OnURLFetchComplete(const URLFetcher* source, diff --git a/chrome/browser/ssl/ssl_cert_error_handler.h b/chrome/browser/ssl/ssl_cert_error_handler.h index 7956317..212a585 100644 --- a/chrome/browser/ssl/ssl_cert_error_handler.h +++ b/chrome/browser/ssl/ssl_cert_error_handler.h @@ -37,6 +37,8 @@ class SSLCertErrorHandler : public SSLErrorHandler { virtual void OnDispatched(); private: + ~SSLCertErrorHandler() {} + // These read-only members may be accessed on any thread. net::SSLInfo ssl_info_; const int cert_error_; // The error we represent. diff --git a/chrome/browser/ssl/ssl_client_auth_handler.h b/chrome/browser/ssl/ssl_client_auth_handler.h index b3146b2..6d7550d 100644 --- a/chrome/browser/ssl/ssl_client_auth_handler.h +++ b/chrome/browser/ssl/ssl_client_auth_handler.h @@ -23,7 +23,6 @@ class SSLClientAuthHandler : public: SSLClientAuthHandler(URLRequest* request, net::SSLCertRequestInfo* cert_request_info); - ~SSLClientAuthHandler(); // Asks the user to select a certificate and resumes the URL request with that // certificate. @@ -35,6 +34,10 @@ class SSLClientAuthHandler : void OnRequestCancelled(); private: + friend class base::RefCountedThreadSafe<SSLClientAuthHandler>; + + ~SSLClientAuthHandler(); + // Asks the user for a cert. // Called on the UI thread. void DoSelectCertificate(); diff --git a/chrome/browser/ssl/ssl_error_handler.h b/chrome/browser/ssl/ssl_error_handler.h index d31f4cc..cc80234 100644 --- a/chrome/browser/ssl/ssl_error_handler.h +++ b/chrome/browser/ssl/ssl_error_handler.h @@ -35,8 +35,6 @@ class URLRequest; // class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> { public: - virtual ~SSLErrorHandler() { } - virtual SSLCertErrorHandler* AsSSLCertErrorHandler() { return NULL; } // Find the appropriate SSLManager for the URLRequest and begin handling @@ -93,6 +91,8 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> { void TakeNoAction(); protected: + friend class base::RefCountedThreadSafe<SSLErrorHandler>; + // Construct on the IO thread. SSLErrorHandler(ResourceDispatcherHost* resource_dispatcher_host, URLRequest* request, @@ -100,6 +100,8 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> { const std::string& frame_origin, const std::string& main_frame_origin); + virtual ~SSLErrorHandler() { } + // The following 2 methods are the methods subclasses should implement. virtual void OnDispatchFailed() { TakeNoAction(); } diff --git a/chrome/browser/ssl/ssl_request_info.h b/chrome/browser/ssl/ssl_request_info.h index 3daf91f..8964490 100644 --- a/chrome/browser/ssl/ssl_request_info.h +++ b/chrome/browser/ssl/ssl_request_info.h @@ -44,6 +44,10 @@ class SSLRequestInfo : public base::RefCounted<SSLRequestInfo> { int ssl_cert_status() const { return ssl_cert_status_; } private: + friend class base::RefCounted<SSLRequestInfo>; + + ~SSLRequestInfo() {} + GURL url_; ResourceType::Type resource_type_; std::string frame_origin_; diff --git a/chrome/browser/strict_transport_security_persister.h b/chrome/browser/strict_transport_security_persister.h index 5accc9e..9b6c9ca 100644 --- a/chrome/browser/strict_transport_security_persister.h +++ b/chrome/browser/strict_transport_security_persister.h @@ -43,12 +43,14 @@ class StrictTransportSecurityPersister : StrictTransportSecurityPersister(net::StrictTransportSecurityState* state, const FilePath& profile_path); - ~StrictTransportSecurityPersister(); - // Called by the StrictTransportSecurityState when it changes its state. virtual void StateIsDirty(net::StrictTransportSecurityState*); private: + friend class base::RefCountedThreadSafe<StrictTransportSecurityPersister>; + + ~StrictTransportSecurityPersister(); + // a Task callback for when the state needs to be written out. void SerialiseState(); diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h index 807b79c..9f08540 100644 --- a/chrome/browser/sync/glue/http_bridge.h +++ b/chrome/browser/sync/glue/http_bridge.h @@ -99,7 +99,6 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, }; HttpBridge(RequestContextGetter* context); - virtual ~HttpBridge(); // sync_api::HttpPostProvider implementation. virtual void SetUserAgent(const char* user_agent); @@ -130,6 +129,10 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, #endif protected: + friend class base::RefCountedThreadSafe<HttpBridge>; + + virtual ~HttpBridge(); + // Protected virtual so the unit test can override to shunt network requests. virtual void MakeAsynchronousPost(); diff --git a/chrome/browser/sync/glue/http_bridge_unittest.cc b/chrome/browser/sync/glue/http_bridge_unittest.cc index a870e06..e11e830 100644 --- a/chrome/browser/sync/glue/http_bridge_unittest.cc +++ b/chrome/browser/sync/glue/http_bridge_unittest.cc @@ -95,6 +95,8 @@ class ShuntedHttpBridge : public HttpBridge { NewRunnableMethod(this, &ShuntedHttpBridge::CallOnURLFetchComplete)); } private: + ~ShuntedHttpBridge() {} + void CallOnURLFetchComplete() { ASSERT_TRUE(MessageLoop::current() == test_->io_thread_loop()); // We return no cookies and a dummy content response. diff --git a/chrome/browser/sync/glue/model_associator.h b/chrome/browser/sync/glue/model_associator.h index d869010..214db23 100644 --- a/chrome/browser/sync/glue/model_associator.h +++ b/chrome/browser/sync/glue/model_associator.h @@ -35,7 +35,6 @@ class ModelAssociator : public base::RefCountedThreadSafe<ModelAssociator> { public: explicit ModelAssociator(ProfileSyncService* sync_service); - virtual ~ModelAssociator() { } // Clears all associations. void ClearAll(); @@ -82,6 +81,9 @@ class ModelAssociator bool AssociateModels(); protected: + friend class base::RefCountedThreadSafe<ModelAssociator>; + virtual ~ModelAssociator() { } + // Stores the id of the node with the given tag in |sync_id|. // Returns of that node was found successfully. // Tests override this. diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h index 91911e3..69065d8 100644 --- a/chrome/browser/sync/glue/sync_backend_host.h +++ b/chrome/browser/sync/glue/sync_backend_host.h @@ -203,6 +203,8 @@ class SyncBackendHost { #endif private: + friend class base::RefCountedThreadSafe<SyncBackendHost::Core>; + // FrontendNotification defines parameters for NotifyFrontend. Each enum // value corresponds to the one SyncFrontend interface method that // NotifyFrontend should invoke. @@ -213,6 +215,8 @@ class SyncBackendHost { // that may have arisen. }; + ~Core() {} + // NotifyFrontend is how the Core communicates with the frontend across // threads. Having this extra method (rather than having the Core PostTask // to the frontend explicitly) means SyncFrontend implementations don't diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index 7b2701f..4287ee1 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -76,6 +76,9 @@ class TestModelAssociator : public ModelAssociator { *sync_id = node.GetId(); return true; } + + private: + ~TestModelAssociator() {} }; class TestProfileSyncService : public ProfileSyncService { diff --git a/chrome/browser/task_manager.h b/chrome/browser/task_manager.h index 5501234..9fa19f6 100644 --- a/chrome/browser/task_manager.h +++ b/chrome/browser/task_manager.h @@ -96,8 +96,6 @@ class TaskManager { // MessageLoop::InvokeLater(). class ResourceProvider : public base::RefCountedThreadSafe<ResourceProvider> { public: - virtual ~ResourceProvider() {} - // Should return the resource associated to the specified ids, or NULL if // the resource does not belong to this provider. virtual TaskManager::Resource* GetResource(int process_id, @@ -105,6 +103,11 @@ class TaskManager { int routing_id) = 0; virtual void StartUpdating() = 0; virtual void StopUpdating() = 0; + + protected: + friend class base::RefCountedThreadSafe<ResourceProvider>; + + virtual ~ResourceProvider() {} }; static void RegisterPrefs(PrefService* prefs); @@ -178,7 +181,6 @@ class TaskManagerModel : public URLRequestJobTracker::JobObserver, public base::RefCountedThreadSafe<TaskManagerModel> { public: explicit TaskManagerModel(TaskManager* task_manager); - ~TaskManagerModel(); void AddObserver(TaskManagerModelObserver* observer); void RemoveObserver(TaskManagerModelObserver* observer); @@ -248,8 +250,11 @@ class TaskManagerModel : public URLRequestJobTracker::JobObserver, const WebKit::WebCache::ResourceTypeStats& stats); private: + friend class base::RefCountedThreadSafe<TaskManagerModel>; FRIEND_TEST(TaskManagerTest, RefreshCalled); + ~TaskManagerModel(); + enum UpdateState { IDLE = 0, // Currently not updating. TASK_PENDING, // An update task is pending. diff --git a/chrome/browser/task_manager_resource_providers.h b/chrome/browser/task_manager_resource_providers.h index 23efcca..ae3bf100 100644 --- a/chrome/browser/task_manager_resource_providers.h +++ b/chrome/browser/task_manager_resource_providers.h @@ -64,7 +64,6 @@ class TaskManagerTabContentsResourceProvider public NotificationObserver { public: explicit TaskManagerTabContentsResourceProvider(TaskManager* task_manager); - virtual ~TaskManagerTabContentsResourceProvider(); virtual TaskManager::Resource* GetResource(int origin_pid, int render_process_host_id, @@ -78,6 +77,8 @@ class TaskManagerTabContentsResourceProvider const NotificationDetails& details); private: + virtual ~TaskManagerTabContentsResourceProvider(); + void Add(TabContents* tab_contents); void Remove(TabContents* tab_contents); @@ -139,7 +140,6 @@ class TaskManagerChildProcessResourceProvider public NotificationObserver { public: explicit TaskManagerChildProcessResourceProvider(TaskManager* task_manager); - virtual ~TaskManagerChildProcessResourceProvider(); virtual TaskManager::Resource* GetResource(int origin_pid, int render_process_host_id, @@ -166,6 +166,8 @@ class TaskManagerChildProcessResourceProvider std::vector<ChildProcessInfo> existing_child_process_info_; private: + virtual ~TaskManagerChildProcessResourceProvider(); + void Add(ChildProcessInfo child_process_info); void Remove(ChildProcessInfo child_process_info); @@ -223,7 +225,6 @@ class TaskManagerExtensionProcessResourceProvider public: explicit TaskManagerExtensionProcessResourceProvider( TaskManager* task_manager); - virtual ~TaskManagerExtensionProcessResourceProvider(); virtual TaskManager::Resource* GetResource(int origin_pid, int render_process_host_id, @@ -237,6 +238,8 @@ class TaskManagerExtensionProcessResourceProvider const NotificationDetails& details); private: + virtual ~TaskManagerExtensionProcessResourceProvider(); + void AddToTaskManager(ExtensionHost* extension_host); void RemoveFromTaskManager(ExtensionHost* extension_host); @@ -291,7 +294,6 @@ class TaskManagerBrowserProcessResourceProvider public: explicit TaskManagerBrowserProcessResourceProvider( TaskManager* task_manager); - virtual ~TaskManagerBrowserProcessResourceProvider(); virtual TaskManager::Resource* GetResource(int origin_pid, int render_process_host_id, @@ -304,6 +306,8 @@ class TaskManagerBrowserProcessResourceProvider bool updating_; private: + virtual ~TaskManagerBrowserProcessResourceProvider(); + void AddToTaskManager(ChildProcessInfo child_process_info); TaskManager* task_manager_; diff --git a/chrome/browser/thumbnail_store.h b/chrome/browser/thumbnail_store.h index d54c5d4..ed95a02 100644 --- a/chrome/browser/thumbnail_store.h +++ b/chrome/browser/thumbnail_store.h @@ -39,7 +39,6 @@ class ThumbnailStore : public base::RefCountedThreadSafe<ThumbnailStore>, public NotificationObserver { public: ThumbnailStore(); - ~ThumbnailStore(); // Must be called before {Set,Get}PageThumbnail. |db_name| is the location // of an existing ThumbnailStore database or where to create a new one. @@ -63,12 +62,15 @@ class ThumbnailStore : public base::RefCountedThreadSafe<ThumbnailStore>, void Shutdown(); private: + friend class base::RefCountedThreadSafe<ThumbnailStore>; FRIEND_TEST(ThumbnailStoreTest, RetrieveFromCache); FRIEND_TEST(ThumbnailStoreTest, RetrieveFromDisk); FRIEND_TEST(ThumbnailStoreTest, UpdateThumbnail); FRIEND_TEST(ThumbnailStoreTest, FollowRedirects); friend class ThumbnailStoreTest; + ~ThumbnailStore(); + struct CacheEntry { scoped_refptr<RefCountedBytes> data_; ThumbnailScore score_; diff --git a/chrome/browser/user_data_manager.h b/chrome/browser/user_data_manager.h index 589f584..14b9faa 100644 --- a/chrome/browser/user_data_manager.h +++ b/chrome/browser/user_data_manager.h @@ -129,6 +129,10 @@ class GetProfilesHelper void OnDelegateDeleted(); private: + friend class base::RefCountedThreadSafe<GetProfilesHelper>; + + ~GetProfilesHelper() {} + // Helper to get the profiles from user data manager. void GetProfilesFromManager(); diff --git a/chrome/browser/utility_process_host.h b/chrome/browser/utility_process_host.h index 25a8dd8..a37a968 100644 --- a/chrome/browser/utility_process_host.h +++ b/chrome/browser/utility_process_host.h @@ -30,7 +30,6 @@ class UtilityProcessHost : public ChildProcessHost { class Client : public base::RefCountedThreadSafe<Client> { public: Client() {} - virtual ~Client() {} // Called when the process has crashed. virtual void OnProcessCrashed() {} @@ -64,8 +63,14 @@ class UtilityProcessHost : public ChildProcessHost { virtual void OnParseUpdateManifestFailed( const std::string& error_message) {} + protected: + friend class base::RefCountedThreadSafe<Client>; + + virtual ~Client() {} + private: friend class UtilityProcessHost; + void OnMessageReceived(const IPC::Message& message); DISALLOW_COPY_AND_ASSIGN(Client); diff --git a/chrome/browser/views/about_network_dialog.cc b/chrome/browser/views/about_network_dialog.cc index 0883b31..afea0ec 100644 --- a/chrome/browser/views/about_network_dialog.cc +++ b/chrome/browser/views/about_network_dialog.cc @@ -51,7 +51,6 @@ class JobTracker : public URLRequestJobTracker::JobObserver, public base::RefCountedThreadSafe<JobTracker> { public: JobTracker(AboutNetworkDialog* view); - ~JobTracker(); // Called by the NetworkStatusView on the main application thread. void StartTracking(); @@ -70,6 +69,10 @@ class JobTracker : public URLRequestJobTracker::JobObserver, void DetachView() { view_ = NULL; } private: + friend class base::RefCountedThreadSafe<JobTracker>; + + ~JobTracker(); + void InvokeOnIOThread(void (JobTracker::*method)()); // Called on the IO thread diff --git a/chrome/browser/views/options/fonts_page_view.h b/chrome/browser/views/options/fonts_page_view.h index 193a5e7..7404075 100644 --- a/chrome/browser/views/options/fonts_page_view.h +++ b/chrome/browser/views/options/fonts_page_view.h @@ -34,7 +34,6 @@ class FontsPageView : public OptionsPageView, public views::ButtonListener { public: explicit FontsPageView(Profile* profile); - virtual ~FontsPageView(); // views::ButtonListener implementation: virtual void ButtonPressed(views::Button* sender, const views::Event& event); @@ -65,6 +64,8 @@ class FontsPageView : public OptionsPageView, FIXED_WIDTH }; + virtual ~FontsPageView(); + // Init Dialog controls. void InitFontLayout(); void InitEncodingLayout(); diff --git a/chrome/browser/views/shell_dialogs_win.cc b/chrome/browser/views/shell_dialogs_win.cc index e3a0ab0..bcb6c74 100644 --- a/chrome/browser/views/shell_dialogs_win.cc +++ b/chrome/browser/views/shell_dialogs_win.cc @@ -188,7 +188,6 @@ class SelectFileDialogImpl : public SelectFileDialog, public BaseShellDialogImpl { public: explicit SelectFileDialogImpl(Listener* listener); - virtual ~SelectFileDialogImpl(); // SelectFileDialog implementation: virtual void SelectFile(Type type, @@ -203,6 +202,8 @@ class SelectFileDialogImpl : public SelectFileDialog, virtual void ListenerDestroyed(); private: + virtual ~SelectFileDialogImpl(); + // A struct for holding all the state necessary for displaying a Save dialog. struct ExecuteSelectParams { ExecuteSelectParams(Type type, @@ -578,7 +579,6 @@ class SelectFontDialogImpl : public SelectFontDialog, public BaseShellDialogImpl { public: explicit SelectFontDialogImpl(Listener* listener); - virtual ~SelectFontDialogImpl(); // SelectFontDialog implementation: virtual void SelectFont(HWND owning_hwnd, void* params); @@ -590,6 +590,8 @@ class SelectFontDialogImpl : public SelectFontDialog, virtual void ListenerDestroyed(); private: + virtual ~SelectFontDialogImpl(); + // Shows the font selection dialog modal to |owner| and calls the result // back on the ui thread. Run on the dialog thread. void ExecuteSelectFont(RunState run_state, void* params); diff --git a/chrome/browser/visitedlink_master.cc b/chrome/browser/visitedlink_master.cc index 8bbe926..a7ccd13 100644 --- a/chrome/browser/visitedlink_master.cc +++ b/chrome/browser/visitedlink_master.cc @@ -182,6 +182,10 @@ class VisitedLinkMaster::TableBuilder virtual void OnComplete(bool succeed); private: + friend class base::RefCountedThreadSafe<TableBuilder>; + + ~TableBuilder() {} + // OnComplete mashals to this function on the main thread to do the // notification. void OnCompleteMainThread(); diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index 4409de8..956a9c9 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -147,7 +147,6 @@ class WebDataService : public base::RefCountedThreadSafe<WebDataService> { typedef int Handle; WebDataService(); - ~WebDataService(); // Initializes the web data service. Returns false on failure // Takes the path of the profile directory as its argument. @@ -419,11 +418,14 @@ class WebDataService : public base::RefCountedThreadSafe<WebDataService> { // ////////////////////////////////////////////////////////////////////////////// private: + friend class base::RefCountedThreadSafe<WebDataService>; friend class ShutdownTask; typedef GenericRequest2<std::vector<const TemplateURL*>, std::vector<TemplateURL*> > SetKeywordsRequest; + ~WebDataService(); + // Initialize the database, if it hasn't already been initialized. void InitializeDatabaseIfNecessary(); diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 50d5c57..8356df2 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -97,6 +97,10 @@ class PrinterQuery : public base::RefCountedThreadSafe<PrinterQuery> { void StopWorker() { NOTIMPLEMENTED(); } private: + friend class base::RefCountedThreadSafe<PrinterQuery>; + + ~PrinterQuery() {} + PrintSettings settings_; }; diff --git a/chrome/test/chrome_plugin/test_chrome_plugin.cc b/chrome/test/chrome_plugin/test_chrome_plugin.cc index 9e6d0e0..468ee0c 100644 --- a/chrome/test/chrome_plugin/test_chrome_plugin.cc +++ b/chrome/test/chrome_plugin/test_chrome_plugin.cc @@ -48,15 +48,18 @@ void STDCALL InvokeLaterCallback(void* data) { class ResponseStream : public base::RefCounted<ResponseStream> { public: ResponseStream(const TestResponsePayload* payload, CPRequest* request); - ~ResponseStream() { - request_->pdata = NULL; - } void Init(); int GetResponseInfo(CPResponseInfoType type, void* buf, uint32 buf_size); int ReadData(void* buf, uint32 buf_size); -private: + private: + friend class base::RefCounted<ResponseStream>; + + ~ResponseStream() { + request_->pdata = NULL; + } + // Called asynchronously via InvokeLater. void ResponseStarted(); int ReadCompleted(void* buf, uint32 buf_size); diff --git a/chrome/test/live_sync/profile_sync_service_test_harness.cc b/chrome/test/live_sync/profile_sync_service_test_harness.cc index d047151..f15ec89 100644 --- a/chrome/test/live_sync/profile_sync_service_test_harness.cc +++ b/chrome/test/live_sync/profile_sync_service_test_harness.cc @@ -26,7 +26,6 @@ class StateChangeTimeoutEvent public: explicit StateChangeTimeoutEvent(ProfileSyncServiceTestHarness* caller, const std::string& message); - ~StateChangeTimeoutEvent(); // The entry point to the class from PostDelayedTask. void Callback(); @@ -36,6 +35,10 @@ class StateChangeTimeoutEvent bool Abort(); private: + friend class base::RefCountedThreadSafe<StateChangeTimeoutEvent>; + + ~StateChangeTimeoutEvent(); + bool aborted_; bool did_timeout_; @@ -81,13 +84,15 @@ class ConflictTimeoutEvent explicit ConflictTimeoutEvent(ProfileSyncServiceTestHarness* caller) : caller_(caller), did_run_(false) { } - ~ConflictTimeoutEvent() { } // The entry point to the class from PostDelayedTask. void Callback(); bool did_run_; private: + friend class base::RefCountedThreadSafe<ConflictTimeoutEvent>; + + ~ConflictTimeoutEvent() { } // Due to synchronization of the IO loop, the caller will always be alive // if the class is not aborted. |