diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 01:06:06 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 01:06:06 +0000 |
commit | 512d03f78c442cf31bae077d93ecc4882a46b286 (patch) | |
tree | 428c50889d8a1ded265b3dd90775cb300f12e2ae | |
parent | 8c672de7d601eba2b337446bb869f08dece73633 (diff) | |
download | chromium_src-512d03f78c442cf31bae077d93ecc4882a46b286.zip chromium_src-512d03f78c442cf31bae077d93ecc4882a46b286.tar.gz chromium_src-512d03f78c442cf31bae077d93ecc4882a46b286.tar.bz2 |
RefCounted types should not have public destructors, delegate cleanup
For Delegate/Observer-type classes that specify an
interface but do not have any particular lifetime
requirements, make their destructors protected. This is to
allow their interfaces to be implemented safely by
RefCounted types. With public destructors, it's possible to
do "scoped_ptr<Delegate> foo", and then assign a
RefCountedDelegateImpl, which would lead to a double free.
As none of these Delegates actually need public destructors
(ownership of the Delegate* is not transferred during a
function call / class constructor), mark the destructors
protected so that it becomes a compile warning to try to
delete them via the Delegate*.
BUG=123295
TEST=it compiles
Review URL: https://chromiumcodereview.appspot.com/10383262
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144086 0039d316-1c4b-4281-b951-d872f2087c98
56 files changed, 190 insertions, 109 deletions
diff --git a/chrome/browser/bookmarks/base_bookmark_model_observer.h b/chrome/browser/bookmarks/base_bookmark_model_observer.h index 6c01483..e93b3eb 100644 --- a/chrome/browser/bookmarks/base_bookmark_model_observer.h +++ b/chrome/browser/bookmarks/base_bookmark_model_observer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,7 +15,6 @@ class BaseBookmarkModelObserver : public BookmarkModelObserver { public: BaseBookmarkModelObserver() {} - virtual ~BaseBookmarkModelObserver() {} virtual void BookmarkModelChanged() = 0; @@ -41,6 +40,9 @@ class BaseBookmarkModelObserver : public BookmarkModelObserver { virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, const BookmarkNode* node) OVERRIDE; + protected: + virtual ~BaseBookmarkModelObserver() {} + private: DISALLOW_COPY_AND_ASSIGN(BaseBookmarkModelObserver); }; diff --git a/chrome/browser/cancelable_request.cc b/chrome/browser/cancelable_request.cc index 1aba550..167a1df 100644 --- a/chrome/browser/cancelable_request.cc +++ b/chrome/browser/cancelable_request.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,17 +8,6 @@ CancelableRequestProvider::CancelableRequestProvider() : next_handle_(1) { } -CancelableRequestProvider::~CancelableRequestProvider() { - // There may be requests whose result callback has not been run yet. We need - // to cancel them otherwise they may try and call us back after we've been - // deleted, or do other bad things. This can occur on shutdown (or browser - // context destruction) when a request is scheduled, completed (but not - // dispatched), then the BrowserContext is deleted. - base::AutoLock lock(pending_request_lock_); - while (!pending_requests_.empty()) - CancelRequestLocked(pending_requests_.begin()); -} - CancelableRequestProvider::Handle CancelableRequestProvider::AddRequest( CancelableRequestBase* request, CancelableRequestConsumerBase* consumer) { @@ -44,6 +33,17 @@ void CancelableRequestProvider::CancelRequest(Handle handle) { CancelRequestLocked(pending_requests_.find(handle)); } +CancelableRequestProvider::~CancelableRequestProvider() { + // There may be requests whose result callback has not been run yet. We need + // to cancel them otherwise they may try and call us back after we've been + // deleted, or do other bad things. This can occur on shutdown (or browser + // context destruction) when a request is scheduled, completed (but not + // dispatched), then the BrowserContext is deleted. + base::AutoLock lock(pending_request_lock_); + while (!pending_requests_.empty()) + CancelRequestLocked(pending_requests_.begin()); +} + void CancelableRequestProvider::CancelRequestLocked( const CancelableRequestMap::iterator& item) { pending_request_lock_.AssertAcquired(); diff --git a/chrome/browser/cancelable_request.h b/chrome/browser/cancelable_request.h index 3ab893c..69939ed 100644 --- a/chrome/browser/cancelable_request.h +++ b/chrome/browser/cancelable_request.h @@ -122,7 +122,6 @@ class CancelableRequestProvider { typedef int Handle; CancelableRequestProvider(); - virtual ~CancelableRequestProvider(); // Called by the enduser of the request to cancel it. This MUST be called on // the same thread that originally issued the request (which is also the same @@ -131,6 +130,8 @@ class CancelableRequestProvider { void CancelRequest(Handle handle); protected: + virtual ~CancelableRequestProvider(); + // Adds a new request and initializes it. This is called by a derived class // to add a new request. The request's Init() will be called (which is why // the consumer is required. The handle to the new request is returned. diff --git a/chrome/browser/content_settings/content_settings_observer.h b/chrome/browser/content_settings/content_settings_observer.h index a72771b..01eb573 100644 --- a/chrome/browser/content_settings/content_settings_observer.h +++ b/chrome/browser/content_settings/content_settings_observer.h @@ -19,6 +19,9 @@ class Observer { const ContentSettingsPattern& secondary_pattern, ContentSettingsType content_type, std::string resource_identifier) = 0; + + protected: + virtual ~Observer() {} }; } // namespace content_settings diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h index 372c80c..1179f46 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api.h +++ b/chrome/browser/extensions/api/downloads/downloads_api.h @@ -66,6 +66,8 @@ class DownloadsFunctionInterface { }; protected: + virtual ~DownloadsFunctionInterface() {} + // Return true if args_ is well-formed, otherwise set error_ and return false. virtual bool ParseArgs() = 0; diff --git a/chrome/browser/extensions/app_notify_channel_ui.h b/chrome/browser/extensions/app_notify_channel_ui.h index 9e18e44..fa5d275 100644 --- a/chrome/browser/extensions/app_notify_channel_ui.h +++ b/chrome/browser/extensions/app_notify_channel_ui.h @@ -33,6 +33,9 @@ class AppNotifyChannelUI { public: // A callback for whether the user successfully set up sync or not. virtual void OnSyncSetupResult(bool enabled) = 0; + + protected: + virtual ~Delegate() {} }; // Shows a prompt for sync setup - |delegate| will be called back later when diff --git a/chrome/browser/extensions/bundle_installer.h b/chrome/browser/extensions/bundle_installer.h index 05262a9..655d3fa 100644 --- a/chrome/browser/extensions/bundle_installer.h +++ b/chrome/browser/extensions/bundle_installer.h @@ -51,6 +51,9 @@ class BundleInstaller : public WebstoreInstallHelper::Delegate, virtual void OnBundleInstallApproved() {} virtual void OnBundleInstallCanceled(bool user_initiated) {} virtual void OnBundleInstallCompleted() {} + + protected: + virtual ~Delegate() {} }; // Represents an individual member of the bundle. diff --git a/chrome/browser/extensions/extension_pref_value_map.h b/chrome/browser/extensions/extension_pref_value_map.h index e03123b..2cde315 100644 --- a/chrome/browser/extensions/extension_pref_value_map.h +++ b/chrome/browser/extensions/extension_pref_value_map.h @@ -59,8 +59,6 @@ class ExtensionPrefValueMap : public ProfileKeyedService { // Observer interface for monitoring ExtensionPrefValueMap. class Observer { public: - virtual ~Observer() {} - // Called when the value for the given |key| set by one of the extensions // changes. This does not necessarily mean that the effective value has // changed. @@ -70,6 +68,9 @@ class ExtensionPrefValueMap : public ProfileKeyedService { // Called when the ExtensionPrefValueMap is being destroyed. When called, // observers must unsubscribe. virtual void OnExtensionPrefValueMapDestruction() = 0; + + protected: + virtual ~Observer() {} }; ExtensionPrefValueMap(); diff --git a/chrome/browser/extensions/webstore_install_helper.h b/chrome/browser/extensions/webstore_install_helper.h index ff57a73..cb7fad7 100644 --- a/chrome/browser/extensions/webstore_install_helper.h +++ b/chrome/browser/extensions/webstore_install_helper.h @@ -59,6 +59,9 @@ class WebstoreInstallHelper : public content::UtilityProcessHostClient, const std::string& id, InstallHelperResultCode result_code, const std::string& error_message) = 0; + + protected: + virtual ~Delegate() {} }; // Only one of |icon_data| (based64-encoded icon data) or |icon_url| can be diff --git a/chrome/browser/extensions/webstore_installer.h b/chrome/browser/extensions/webstore_installer.h index bea6d6d..4312447 100644 --- a/chrome/browser/extensions/webstore_installer.h +++ b/chrome/browser/extensions/webstore_installer.h @@ -45,6 +45,9 @@ class WebstoreInstaller : public content::NotificationObserver, virtual void OnExtensionInstallSuccess(const std::string& id) = 0; virtual void OnExtensionInstallFailure(const std::string& id, const std::string& error) = 0; + + protected: + virtual ~Delegate() {} }; // Contains information about what parts of the extension install process can diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h index adfa4be..45e3125 100644 --- a/chrome/browser/history/history.h +++ b/chrome/browser/history/history.h @@ -253,8 +253,6 @@ class HistoryService : public CancelableRequestProvider, // should handle this appropriately. class URLEnumerator { public: - virtual ~URLEnumerator() {} - // Indicates that a URL is available. There will be exactly one call for // every URL in history. virtual void OnURL(const GURL& url) = 0; @@ -263,6 +261,9 @@ class HistoryService : public CancelableRequestProvider, // more callbacks made. This call is guaranteed to occur, even if there are // no URLs. If all URLs were iterated, success will be true. virtual void OnComplete(bool success) = 0; + + protected: + virtual ~URLEnumerator() {} }; // Enumerate all URLs in history. The given iterator will be owned by the diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index 161361e..c1bd929 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -330,8 +330,8 @@ scoped_ptr<CommandLine> NaClProcessHost::GetCommandForLaunchWithGdb( return scoped_ptr<CommandLine>(cmd_line); } #elif defined(OS_LINUX) -namespace { -class NaClGdbWatchDelegate : public MessageLoopForIO::Watcher { +class NaClProcessHost::NaClGdbWatchDelegate + : public MessageLoopForIO::Watcher { public: // fd_write_ is used by nacl-gdb via /proc/browser_PID/fd/fd_write_ NaClGdbWatchDelegate(int fd_read, int fd_write, @@ -356,13 +356,13 @@ class NaClGdbWatchDelegate : public MessageLoopForIO::Watcher { base::Closure reply_; }; -void NaClGdbWatchDelegate::OnFileCanReadWithoutBlocking(int fd) { +void NaClProcessHost::NaClGdbWatchDelegate::OnFileCanReadWithoutBlocking( + int fd) { char buf; if (HANDLE_EINTR(read(fd_read_, &buf, 1)) != 1 || buf != '\0') LOG(ERROR) << "Failed to sync with nacl-gdb"; BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, reply_); } -} // namespace bool NaClProcessHost::LaunchNaClGdb(base::ProcessId pid) { CommandLine::StringType nacl_gdb = diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h index 3a2d5fb..7c9945e 100644 --- a/chrome/browser/nacl_host/nacl_process_host.h +++ b/chrome/browser/nacl_host/nacl_process_host.h @@ -125,7 +125,9 @@ class NaClProcessHost : public content::BrowserChildProcessHostDelegate { #elif defined(OS_LINUX) bool wait_for_nacl_gdb_; MessageLoopForIO::FileDescriptorWatcher nacl_gdb_watcher_; - scoped_ptr<MessageLoopForIO::Watcher> nacl_gdb_watcher_delegate_; + + class NaClGdbWatchDelegate; + scoped_ptr<NaClGdbWatchDelegate> nacl_gdb_watcher_delegate_; #endif // The ChromeRenderMessageFilter that requested this NaCl process. We use // this for sending the reply once the process has started. diff --git a/chrome/browser/policy/policy_service.h b/chrome/browser/policy/policy_service.h index 93c7f91..67e515f 100644 --- a/chrome/browser/policy/policy_service.h +++ b/chrome/browser/policy/policy_service.h @@ -38,8 +38,6 @@ class PolicyService { public: class Observer { public: - virtual ~Observer() {} - // Invoked whenever policies for the |domain|, |component_id| namespace are // modified. This is only invoked for changes that happen after AddObserver // is called. |previous| contains the values of the policies before the @@ -53,6 +51,9 @@ class PolicyService { // IsInitializationComplete() is false, then this will be invoked once all // the policy providers are ready. virtual void OnPolicyServiceInitialized() {} + + protected: + virtual ~Observer() {} }; virtual ~PolicyService() {} diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h index e6406d2..4555f48 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.h +++ b/chrome/browser/safe_browsing/safe_browsing_service.h @@ -139,11 +139,11 @@ class SafeBrowsingService class Client { public: - virtual ~Client() {} - void OnSafeBrowsingResult(const SafeBrowsingCheck& check); protected: + virtual ~Client() {} + // Called when the result of checking a browse URL is known. virtual void OnBrowseUrlCheckResult(const GURL& url, UrlCheckResult result) {} diff --git a/chrome/common/important_file_writer.h b/chrome/common/important_file_writer.h index 6209faf..ee6bbe3 100644 --- a/chrome/common/important_file_writer.h +++ b/chrome/common/important_file_writer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -42,12 +42,13 @@ class ImportantFileWriter : public base::NonThreadSafe { // to also batch data serializations. class DataSerializer { public: - virtual ~DataSerializer() {} - // Should put serialized string in |data| and return true on successful // serialization. Will be called on the same thread on which // ImportantFileWriter has been created. virtual bool SerializeData(std::string* data) = 0; + + protected: + virtual ~DataSerializer() {} }; // Initialize the writer. diff --git a/chrome/common/net/gaia/gaia_oauth_client.h b/chrome/common/net/gaia/gaia_oauth_client.h index 6a132ac..b66a3f3 100644 --- a/chrome/common/net/gaia/gaia_oauth_client.h +++ b/chrome/common/net/gaia/gaia_oauth_client.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,8 +30,6 @@ class GaiaOAuthClient { public: class Delegate { public: - virtual ~Delegate() { } - // Invoked on a successful response to the GetTokensFromAuthCode request. virtual void OnGetTokensResponse(const std::string& refresh_token, const std::string& access_token, @@ -45,6 +43,9 @@ class GaiaOAuthClient { // response. This is invoked when the maximum number of retries have been // exhausted. If max_retries is -1, this is never invoked. virtual void OnNetworkError(int response_code) = 0; + + protected: + virtual ~Delegate() {} }; GaiaOAuthClient(const std::string& gaia_url, net::URLRequestContextGetter* context_getter); diff --git a/chrome/common/net/gaia/oauth2_access_token_consumer.h b/chrome/common/net/gaia/oauth2_access_token_consumer.h index cf7eb34..0b4038e 100644 --- a/chrome/common/net/gaia/oauth2_access_token_consumer.h +++ b/chrome/common/net/gaia/oauth2_access_token_consumer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,10 +14,11 @@ class GoogleServiceAuthError; // OAuth2AccessTokenFetcher can return results. class OAuth2AccessTokenConsumer { public: - virtual ~OAuth2AccessTokenConsumer() {} - virtual void OnGetTokenSuccess(const std::string& access_token) {} virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) {} + + protected: + virtual ~OAuth2AccessTokenConsumer() {} }; #endif // CHROME_COMMON_NET_GAIA_OAUTH2_ACCESS_TOKEN_CONSUMER_H_ diff --git a/chrome/common/net/gaia/oauth2_mint_token_flow.h b/chrome/common/net/gaia/oauth2_mint_token_flow.h index e50c526..058012d98 100644 --- a/chrome/common/net/gaia/oauth2_mint_token_flow.h +++ b/chrome/common/net/gaia/oauth2_mint_token_flow.h @@ -88,11 +88,12 @@ class OAuth2MintTokenFlow : public OAuth2ApiCallFlow { class Delegate { public: - Delegate() {} - virtual ~Delegate() {} virtual void OnMintTokenSuccess(const std::string& access_token) {} virtual void OnIssueAdviceSuccess(const IssueAdviceInfo& issue_advice) {} virtual void OnMintTokenFailure(const GoogleServiceAuthError& error) {} + + protected: + virtual ~Delegate() {} }; // An interceptor for tests. diff --git a/chrome/common/pref_store.h b/chrome/common/pref_store.h index 67fa4c9..1b63eb2 100644 --- a/chrome/common/pref_store.h +++ b/chrome/common/pref_store.h @@ -27,12 +27,13 @@ class PrefStore : public base::RefCounted<PrefStore> { // Observer interface for monitoring PrefStore. class Observer { public: - virtual ~Observer() {} - // Called when the value for the given |key| in the store changes. virtual void OnPrefValueChanged(const std::string& key) = 0; // Notification about the PrefStore being fully initialized. virtual void OnInitializationCompleted(bool succeeded) = 0; + + protected: + virtual ~Observer() {} }; // Return values for GetValue(). diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher.h b/chrome/service/cloud_print/cloud_print_url_fetcher.h index 654b4e7..253b873 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher.h +++ b/chrome/service/cloud_print/cloud_print_url_fetcher.h @@ -41,7 +41,6 @@ class CloudPrintURLFetcher class Delegate { public: - virtual ~Delegate() { } // Override this to handle the raw response as it is available. No response // error checking is done before this method is called. If the delegate // returns CONTINUE_PROCESSING, we will then check for network @@ -90,6 +89,9 @@ class CloudPrintURLFetcher // Authentication information may change between retries. // CloudPrintURLFetcher will request auth info before sending any request. virtual std::string GetAuthHeader() = 0; + + protected: + virtual ~Delegate() {} }; CloudPrintURLFetcher(); diff --git a/chrome/service/cloud_print/print_system.h b/chrome/service/cloud_print/print_system.h index 3f35cf2..a5463b4 100644 --- a/chrome/service/cloud_print/print_system.h +++ b/chrome/service/cloud_print/print_system.h @@ -119,10 +119,12 @@ class PrintSystem : public base::RefCountedThreadSafe<PrintSystem> { public: // Callback interface for JobSpooler notifications. class Delegate { - public: - virtual ~Delegate() { } - virtual void OnJobSpoolSucceeded(const PlatformJobId& job_id) = 0; - virtual void OnJobSpoolFailed() = 0; + public: + virtual void OnJobSpoolSucceeded(const PlatformJobId& job_id) = 0; + virtual void OnJobSpoolFailed() = 0; + + protected: + virtual ~Delegate() {} }; // Spool job to the printer asynchronously. Caller will be notified via diff --git a/chrome/test/automation/javascript_execution_controller.cc b/chrome/test/automation/javascript_execution_controller.cc index 9918bb1..cd058cf 100644 --- a/chrome/test/automation/javascript_execution_controller.cc +++ b/chrome/test/automation/javascript_execution_controller.cc @@ -16,8 +16,6 @@ int JavaScriptExecutionController::timeout_ms_ = -1; JavaScriptExecutionController::JavaScriptExecutionController() {} -JavaScriptExecutionController::~JavaScriptExecutionController() {} - bool JavaScriptExecutionController::ExecuteJavaScript( const std::string& script) { scoped_ptr<Value> return_value; @@ -30,6 +28,8 @@ bool JavaScriptExecutionController::ExecuteAsyncJavaScript( return ExecuteAndParseHelper(WrapAsyncJavaScript(script), &return_value); } +JavaScriptExecutionController::~JavaScriptExecutionController() {} + void JavaScriptExecutionController::Remove(int handle) { handle_to_object_.erase(handle); if (handle_to_object_.empty()) diff --git a/chrome/test/automation/javascript_execution_controller.h b/chrome/test/automation/javascript_execution_controller.h index 7f2679b..1da6d29 100644 --- a/chrome/test/automation/javascript_execution_controller.h +++ b/chrome/test/automation/javascript_execution_controller.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,7 +23,6 @@ class JavaScriptExecutionController : public base::SupportsWeakPtr<JavaScriptExecutionController> { public: JavaScriptExecutionController(); - virtual ~JavaScriptExecutionController(); // Executes |script| and parse the return value. Returns whether the // execution and parsing succeeded. @@ -76,6 +75,8 @@ class JavaScriptExecutionController static void set_timeout(int timeout_ms) { timeout_ms_ = timeout_ms; } protected: + virtual ~JavaScriptExecutionController(); + // Executes |script| and sets the JSON response |json|. Returns true // on success. virtual bool ExecuteJavaScriptAndGetJSON(const std::string& script, diff --git a/content/browser/device_orientation/provider.h b/content/browser/device_orientation/provider.h index a44128c..39ec860 100644 --- a/content/browser/device_orientation/provider.h +++ b/content/browser/device_orientation/provider.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,6 +20,9 @@ class CONTENT_EXPORT Provider : public base::RefCountedThreadSafe<Provider> { // An Observer must not synchronously call Provider::RemoveObserver // or Provider::AddObserver when this is called. virtual void OnOrientationUpdate(const Orientation& orientation) = 0; + + protected: + virtual ~Observer() {} }; // Returns a pointer to the singleton instance of this class. diff --git a/content/browser/download/download_item_impl.h b/content/browser/download/download_item_impl.h index 1f72f5ef..7975085 100644 --- a/content/browser/download/download_item_impl.h +++ b/content/browser/download/download_item_impl.h @@ -37,7 +37,6 @@ class CONTENT_EXPORT DownloadItemImpl : public content::DownloadItem { class CONTENT_EXPORT Delegate { public: Delegate(); - virtual ~Delegate(); // Used for catching use-after-free errors. void Attach(); @@ -75,6 +74,9 @@ class CONTENT_EXPORT DownloadItemImpl : public content::DownloadItem { // Assert consistent state for delgate object at various transitions. virtual void AssertStateConsistent(DownloadItem* download) const = 0; + protected: + virtual ~Delegate(); + private: // For "Outlives attached DownloadItemImpl" invariant assertion. int count_; diff --git a/content/browser/pepper_flash_settings_helper_impl.h b/content/browser/pepper_flash_settings_helper_impl.h index bfecc00..2c29deb 100644 --- a/content/browser/pepper_flash_settings_helper_impl.h +++ b/content/browser/pepper_flash_settings_helper_impl.h @@ -15,7 +15,7 @@ namespace content { class CONTENT_EXPORT PepperFlashSettingsHelperImpl : public PepperFlashSettingsHelper, - public PpapiPluginProcessHost::BrokerClient { + NON_EXPORTED_BASE(public PpapiPluginProcessHost::BrokerClient) { public: PepperFlashSettingsHelperImpl(); diff --git a/content/browser/ppapi_plugin_process_host.h b/content/browser/ppapi_plugin_process_host.h index e3bd540..0c6fe0b 100644 --- a/content/browser/ppapi_plugin_process_host.h +++ b/content/browser/ppapi_plugin_process_host.h @@ -52,15 +52,23 @@ class PpapiPluginProcessHost : public content::BrowserChildProcessHostDelegate, // Returns true if the current connection is off-the-record. virtual bool OffTheRecord() = 0; + + protected: + virtual ~Client() {} }; class PluginClient : public Client { public: // Returns the resource context for the renderer requesting the channel. virtual content::ResourceContext* GetResourceContext() = 0; + + protected: + virtual ~PluginClient() {} }; class BrokerClient : public Client { + protected: + virtual ~BrokerClient() {} }; virtual ~PpapiPluginProcessHost(); diff --git a/content/browser/renderer_host/media/audio_input_device_manager_event_handler.h b/content/browser/renderer_host/media/audio_input_device_manager_event_handler.h index 163aa6d..a95533a 100644 --- a/content/browser/renderer_host/media/audio_input_device_manager_event_handler.h +++ b/content/browser/renderer_host/media/audio_input_device_manager_event_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,6 +24,7 @@ class CONTENT_EXPORT AudioInputDeviceManagerEventHandler { // calling Stop() on a started device. virtual void OnDeviceStopped(int session_id) = 0; + protected: virtual ~AudioInputDeviceManagerEventHandler() {} }; diff --git a/content/browser/ssl/ssl_error_handler.h b/content/browser/ssl/ssl_error_handler.h index 3063d16..a84f9fd 100644 --- a/content/browser/ssl/ssl_error_handler.h +++ b/content/browser/ssl/ssl_error_handler.h @@ -60,6 +60,9 @@ class SSLErrorHandler : public base::RefCountedThreadSafe<SSLErrorHandler> { // Called when SSLErrorHandler decides to continue the request despite the // SSL error. virtual void ContinueSSLRequest(const content::GlobalRequestID& id) = 0; + + protected: + virtual ~Delegate() {} }; virtual SSLCertErrorHandler* AsSSLCertErrorHandler(); diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h index 704c073..6f4450b 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h @@ -58,10 +58,12 @@ using WebKit::WGC3Dsizeiptr; // context... class WebGraphicsContext3DSwapBuffersClient { public: - virtual ~WebGraphicsContext3DSwapBuffersClient() { } virtual void OnViewContextSwapBuffersPosted() = 0; virtual void OnViewContextSwapBuffersComplete() = 0; virtual void OnViewContextSwapBuffersAborted() = 0; + + protected: + virtual ~WebGraphicsContext3DSwapBuffersClient() {} }; class WebGraphicsContext3DErrorMessageCallback; diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index eeb3c9b..aa30711 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -83,10 +83,11 @@ class GpuCommandBufferStub public: class DestructionObserver { public: - ~DestructionObserver() {} - // Called in Destroy(), before the context/surface are released. virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) = 0; + + protected: + virtual ~DestructionObserver() {} }; GpuCommandBufferStub( diff --git a/content/common/gpu/gpu_watchdog.h b/content/common/gpu/gpu_watchdog.h index 4d20b0d..bc421ce 100644 --- a/content/common/gpu/gpu_watchdog.h +++ b/content/common/gpu/gpu_watchdog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,14 +9,12 @@ // GPUProcessor will regularly invoke CheckArmed. class GpuWatchdog { public: - GpuWatchdog() { - } - - virtual ~GpuWatchdog() { - }; - virtual void CheckArmed() = 0; + protected: + GpuWatchdog() {} + virtual ~GpuWatchdog() {}; + private: DISALLOW_COPY_AND_ASSIGN(GpuWatchdog); }; diff --git a/content/common/gpu/image_transport_surface.h b/content/common/gpu/image_transport_surface.h index 66c3b8e..a9be78f 100644 --- a/content/common/gpu/image_transport_surface.h +++ b/content/common/gpu/image_transport_surface.h @@ -59,7 +59,6 @@ class GLES2Decoder; class ImageTransportSurface { public: ImageTransportSurface(); - virtual ~ImageTransportSurface(); virtual void OnNewSurfaceACK( uint64 surface_id, TransportDIB::Handle surface_handle) = 0; @@ -80,6 +79,9 @@ class ImageTransportSurface { const gfx::Rect& new_damage_rect, std::vector<gfx::Rect>* regions); + protected: + virtual ~ImageTransportSurface(); + private: DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); }; diff --git a/content/public/browser/download_manager_delegate.cc b/content/public/browser/download_manager_delegate.cc index fb911b0..bb177c1 100644 --- a/content/public/browser/download_manager_delegate.cc +++ b/content/public/browser/download_manager_delegate.cc @@ -9,9 +9,6 @@ namespace content { -DownloadManagerDelegate::~DownloadManagerDelegate() { -} - DownloadId DownloadManagerDelegate::GetNextId() { return DownloadId::Invalid(); } @@ -50,4 +47,6 @@ bool DownloadManagerDelegate::GenerateFileHash() { return false; } +DownloadManagerDelegate::~DownloadManagerDelegate() {} + } // namespace content diff --git a/content/public/browser/download_manager_delegate.h b/content/public/browser/download_manager_delegate.h index 84a5db6..7f37f10b 100644 --- a/content/public/browser/download_manager_delegate.h +++ b/content/public/browser/download_manager_delegate.h @@ -36,8 +36,6 @@ typedef base::Callback<void(const FilePath&, // Browser's download manager: manages all downloads and destination view. class CONTENT_EXPORT DownloadManagerDelegate { public: - virtual ~DownloadManagerDelegate(); - // Lets the delegate know that the download manager is shutting down. virtual void Shutdown() {} @@ -133,6 +131,9 @@ class CONTENT_EXPORT DownloadManagerDelegate { bool can_save_as_complete, const SavePackagePathPickedCallback& callback) { } + + protected: + virtual ~DownloadManagerDelegate(); }; } // namespace content diff --git a/content/public/browser/profiler_subscriber.h b/content/public/browser/profiler_subscriber.h index f6679d9..ca83643 100644 --- a/content/public/browser/profiler_subscriber.h +++ b/content/public/browser/profiler_subscriber.h @@ -17,8 +17,6 @@ namespace content { // Objects interested in receiving profiler data derive from ProfilerSubscriber. class CONTENT_EXPORT ProfilerSubscriber { public: - virtual ~ProfilerSubscriber() {} - // Send number of pending processes to subscriber. |end| is set to true if it // is the last time. This is called on the UI thread. virtual void OnPendingProcesses(int sequence_number, @@ -31,6 +29,9 @@ class CONTENT_EXPORT ProfilerSubscriber { int sequence_number, const tracked_objects::ProcessDataSnapshot& profiler_data, ProcessType process_type) = 0; + + protected: + virtual ~ProfilerSubscriber() {} }; } // namespace content diff --git a/content/public/browser/worker_service_observer.h b/content/public/browser/worker_service_observer.h index e090511..213a9e6 100644 --- a/content/public/browser/worker_service_observer.h +++ b/content/public/browser/worker_service_observer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,13 +15,14 @@ namespace content { class WorkerServiceObserver { public: - virtual ~WorkerServiceObserver() {} - virtual void WorkerCreated(const GURL& url, const string16& name, int process_id, int route_id) {} virtual void WorkerDestroyed(int process_id, int route_id) {} + + protected: + virtual ~WorkerServiceObserver() {} }; } // namespace content diff --git a/content/public/renderer/render_view.h b/content/public/renderer/render_view.h index c09a527..a57ba9a 100644 --- a/content/public/renderer/render_view.h +++ b/content/public/renderer/render_view.h @@ -49,8 +49,6 @@ class CONTENT_EXPORT RenderView : public IPC::Sender { // been closed but not yet destroyed are excluded). static void ForEach(RenderViewVisitor* visitor); - virtual ~RenderView() {} - // Get the routing ID of the view. virtual int GetRoutingID() const = 0; @@ -128,6 +126,9 @@ class CONTENT_EXPORT RenderView : public IPC::Sender { WebKit::WebFrame* frame, const WebKit::WebURLRequest& request, WebKit::WebNavigationPolicy policy) = 0; + + protected: + virtual ~RenderView() {} }; } // namespace content diff --git a/content/renderer/media/scoped_loop_observer.h b/content/renderer/media/scoped_loop_observer.h index 127d992..6819652 100644 --- a/content/renderer/media/scoped_loop_observer.h +++ b/content/renderer/media/scoped_loop_observer.h @@ -24,9 +24,10 @@ class ScopedLoopObserver : public MessageLoop::DestructionObserver { public: explicit ScopedLoopObserver(MessageLoop* message_loop); - virtual ~ScopedLoopObserver(); protected: + virtual ~ScopedLoopObserver(); + // Accessor to the loop that's used by the derived class. base::MessageLoopProxy* message_loop() { return loop_; } diff --git a/content/renderer/pepper/pepper_parent_context_provider.h b/content/renderer/pepper/pepper_parent_context_provider.h index 48243d8..f9c64c2 100644 --- a/content/renderer/pepper/pepper_parent_context_provider.h +++ b/content/renderer/pepper/pepper_parent_context_provider.h @@ -16,12 +16,12 @@ namespace content { // parent context for display to the screen. class PepperParentContextProvider { public: - virtual ~PepperParentContextProvider(); virtual WebGraphicsContext3DCommandBufferImpl* GetParentContextForPlatformContext3D() = 0; protected: PepperParentContextProvider(); + virtual ~PepperParentContextProvider(); private: DISALLOW_COPY_AND_ASSIGN(PepperParentContextProvider); diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h index bb3e242..ec87a7b 100644 --- a/ipc/ipc_channel.h +++ b/ipc/ipc_channel.h @@ -50,7 +50,7 @@ class IPC_EXPORT Channel : public Sender { // IPC::Listener used to be IPC::Channel::Listener which prevented forward // declarations. To keep existing code compiling, we provide this // backwards-compatible definition. New code should use IPC::Listener. - // TODO(brettw) converto users of this and delete. + // TODO(brettw) convert users of this and delete. typedef IPC::Listener Listener; // Flags to test modes diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h index 200e0e4..964d797 100644 --- a/media/audio/audio_input_controller.h +++ b/media/audio/audio_input_controller.h @@ -80,12 +80,14 @@ class MEDIA_EXPORT AudioInputController // following methods are all called on the audio thread. class MEDIA_EXPORT EventHandler { public: - virtual ~EventHandler() {} virtual void OnCreated(AudioInputController* controller) = 0; virtual void OnRecording(AudioInputController* controller) = 0; virtual void OnError(AudioInputController* controller, int error_code) = 0; virtual void OnData(AudioInputController* controller, const uint8* data, uint32 size) = 0; + + protected: + virtual ~EventHandler() {} }; // A synchronous writer interface used by AudioInputController for diff --git a/media/audio/audio_io.h b/media/audio/audio_io.h index 8487214..50be7cd 100644 --- a/media/audio/audio_io.h +++ b/media/audio/audio_io.h @@ -56,8 +56,6 @@ class MEDIA_EXPORT AudioOutputStream { // itself such as creating Windows or initializing COM. class MEDIA_EXPORT AudioSourceCallback { public: - virtual ~AudioSourceCallback() {} - // Provide more data by filling |dest| up to |max_size| bytes. The provided // buffer size is determined by the |samples_per_packet| specified in // AudioParameters when the stream is created. The source will return @@ -85,6 +83,9 @@ class MEDIA_EXPORT AudioOutputStream { // plugins. In any case, data is usually immediately available, // so there would be no delay. virtual void WaitTillDataReady() {} + + protected: + virtual ~AudioSourceCallback() {} }; virtual ~AudioOutputStream() {} @@ -119,8 +120,6 @@ class MEDIA_EXPORT AudioInputStream { public: class MEDIA_EXPORT AudioInputCallback { public: - virtual ~AudioInputCallback() {} - // Called by the audio recorder when a full packet of audio data is // available. This is called from a special audio thread and the // implementation should return as soon as possible. @@ -138,6 +137,9 @@ class MEDIA_EXPORT AudioInputStream { // recording will not continue. |code| is an error code that is platform // specific. virtual void OnError(AudioInputStream* stream, int code) = 0; + + protected: + virtual ~AudioInputCallback() {} }; virtual ~AudioInputStream() {} diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h index 33bf217..a8857a2 100644 --- a/media/audio/audio_output_controller.h +++ b/media/audio/audio_output_controller.h @@ -76,11 +76,13 @@ class MEDIA_EXPORT AudioOutputController // following methods are called on the audio manager thread. class MEDIA_EXPORT EventHandler { public: - virtual ~EventHandler() {} virtual void OnCreated(AudioOutputController* controller) = 0; virtual void OnPlaying(AudioOutputController* controller) = 0; virtual void OnPaused(AudioOutputController* controller) = 0; virtual void OnError(AudioOutputController* controller, int error_code) = 0; + + protected: + virtual ~EventHandler() {} }; // A synchronous reader interface used by AudioOutputController for diff --git a/media/base/data_source.h b/media/base/data_source.h index f2a6a17..78e4cd6 100644 --- a/media/base/data_source.h +++ b/media/base/data_source.h @@ -14,8 +14,6 @@ namespace media { class MEDIA_EXPORT DataSourceHost { public: - virtual ~DataSourceHost(); - // Set the total size of the media file. virtual void SetTotalBytes(int64 total_bytes) = 0; @@ -27,6 +25,9 @@ class MEDIA_EXPORT DataSourceHost { // Notify the host that time range [start,end] has been buffered. virtual void AddBufferedTimeRange(base::TimeDelta start, base::TimeDelta end) = 0; + + protected: + virtual ~DataSourceHost(); }; class MEDIA_EXPORT DataSource : public base::RefCountedThreadSafe<DataSource> { diff --git a/media/base/demuxer.h b/media/base/demuxer.h index 48d0e6a..3fdc37b 100644 --- a/media/base/demuxer.h +++ b/media/base/demuxer.h @@ -16,8 +16,6 @@ namespace media { class MEDIA_EXPORT DemuxerHost : public DataSourceHost { public: - virtual ~DemuxerHost(); - // Sets the duration of the media in microseconds. // Duration may be kInfiniteDuration() if the duration is not known. virtual void SetDuration(base::TimeDelta duration) = 0; @@ -25,6 +23,9 @@ class MEDIA_EXPORT DemuxerHost : public DataSourceHost { // Stops execution of the pipeline due to a fatal error. Do not call this // method with PIPELINE_OK. virtual void OnDemuxerError(PipelineStatus error) = 0; + + protected: + virtual ~DemuxerHost(); }; class MEDIA_EXPORT Demuxer : public base::RefCountedThreadSafe<Demuxer> { diff --git a/media/filters/ffmpeg_glue.h b/media/filters/ffmpeg_glue.h index 4e122a6..c5aa15c 100644 --- a/media/filters/ffmpeg_glue.h +++ b/media/filters/ffmpeg_glue.h @@ -41,8 +41,6 @@ class MEDIA_EXPORT FFmpegURLProtocol { public: FFmpegURLProtocol() {} - virtual ~FFmpegURLProtocol() {} - // Read the given amount of bytes into data, returns the number of bytes read // if successful, kReadError otherwise. virtual size_t Read(size_t size, uint8* data) = 0; @@ -61,6 +59,9 @@ class MEDIA_EXPORT FFmpegURLProtocol { // Returns false if this protocol supports random seeking. virtual bool IsStreaming() = 0; + protected: + virtual ~FFmpegURLProtocol() {} + private: DISALLOW_COPY_AND_ASSIGN(FFmpegURLProtocol); }; diff --git a/media/video/capture/video_capture.h b/media/video/capture/video_capture.h index b825dff..d0aef98 100644 --- a/media/video/capture/video_capture.h +++ b/media/video/capture/video_capture.h @@ -44,7 +44,7 @@ class MEDIA_EXPORT VideoCapture { // TODO(wjia): add error codes. // Callbacks provided by client for notification of events. - class EventHandler { + class MEDIA_EXPORT EventHandler { public: // Notify client that video capture has been started. virtual void OnStarted(VideoCapture* capture) = 0; @@ -70,10 +70,12 @@ class MEDIA_EXPORT VideoCapture { virtual void OnDeviceInfoReceived( VideoCapture* capture, const VideoCaptureParams& device_info) = 0; + + protected: + virtual ~EventHandler() {} }; VideoCapture() {} - virtual ~VideoCapture() {} // Request video capture to start capturing with |capability|. // Also register |handler| with video capture for event handling. @@ -93,6 +95,9 @@ class MEDIA_EXPORT VideoCapture { virtual int CaptureHeight() = 0; virtual int CaptureFrameRate() = 0; + protected: + virtual ~VideoCapture() {} + private: DISALLOW_COPY_AND_ASSIGN(VideoCapture); }; diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h index c04d8dc..83d0b95 100644 --- a/media/video/video_decode_accelerator.h +++ b/media/video/video_decode_accelerator.h @@ -46,8 +46,6 @@ class MEDIA_EXPORT VideoDecodeAccelerator // implements. class MEDIA_EXPORT Client { public: - virtual ~Client() {} - // Callback to notify client that decoder has been initialized. virtual void NotifyInitializeDone() = 0; @@ -74,6 +72,9 @@ class MEDIA_EXPORT VideoDecodeAccelerator // Callback to notify about decoding errors. virtual void NotifyError(Error error) = 0; + + protected: + virtual ~Client() {} }; // Video decoder functions. diff --git a/media/webm/webm_stream_parser.cc b/media/webm/webm_stream_parser.cc index 38c5a7e..e1ed947 100644 --- a/media/webm/webm_stream_parser.cc +++ b/media/webm/webm_stream_parser.cc @@ -48,7 +48,7 @@ class FFmpegConfigHelper { scoped_array<uint8> url_protocol_buffer_; // Protocol used by |format_context_|. It must outlive the context object. - scoped_ptr<FFmpegURLProtocol> url_protocol_; + scoped_ptr<InMemoryUrlProtocol> url_protocol_; // FFmpeg format context for this demuxer. It is created by // avformat_open_input() during demuxer initialization and cleaned up with diff --git a/ppapi/proxy/host_dispatcher.h b/ppapi/proxy/host_dispatcher.h index 6c4dd2d..da64467 100644 --- a/ppapi/proxy/host_dispatcher.h +++ b/ppapi/proxy/host_dispatcher.h @@ -33,14 +33,15 @@ class PPAPI_PROXY_EXPORT HostDispatcher : public Dispatcher { // actually represents a stack of blocking messages. class SyncMessageStatusReceiver : public IPC::ChannelProxy::MessageFilter { public: - virtual ~SyncMessageStatusReceiver() {} - // Notification that a sync message is about to be sent out. virtual void BeginBlockOnSyncMessage() = 0; // Notification that a sync message reply was received and the dispatcher // is no longer blocked on a sync message. virtual void EndBlockOnSyncMessage() = 0; + + protected: + virtual ~SyncMessageStatusReceiver() {} }; // Constructor for the renderer side. This will take a reference to the diff --git a/remoting/client/frame_consumer.h b/remoting/client/frame_consumer.h index ce852b4..22701f4 100644 --- a/remoting/client/frame_consumer.h +++ b/remoting/client/frame_consumer.h @@ -17,9 +17,6 @@ namespace remoting { class FrameConsumer { public: - FrameConsumer() {} - virtual ~FrameConsumer() {} - // Accepts a buffer to be painted to the screen. The buffer's dimensions and // relative position within the frame are specified by |clip_area|. Only // pixels falling within |region| and the current clipping area are painted. @@ -41,6 +38,10 @@ class FrameConsumer { // Set the dimension of the entire host screen. virtual void SetSourceSize(const SkISize& source_size) = 0; + protected: + FrameConsumer() {} + virtual ~FrameConsumer() {} + private: DISALLOW_COPY_AND_ASSIGN(FrameConsumer); }; diff --git a/remoting/client/frame_producer.h b/remoting/client/frame_producer.h index c7976c5..340fbb59 100644 --- a/remoting/client/frame_producer.h +++ b/remoting/client/frame_producer.h @@ -19,7 +19,6 @@ namespace remoting { class FrameProducer { public: FrameProducer() {} - virtual ~FrameProducer() {} // Adds an image buffer to the pool of pending buffers for subsequent drawing. // Once drawing is completed the buffer will be returned to the consumer via @@ -43,6 +42,9 @@ class FrameProducer { virtual void SetOutputSizeAndClip(const SkISize& view_size, const SkIRect& clip_area) = 0; + protected: + virtual ~FrameProducer() {} + private: DISALLOW_COPY_AND_ASSIGN(FrameProducer); }; diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h index 0fb8532..397beff 100644 --- a/remoting/host/client_session.h +++ b/remoting/host/client_session.h @@ -36,8 +36,6 @@ class ClientSession : public protocol::HostEventStub, // Callback interface for passing events to the ChromotingHost. class EventHandler { public: - virtual ~EventHandler() {} - // Called after authentication has finished successfully. virtual void OnSessionAuthenticated(ClientSession* client) = 0; @@ -63,6 +61,9 @@ class ClientSession : public protocol::HostEventStub, ClientSession* client, const std::string& channel_name, const protocol::TransportRoute& route) = 0; + + protected: + virtual ~EventHandler() {} }; ClientSession(EventHandler* event_handler, diff --git a/remoting/protocol/session_manager.h b/remoting/protocol/session_manager.h index eb0c9db..fc9645c 100644 --- a/remoting/protocol/session_manager.h +++ b/remoting/protocol/session_manager.h @@ -76,8 +76,8 @@ class AuthenticatorFactory; // client side and one for the host side. class SessionManager : public base::NonThreadSafe { public: - SessionManager() { } - virtual ~SessionManager() { } + SessionManager() {} + virtual ~SessionManager() {} enum IncomingSessionResponse { // Accept the session. @@ -97,8 +97,7 @@ class SessionManager : public base::NonThreadSafe { class Listener { public: - Listener() { } - ~Listener() { } + Listener() {} // Called when the session manager is ready to create outgoing // sessions. May be called from Init() or after Init() @@ -115,6 +114,9 @@ class SessionManager : public base::NonThreadSafe { // The callback must take ownership of the |session| if it ACCEPTs it. virtual void OnIncomingSession(Session* session, IncomingSessionResponse* response) = 0; + + protected: + ~Listener() {} }; // Initializes the session client. Caller retains ownership of the |