diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 23:37:05 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 23:37:05 +0000 |
commit | 422c0f17466cddf30fd6815f9d3519a3815264c6 (patch) | |
tree | 416182cac3cc9968888273a8e68e58e51b45358c | |
parent | bfe5c69fc8cd05558fa5571ff8699a5b0edf0a64 (diff) | |
download | chromium_src-422c0f17466cddf30fd6815f9d3519a3815264c6.zip chromium_src-422c0f17466cddf30fd6815f9d3519a3815264c6.tar.gz chromium_src-422c0f17466cddf30fd6815f9d3519a3815264c6.tar.bz2 |
Fourth patch in making destructors of refcounted objects private.
BUG=26749
Review URL: http://codereview.chromium.org/360043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31167 0039d316-1c4b-4281-b951-d872f2087c98
23 files changed, 55 insertions, 23 deletions
diff --git a/chrome/browser/automation/automation_profile_impl.cc b/chrome/browser/automation/automation_profile_impl.cc index 50cb650..4d217d6 100644 --- a/chrome/browser/automation/automation_profile_impl.cc +++ b/chrome/browser/automation/automation_profile_impl.cc @@ -24,6 +24,7 @@ class AutomationURLRequestContext : public ChromeURLRequestContext { cookie_store_ = automation_cookie_store; } + private: virtual ~AutomationURLRequestContext() { // Clear out members before calling base class dtor since we don't // own any of them. @@ -40,7 +41,6 @@ class AutomationURLRequestContext : public ChromeURLRequestContext { blacklist_ = NULL; } - private: scoped_refptr<ChromeURLRequestContext> original_context_; DISALLOW_COPY_AND_ASSIGN(AutomationURLRequestContext); }; diff --git a/chrome/browser/automation/url_request_automation_job.h b/chrome/browser/automation/url_request_automation_job.h index f43316f..ff20c15 100644 --- a/chrome/browser/automation/url_request_automation_job.h +++ b/chrome/browser/automation/url_request_automation_job.h @@ -23,7 +23,6 @@ class URLRequestAutomationJob : public URLRequestJob { public: URLRequestAutomationJob( URLRequest* request, int tab, AutomationResourceMessageFilter* filter); - virtual ~URLRequestAutomationJob(); // Register an interceptor for URL requests. static bool InitializeInterceptor(); @@ -60,6 +59,8 @@ class URLRequestAutomationJob : public URLRequestJob { void OnRequestEnd(int tab, int id, const URLRequestStatus& status); private: + virtual ~URLRequestAutomationJob(); + int id_; int tab_; scoped_refptr<AutomationResourceMessageFilter> message_filter_; diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc index 12786d5..1cc28b9 100644 --- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc +++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc @@ -38,6 +38,9 @@ class GViewURLRequestTestJob : public URLRequestTestJob { } return true; } + + private: + ~GViewURLRequestTestJob() {} }; class GViewRequestInterceptorTest : public testing::Test { diff --git a/chrome/browser/debugger/devtools_remote_listen_socket.h b/chrome/browser/debugger/devtools_remote_listen_socket.h index e2e0174..d53364f 100644 --- a/chrome/browser/debugger/devtools_remote_listen_socket.h +++ b/chrome/browser/debugger/devtools_remote_listen_socket.h @@ -23,7 +23,6 @@ class DevToolsRemoteListenSocket : public ListenSocket { int port, ListenSocketDelegate* del, DevToolsRemoteListener* message_listener); - virtual ~DevToolsRemoteListenSocket(); protected: virtual void Listen() { ListenSocket::Listen(); } @@ -33,6 +32,7 @@ class DevToolsRemoteListenSocket : public ListenSocket { virtual void SendInternal(const char* bytes, int len); private: + virtual ~DevToolsRemoteListenSocket(); // The protocol states while reading socket input enum State { diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index b6cba21..a2ea998 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -38,7 +38,6 @@ static const char kChromeURLScheme[] = "chrome"; class URLRequestChromeJob : public URLRequestJob { public: explicit URLRequestChromeJob(URLRequest* request); - virtual ~URLRequestChromeJob(); // URLRequestJob implementation. virtual void Start(); @@ -55,6 +54,8 @@ class URLRequestChromeJob : public URLRequestJob { } private: + virtual ~URLRequestChromeJob(); + // Helper for Start(), to let us start asynchronously. // (This pattern is shared by most URLRequestJob implementations.) void StartAsync(); @@ -82,9 +83,10 @@ class URLRequestChromeJob : public URLRequestJob { class URLRequestChromeFileJob : public URLRequestFileJob { public: URLRequestChromeFileJob(URLRequest* request, const FilePath& path); - virtual ~URLRequestChromeFileJob(); private: + virtual ~URLRequestChromeFileJob(); + DISALLOW_EVIL_CONSTRUCTORS(URLRequestChromeFileJob); }; diff --git a/chrome/browser/extensions/autoupdate_interceptor.cc b/chrome/browser/extensions/autoupdate_interceptor.cc index f8f9bfd..0067940 100644 --- a/chrome/browser/extensions/autoupdate_interceptor.cc +++ b/chrome/browser/extensions/autoupdate_interceptor.cc @@ -18,6 +18,9 @@ class AutoUpdateTestRequestJob : public URLRequestTestJob { const std::string& response_data) : URLRequestTestJob( request, URLRequestTestJob::test_headers(), response_data, true) {} virtual int GetResponseCode() const { return 200; } + + private: + ~AutoUpdateTestRequestJob() {} }; diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index 2f87798..980c3c9 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -27,6 +27,8 @@ class SimpleTestJob : public URLRequestTestJob { public: explicit SimpleTestJob(URLRequest* request) : URLRequestTestJob(request, test_headers(), test_data_1(), true) {} + private: + ~SimpleTestJob() {} }; class MockUserScriptMaster : public UserScriptMaster { diff --git a/chrome/browser/gtk/options/cookies_view_unittest.cc b/chrome/browser/gtk/options/cookies_view_unittest.cc index 6f7240f..ea5f7af 100644 --- a/chrome/browser/gtk/options/cookies_view_unittest.cc +++ b/chrome/browser/gtk/options/cookies_view_unittest.cc @@ -23,6 +23,9 @@ class TestURLRequestContext : public URLRequestContext { TestURLRequestContext() { cookie_store_ = new net::CookieMonster(); } + + private: + ~TestURLRequestContext() {} }; class TestURLRequestContextGetter : public URLRequestContextGetter { diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h index e597a3d..0918cde 100644 --- a/chrome/browser/net/chrome_url_request_context.h +++ b/chrome/browser/net/chrome_url_request_context.h @@ -146,7 +146,6 @@ class ChromeURLRequestContext : public URLRequestContext { typedef std::map<std::string, FilePath> ExtensionPaths; ChromeURLRequestContext(); - virtual ~ChromeURLRequestContext(); // Gets the path to the directory for the specified extension. FilePath GetPathForExtension(const std::string& id); @@ -192,6 +191,7 @@ class ChromeURLRequestContext : public URLRequestContext { // constructor, then you should hold a reference to |other|, as we // depend on |other| being alive. ChromeURLRequestContext(ChromeURLRequestContext* other); + virtual ~ChromeURLRequestContext(); public: // Setters to simplify initializing from factory objects. diff --git a/chrome/browser/net/metadata_url_request.cc b/chrome/browser/net/metadata_url_request.cc index a0f33d2..bc631f3 100644 --- a/chrome/browser/net/metadata_url_request.cc +++ b/chrome/browser/net/metadata_url_request.cc @@ -22,7 +22,6 @@ const char kMetadataScheme[] = "metadata"; class MetadataRequestHandler : public URLRequestJob { public: explicit MetadataRequestHandler(URLRequest* request); - ~MetadataRequestHandler(); static URLRequestJob* Factory(URLRequest* request, const std::string& scheme); @@ -33,6 +32,8 @@ class MetadataRequestHandler : public URLRequestJob { virtual bool GetMimeType(std::string* mime_type) const; private: + ~MetadataRequestHandler(); + void StartAsync(); std::string result_; bool parsed; diff --git a/chrome/browser/net/url_fetcher_unittest.cc b/chrome/browser/net/url_fetcher_unittest.cc index 25fca55..8ec69dc 100644 --- a/chrome/browser/net/url_fetcher_unittest.cc +++ b/chrome/browser/net/url_fetcher_unittest.cc @@ -155,11 +155,11 @@ class CancelTestURLRequestContext : public TestURLRequestContext { *destructor_called_ = false; } + private: virtual ~CancelTestURLRequestContext() { *destructor_called_ = true; } - private: bool* destructor_called_; }; diff --git a/chrome/browser/net/url_request_failed_dns_job.h b/chrome/browser/net/url_request_failed_dns_job.h index b1abc87..f785c1a 100644 --- a/chrome/browser/net/url_request_failed_dns_job.h +++ b/chrome/browser/net/url_request_failed_dns_job.h @@ -25,6 +25,8 @@ class URLRequestFailedDnsJob : public URLRequestJob { static void AddUrlHandler(); private: + ~URLRequestFailedDnsJob() {} + // Simulate a DNS failure. void StartAsync(); }; diff --git a/chrome/browser/net/url_request_mock_http_job.h b/chrome/browser/net/url_request_mock_http_job.h index b5ef740..abfcf67 100644 --- a/chrome/browser/net/url_request_mock_http_job.h +++ b/chrome/browser/net/url_request_mock_http_job.h @@ -16,7 +16,6 @@ class FilePath; class URLRequestMockHTTPJob : public URLRequestFileJob { public: URLRequestMockHTTPJob(URLRequest* request, const FilePath& file_path); - virtual ~URLRequestMockHTTPJob() { } virtual bool GetMimeType(std::string* mime_type) const; virtual bool GetCharset(std::string* charset); @@ -32,6 +31,8 @@ class URLRequestMockHTTPJob : public URLRequestFileJob { static GURL GetMockUrl(const FilePath& path); protected: + virtual ~URLRequestMockHTTPJob() { } + static FilePath GetOnDiskPath(const FilePath& base_path, URLRequest* request, const std::string& scheme); diff --git a/chrome/browser/net/url_request_mock_link_doctor_job.h b/chrome/browser/net/url_request_mock_link_doctor_job.h index 74fd00e..3f695fe 100644 --- a/chrome/browser/net/url_request_mock_link_doctor_job.h +++ b/chrome/browser/net/url_request_mock_link_doctor_job.h @@ -12,12 +12,14 @@ class URLRequestMockLinkDoctorJob : public URLRequestMockHTTPJob { public: URLRequestMockLinkDoctorJob(URLRequest* request); - virtual ~URLRequestMockLinkDoctorJob() { } static URLRequest::ProtocolFactory Factory; // Adds the testing URLs to the URLRequestFilter. static void AddUrlHandler(); + + private: + ~URLRequestMockLinkDoctorJob() {} }; # endif // CHROME_BROWSER_NET_URL_REQUEST_MOCK_LINK_DOCTOR_JOB_H_ diff --git a/chrome/browser/net/url_request_mock_net_error_job.h b/chrome/browser/net/url_request_mock_net_error_job.h index 8a7c87c..da81339 100644 --- a/chrome/browser/net/url_request_mock_net_error_job.h +++ b/chrome/browser/net/url_request_mock_net_error_job.h @@ -17,7 +17,6 @@ class URLRequestMockNetErrorJob : public URLRequestMockHTTPJob { const std::vector<int>& errors, net::X509Certificate* ssl_cert, const FilePath& file_path); - virtual ~URLRequestMockNetErrorJob(); virtual void Start(); virtual void ContinueDespiteLastError(); @@ -37,6 +36,7 @@ class URLRequestMockNetErrorJob : public URLRequestMockHTTPJob { static void RemoveMockedURL(const GURL& url); private: + ~URLRequestMockNetErrorJob(); struct MockInfo { MockInfo() : ssl_cert(NULL) { } MockInfo(std::wstring base, diff --git a/chrome/browser/net/url_request_slow_download_job.h b/chrome/browser/net/url_request_slow_download_job.h index 49785a8..d0ac671 100644 --- a/chrome/browser/net/url_request_slow_download_job.h +++ b/chrome/browser/net/url_request_slow_download_job.h @@ -16,7 +16,6 @@ class URLRequestSlowDownloadJob : public URLRequestJob { public: explicit URLRequestSlowDownloadJob(URLRequest* request); - virtual ~URLRequestSlowDownloadJob() { } // Timer callback, used to check to see if we should finish our download and // send the second chunk. @@ -40,6 +39,8 @@ class URLRequestSlowDownloadJob : public URLRequestJob { static void AddUrlHandler(); private: + virtual ~URLRequestSlowDownloadJob() { } + void GetResponseInfoConst(net::HttpResponseInfo* info) const; // Mark all pending requests to be finished. We keep track of pending diff --git a/chrome/browser/net/url_request_slow_http_job.h b/chrome/browser/net/url_request_slow_http_job.h index 5385ff8..7545f4e 100644 --- a/chrome/browser/net/url_request_slow_http_job.h +++ b/chrome/browser/net/url_request_slow_http_job.h @@ -29,6 +29,8 @@ class URLRequestSlowHTTPJob : public URLRequestMockHTTPJob { virtual void Start(); private: + ~URLRequestSlowHTTPJob() {} + void RealStart(); base::OneShotTimer<URLRequestSlowHTTPJob> delay_timer_; diff --git a/chrome/browser/renderer_host/async_resource_handler.cc b/chrome/browser/renderer_host/async_resource_handler.cc index 7e83320..331f6f0 100644 --- a/chrome/browser/renderer_host/async_resource_handler.cc +++ b/chrome/browser/renderer_host/async_resource_handler.cc @@ -38,17 +38,18 @@ class SharedIOBuffer : public net::IOBuffer { data_ = reinterpret_cast<char*>(shared_memory_.memory()); } } - ~SharedIOBuffer() { - // TODO(willchan): Remove after debugging bug 16371. - CHECK(g_spare_read_buffer != this); - data_ = NULL; - } base::SharedMemory* shared_memory() { return &shared_memory_; } bool ok() { return ok_; } int buffer_size() { return buffer_size_; } private: + ~SharedIOBuffer() { + // TODO(willchan): Remove after debugging bug 16371. + CHECK(g_spare_read_buffer != this); + data_ = NULL; + } + base::SharedMemory shared_memory_; bool ok_; int buffer_size_; diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h index 7164bd5..8c2c5b9 100644 --- a/chrome/browser/sync/glue/http_bridge.h +++ b/chrome/browser/sync/glue/http_bridge.h @@ -47,7 +47,6 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, // Typically |baseline_context| should be the URLRequestContext of the // currently active profile. explicit RequestContext(URLRequestContext* baseline_context); - virtual ~RequestContext(); // Set the user agent for requests using this context. The default is // the browser's UA string. @@ -65,6 +64,8 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>, } private: + ~RequestContext(); + std::string user_agent_; URLRequestContext* baseline_context_; diff --git a/chrome/plugin/plugin_channel_base.h b/chrome/plugin/plugin_channel_base.h index bf7db52..0e7a919 100644 --- a/chrome/plugin/plugin_channel_base.h +++ b/chrome/plugin/plugin_channel_base.h @@ -21,7 +21,6 @@ class PluginChannelBase : public IPC::Channel::Listener, public IPC::Message::Sender, public base::RefCountedThreadSafe<PluginChannelBase> { public: - virtual ~PluginChannelBase(); // WebPlugin[Delegate] call these on construction and destruction to setup // the routing and manage lifetime of this object. This is also called by @@ -55,6 +54,10 @@ class PluginChannelBase : public IPC::Channel::Listener, protected: typedef PluginChannelBase* (*PluginChannelFactory)(); + friend class base::RefCountedThreadSafe<PluginChannelBase>; + + virtual ~PluginChannelBase(); + // Returns a PluginChannelBase derived object for the given channel name. // If an existing channel exists returns that object, otherwise creates a // new one. Even though on creation the object is refcounted, each caller diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h index e85ca0a..79b36bf 100644 --- a/chrome/plugin/webplugin_delegate_stub.h +++ b/chrome/plugin/webplugin_delegate_stub.h @@ -38,7 +38,6 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, public: WebPluginDelegateStub(const std::string& mime_type, int instance_id, PluginChannel* channel); - ~WebPluginDelegateStub(); // IPC::Channel::Listener implementation: virtual void OnMessageReceived(const IPC::Message& msg); @@ -50,6 +49,10 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, WebPluginProxy* webplugin() { return webplugin_; } private: + friend class base::RefCounted<WebPluginDelegateStub>; + + ~WebPluginDelegateStub(); + // Message handlers for the WebPluginDelegate calls that are proxied from the // renderer over the IPC channel. void OnInit(const PluginMsg_Init_Params& params, bool* result); diff --git a/chrome/renderer/plugin_channel_host.h b/chrome/renderer/plugin_channel_host.h index f3d066b..b37ab99 100644 --- a/chrome/renderer/plugin_channel_host.h +++ b/chrome/renderer/plugin_channel_host.h @@ -17,8 +17,6 @@ class PluginChannelHost : public PluginChannelBase { static PluginChannelHost* GetPluginChannelHost( const std::string& channel_name, MessageLoop* ipc_message_loop); - ~PluginChannelHost(); - virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now); int GenerateRouteID(); @@ -40,6 +38,7 @@ class PluginChannelHost : public PluginChannelBase { private: // Called on the render thread PluginChannelHost(); + ~PluginChannelHost(); static PluginChannelBase* ClassFactory() { return new PluginChannelHost(); } diff --git a/chrome/test/automation/automation_handle_tracker.h b/chrome/test/automation/automation_handle_tracker.h index 98a9fb9..12a5920 100644 --- a/chrome/test/automation/automation_handle_tracker.h +++ b/chrome/test/automation/automation_handle_tracker.h @@ -27,7 +27,6 @@ class AutomationResourceProxy AutomationResourceProxy(AutomationHandleTracker* tracker, AutomationMessageSender* sender, AutomationHandle handle); - virtual ~AutomationResourceProxy(); // Marks this proxy object as no longer valid; this generally means // that the corresponding resource on the app side is gone. @@ -39,6 +38,9 @@ class AutomationResourceProxy protected: friend class AutomationHandleTracker; + friend class base::RefCountedThreadSafe<AutomationResourceProxy>; + + virtual ~AutomationResourceProxy(); AutomationHandle handle_; |