summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-07 00:23:14 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-07 00:23:14 +0000
commit84bbb2b55d8ae1a517b16cb358803ccf1de745c1 (patch)
treeeafc3dcb3da2d3342b26125bf660cb3144f213f9
parent4814b51fe8210920ec1ebdde20c8deb9e65a1ff9 (diff)
downloadchromium_src-84bbb2b55d8ae1a517b16cb358803ccf1de745c1.zip
chromium_src-84bbb2b55d8ae1a517b16cb358803ccf1de745c1.tar.gz
chromium_src-84bbb2b55d8ae1a517b16cb358803ccf1de745c1.tar.bz2
Eighth patch in making destructors of refcounted objects private.
BUG=26749 Review URL: http://codereview.chromium.org/378004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31339 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/privacy_blacklist/blacklist_manager.h8
-rw-r--r--chrome/browser/renderer_host/async_resource_handler.cc3
-rw-r--r--chrome/browser/renderer_host/async_resource_handler.h2
-rw-r--r--chrome/browser/renderer_host/audio_renderer_host.h9
-rw-r--r--chrome/browser/renderer_host/audio_renderer_host_unittest.cc5
-rw-r--r--chrome/browser/renderer_host/buffered_resource_handler.h2
-rw-r--r--chrome/browser/renderer_host/cross_site_resource_handler.h2
-rw-r--r--chrome/browser/renderer_host/download_resource_handler.h2
-rw-r--r--chrome/browser/renderer_host/download_throttling_resource_handler.h3
-rw-r--r--chrome/browser/renderer_host/render_widget_helper.h4
-rw-r--r--chrome/browser/renderer_host/resource_handler.h13
-rw-r--r--chrome/browser/renderer_host/safe_browsing_resource_handler.h3
-rw-r--r--chrome/browser/renderer_host/save_file_resource_handler.h2
-rw-r--r--chrome/browser/renderer_host/site_instance.h7
-rw-r--r--chrome/browser/renderer_host/sync_resource_handler.h4
-rw-r--r--chrome/browser/renderer_host/x509_user_cert_resource_handler.h2
-rw-r--r--chrome/browser/safe_browsing/bloom_filter.h5
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database_bloom.cc5
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.h5
19 files changed, 63 insertions, 23 deletions
diff --git a/chrome/browser/privacy_blacklist/blacklist_manager.h b/chrome/browser/privacy_blacklist/blacklist_manager.h
index 5d6df52..80faec5 100644
--- a/chrome/browser/privacy_blacklist/blacklist_manager.h
+++ b/chrome/browser/privacy_blacklist/blacklist_manager.h
@@ -28,7 +28,7 @@ class BlacklistPathProvider {
virtual ~BlacklistPathProvider();
virtual std::vector<FilePath> GetPersistentBlacklistPaths() = 0;
-
+
virtual std::vector<FilePath> GetTransientBlacklistPaths() = 0;
};
@@ -60,6 +60,10 @@ class BlacklistManager : public base::RefCountedThreadSafe<BlacklistManager>,
class CompileBlacklistTask;
class ReadBlacklistTask;
+ friend class base::RefCountedThreadSafe<BlacklistManager>;
+
+ ~BlacklistManager() {}
+
void CompileBlacklist();
void ReadBlacklist();
@@ -71,7 +75,7 @@ class BlacklistManager : public base::RefCountedThreadSafe<BlacklistManager>,
// True after the first blacklist read has finished (regardless of success).
// Used to avoid an infinite loop.
bool first_read_finished_;
-
+
Profile* profile_;
// Path where we store the compiled blacklist.
diff --git a/chrome/browser/renderer_host/async_resource_handler.cc b/chrome/browser/renderer_host/async_resource_handler.cc
index 331f6f0..1bf7259 100644
--- a/chrome/browser/renderer_host/async_resource_handler.cc
+++ b/chrome/browser/renderer_host/async_resource_handler.cc
@@ -70,6 +70,9 @@ AsyncResourceHandler::AsyncResourceHandler(
next_buffer_size_(kInitialReadBufSize) {
}
+AsyncResourceHandler::~AsyncResourceHandler() {
+}
+
bool AsyncResourceHandler::OnUploadProgress(int request_id,
uint64 position,
uint64 size) {
diff --git a/chrome/browser/renderer_host/async_resource_handler.h b/chrome/browser/renderer_host/async_resource_handler.h
index b99ba10..6fb2a8f 100644
--- a/chrome/browser/renderer_host/async_resource_handler.h
+++ b/chrome/browser/renderer_host/async_resource_handler.h
@@ -39,6 +39,8 @@ class AsyncResourceHandler : public ResourceHandler {
static void GlobalCleanup();
private:
+ ~AsyncResourceHandler();
+
scoped_refptr<SharedIOBuffer> read_buffer_;
ResourceDispatcherHost::Receiver* receiver_;
int process_id_;
diff --git a/chrome/browser/renderer_host/audio_renderer_host.h b/chrome/browser/renderer_host/audio_renderer_host.h
index 49c05c8..6c3428e 100644
--- a/chrome/browser/renderer_host/audio_renderer_host.h
+++ b/chrome/browser/renderer_host/audio_renderer_host.h
@@ -92,9 +92,6 @@ class AudioRendererHost
// Called from UI thread from the owner of this object.
AudioRendererHost();
- // Destruction always happens on the IO thread (see DeleteOnIOThread above).
- virtual ~AudioRendererHost();
-
// Called from UI thread from the owner of this object to kick start
// destruction of streams in IO thread.
void Destroy();
@@ -115,6 +112,12 @@ class AudioRendererHost
bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok);
protected:
+ friend class ChromeThread;
+ friend class DeleteTask<AudioRendererHost>;
+
+ // Destruction always happens on the IO thread (see DeleteOnIOThread above).
+ virtual ~AudioRendererHost();
+
//---------------------------------------------------------------------------
// Helper methods called from IPCAudioSource or from this class, since
// methods in IPCAudioSource maybe called from hardware audio threads, these
diff --git a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc
index b4d70cd..2ae271a 100644
--- a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc
+++ b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc
@@ -34,9 +34,6 @@ class MockAudioRendererHost : public AudioRendererHost {
: AudioRendererHost() {
}
- virtual ~MockAudioRendererHost() {
- }
-
// A list of mock methods.
MOCK_METHOD4(OnRequestPacket,
void(int routing_id, int stream_id,
@@ -78,6 +75,8 @@ class MockAudioRendererHost : public AudioRendererHost {
}
private:
+ virtual ~MockAudioRendererHost() {}
+
// These handler methods do minimal things and delegate to the mock methods.
void OnRequestPacket(const IPC::Message& msg, int stream_id,
size_t bytes_in_buffer, int64 message_timestamp) {
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.h b/chrome/browser/renderer_host/buffered_resource_handler.h
index 52608cc..6bc34e1 100644
--- a/chrome/browser/renderer_host/buffered_resource_handler.h
+++ b/chrome/browser/renderer_host/buffered_resource_handler.h
@@ -34,6 +34,8 @@ class BufferedResourceHandler : public ResourceHandler {
void OnRequestClosed();
private:
+ ~BufferedResourceHandler() {}
+
// Returns true if we should delay OnResponseStarted forwarding.
bool DelayResponse();
diff --git a/chrome/browser/renderer_host/cross_site_resource_handler.h b/chrome/browser/renderer_host/cross_site_resource_handler.h
index b50e641..7e916c1 100644
--- a/chrome/browser/renderer_host/cross_site_resource_handler.h
+++ b/chrome/browser/renderer_host/cross_site_resource_handler.h
@@ -37,6 +37,8 @@ class CrossSiteResourceHandler : public ResourceHandler {
void ResumeResponse();
private:
+ ~CrossSiteResourceHandler() {}
+
// Prepare to render the cross-site response in a new RenderViewHost, by
// telling the old RenderViewHost to run its onunload handler.
void StartCrossSiteTransition(
diff --git a/chrome/browser/renderer_host/download_resource_handler.h b/chrome/browser/renderer_host/download_resource_handler.h
index e4613a8..9237cc5 100644
--- a/chrome/browser/renderer_host/download_resource_handler.h
+++ b/chrome/browser/renderer_host/download_resource_handler.h
@@ -52,6 +52,8 @@ class DownloadResourceHandler : public ResourceHandler {
void CheckWriteProgress();
private:
+ ~DownloadResourceHandler() {}
+
void StartPauseTimer();
int download_id_;
diff --git a/chrome/browser/renderer_host/download_throttling_resource_handler.h b/chrome/browser/renderer_host/download_throttling_resource_handler.h
index 117b3d2..8a110f3 100644
--- a/chrome/browser/renderer_host/download_throttling_resource_handler.h
+++ b/chrome/browser/renderer_host/download_throttling_resource_handler.h
@@ -34,7 +34,6 @@ class DownloadThrottlingResourceHandler
int render_view_id,
int request_id,
bool in_complete);
- virtual ~DownloadThrottlingResourceHandler();
// ResourceHanlder implementation:
virtual bool OnUploadProgress(int request_id,
@@ -55,6 +54,8 @@ class DownloadThrottlingResourceHandler
void ContinueDownload();
private:
+ virtual ~DownloadThrottlingResourceHandler();
+
void CopyTmpBufferToDownloadHandler();
ResourceDispatcherHost* host_;
diff --git a/chrome/browser/renderer_host/render_widget_helper.h b/chrome/browser/renderer_host/render_widget_helper.h
index d3593da..780fc35 100644
--- a/chrome/browser/renderer_host/render_widget_helper.h
+++ b/chrome/browser/renderer_host/render_widget_helper.h
@@ -88,7 +88,6 @@ class RenderWidgetHelper :
public base::RefCountedThreadSafe<RenderWidgetHelper> {
public:
RenderWidgetHelper();
- ~RenderWidgetHelper();
void Init(int render_process_id,
ResourceDispatcherHost* resource_dispatcher_host);
@@ -138,10 +137,13 @@ class RenderWidgetHelper :
// on the IO thread and destroyed on the UI thread.
class PaintMsgProxy;
friend class PaintMsgProxy;
+ friend class base::RefCountedThreadSafe<RenderWidgetHelper>;
// Map from render_widget_id to live PaintMsgProxy instance.
typedef base::hash_map<int, PaintMsgProxy*> PaintMsgProxyMap;
+ ~RenderWidgetHelper();
+
// Called on the UI thread to discard a paint message.
void OnDiscardPaintMsg(PaintMsgProxy* proxy);
diff --git a/chrome/browser/renderer_host/resource_handler.h b/chrome/browser/renderer_host/resource_handler.h
index f4fe726..59f89c7 100644
--- a/chrome/browser/renderer_host/resource_handler.h
+++ b/chrome/browser/renderer_host/resource_handler.h
@@ -48,6 +48,11 @@ struct SyncLoadResult : ResourceResponseHead {
// Simple wrapper that refcounts ResourceResponseHead.
struct ResourceResponse : public base::RefCounted<ResourceResponse> {
ResourceResponseHead response_head;
+
+ private:
+ friend class base::RefCounted<ResourceResponse>;
+
+ ~ResourceResponse() {}
};
// The resource dispatcher host uses this interface to push load events to the
@@ -57,8 +62,6 @@ class ResourceHandler
: public base::RefCountedThreadSafe<
ResourceHandler, ChromeThread::DeleteOnIOThread> {
public:
- virtual ~ResourceHandler() {}
-
// Called as upload progress is made.
virtual bool OnUploadProgress(int request_id,
uint64 position,
@@ -100,6 +103,12 @@ class ResourceHandler
// Signals that the request is closed (i.e. finished successfully, cancelled).
// This is a signal that the associated URLRequest isn't valid anymore.
virtual void OnRequestClosed() { }
+
+ protected:
+ friend class ChromeThread;
+ friend class DeleteTask<ResourceHandler>;
+
+ virtual ~ResourceHandler() {}
};
#endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_
diff --git a/chrome/browser/renderer_host/safe_browsing_resource_handler.h b/chrome/browser/renderer_host/safe_browsing_resource_handler.h
index a849233..f7b75be 100644
--- a/chrome/browser/renderer_host/safe_browsing_resource_handler.h
+++ b/chrome/browser/renderer_host/safe_browsing_resource_handler.h
@@ -27,7 +27,6 @@ class SafeBrowsingResourceHandler : public ResourceHandler,
SafeBrowsingService* safe_browsing,
ResourceDispatcherHost* resource_dispatcher_host,
ResourceDispatcherHost::Receiver* receiver);
- ~SafeBrowsingResourceHandler();
// ResourceHandler implementation:
bool OnUploadProgress(int request_id, uint64 position, uint64 size);
@@ -57,6 +56,8 @@ class SafeBrowsingResourceHandler : public ResourceHandler,
const NotificationDetails& details);
private:
+ ~SafeBrowsingResourceHandler();
+
// Helper function for resuming the following of a redirect response.
void ResumeRedirect();
diff --git a/chrome/browser/renderer_host/save_file_resource_handler.h b/chrome/browser/renderer_host/save_file_resource_handler.h
index 9a976b2..07eca4d 100644
--- a/chrome/browser/renderer_host/save_file_resource_handler.h
+++ b/chrome/browser/renderer_host/save_file_resource_handler.h
@@ -49,6 +49,8 @@ class SaveFileResourceHandler : public ResourceHandler {
}
private:
+ ~SaveFileResourceHandler() {}
+
int save_id_;
int render_process_id_;
int render_view_id_;
diff --git a/chrome/browser/renderer_host/site_instance.h b/chrome/browser/renderer_host/site_instance.h
index d8b7672..f68789e 100644
--- a/chrome/browser/renderer_host/site_instance.h
+++ b/chrome/browser/renderer_host/site_instance.h
@@ -48,9 +48,6 @@ class BrowsingInstance;
class SiteInstance : public base::RefCounted<SiteInstance>,
public NotificationObserver {
public:
- // Virtual to allow tests to extend it.
- virtual ~SiteInstance();
-
// Get the BrowsingInstance to which this SiteInstance belongs.
BrowsingInstance* browsing_instance() { return browsing_instance_; }
@@ -132,8 +129,12 @@ class SiteInstance : public base::RefCounted<SiteInstance>,
static bool IsSameWebSite(const GURL& url1, const GURL& url2);
protected:
+ friend class base::RefCounted<SiteInstance>;
friend class BrowsingInstance;
+ // Virtual to allow tests to extend it.
+ virtual ~SiteInstance();
+
// Create a new SiteInstance. Protected to give access to BrowsingInstance
// and tests; most callers should use CreateSiteInstance or
// GetRelatedSiteInstance instead.
diff --git a/chrome/browser/renderer_host/sync_resource_handler.h b/chrome/browser/renderer_host/sync_resource_handler.h
index 615d7473..cb2ae22 100644
--- a/chrome/browser/renderer_host/sync_resource_handler.h
+++ b/chrome/browser/renderer_host/sync_resource_handler.h
@@ -18,7 +18,6 @@ class SyncResourceHandler : public ResourceHandler {
SyncResourceHandler(ResourceDispatcherHost::Receiver* receiver,
const GURL& url,
IPC::Message* result_message);
- ~SyncResourceHandler();
bool OnRequestRedirected(int request_id, const GURL& new_url,
ResourceResponse* response, bool* defer);
@@ -32,6 +31,9 @@ class SyncResourceHandler : public ResourceHandler {
private:
enum { kReadBufSize = 3840 };
+
+ ~SyncResourceHandler();
+
scoped_refptr<net::IOBuffer> read_buffer_;
SyncLoadResult result_;
diff --git a/chrome/browser/renderer_host/x509_user_cert_resource_handler.h b/chrome/browser/renderer_host/x509_user_cert_resource_handler.h
index 78dffad..d9988ed 100644
--- a/chrome/browser/renderer_host/x509_user_cert_resource_handler.h
+++ b/chrome/browser/renderer_host/x509_user_cert_resource_handler.h
@@ -41,6 +41,8 @@ class X509UserCertResourceHandler : public ResourceHandler {
private:
+ ~X509UserCertResourceHandler() {}
+
void AssembleResource();
GURL url_;
diff --git a/chrome/browser/safe_browsing/bloom_filter.h b/chrome/browser/safe_browsing/bloom_filter.h
index d005216b..061e933 100644
--- a/chrome/browser/safe_browsing/bloom_filter.h
+++ b/chrome/browser/safe_browsing/bloom_filter.h
@@ -34,8 +34,6 @@ class BloomFilter : public base::RefCountedThreadSafe<BloomFilter> {
// will delete it on destruction.
BloomFilter(char* data, int size, const std::vector<uint64>& keys);
- ~BloomFilter();
-
void Insert(int hash);
bool Exists(int hash) const;
@@ -58,12 +56,15 @@ class BloomFilter : public base::RefCountedThreadSafe<BloomFilter> {
static const int kBloomFilterMaxSize = 2 * 1024 * 1024;
private:
+ friend class base::RefCountedThreadSafe<BloomFilter>;
FRIEND_TEST(SafeBrowsingBloomFilter, BloomFilterUse);
FRIEND_TEST(SafeBrowsingBloomFilter, BloomFilterFile);
static const int kNumHashKeys = 20;
static const int kFileVersion = 1;
+ ~BloomFilter();
+
int byte_size_; // size in bytes
int bit_size_; // size in bits
scoped_array<char> data_;
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
index 9d5a42c..59e6668 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc
@@ -1026,7 +1026,7 @@ bool SafeBrowsingDatabaseBloom::WritePrefixes(
int filter_size =
std::min(number_of_keys * BloomFilter::kBloomFilterSizeRatio,
BloomFilter::kBloomFilterMaxSize * 8);
- BloomFilter* new_filter = new BloomFilter(filter_size);
+ scoped_refptr<BloomFilter> new_filter = new BloomFilter(filter_size);
SBPair* add = adds;
int new_count = 0;
@@ -1044,7 +1044,6 @@ bool SafeBrowsingDatabaseBloom::WritePrefixes(
int rv = insert->step();
if (rv == SQLITE_CORRUPT) {
HandleCorruptDatabase();
- delete new_filter; // TODO(paulg): scoped.
return false;
}
DCHECK(rv == SQLITE_DONE);
@@ -1055,7 +1054,7 @@ bool SafeBrowsingDatabaseBloom::WritePrefixes(
}
*new_add_count = new_count;
- *filter = new_filter;
+ *filter = new_filter.release();
return true;
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h
index cc42d84..213a768 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -65,7 +65,6 @@ class SafeBrowsingService
// Creates the safe browsing service. Need to initialize before using.
SafeBrowsingService();
- ~SafeBrowsingService();
// Initializes the service.
void Initialize();
@@ -166,6 +165,10 @@ class SafeBrowsingService
const GURL& referrer_url);
private:
+ friend class base::RefCountedThreadSafe<SafeBrowsingService>;
+
+ ~SafeBrowsingService();
+
// Should only be called on db thread as SafeBrowsingDatabase is not
// threadsafe.
SafeBrowsingDatabase* GetDatabase();