From 7991a2336f3e5b975d5f31ffa24f129eb8bf32ad Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Fri, 6 Nov 2009 01:55:48 +0000 Subject: Seventh patch in making destructors of refcounted objects private. BUG=26749 Review URL: http://codereview.chromium.org/371006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31192 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/history/history.h | 11 ++++++++--- chrome/browser/history/history_backend.cc | 4 ++++ chrome/browser/history/history_backend.h | 5 +++-- chrome/browser/history/history_marshaling.h | 4 ++++ chrome/browser/history/history_unittest.cc | 3 ++- 5 files changed, 21 insertions(+), 6 deletions(-) (limited to 'chrome/browser/history') diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h index 6a886b9..1afe44d 100644 --- a/chrome/browser/history/history.h +++ b/chrome/browser/history/history.h @@ -59,8 +59,6 @@ class URLDatabase; // on the main thread. class HistoryDBTask : public base::RefCountedThreadSafe { public: - virtual ~HistoryDBTask() {} - // Invoked on the database thread. The return value indicates whether the // task is done. A return value of true signals the task is done and // RunOnDBThread should NOT be invoked again. A return value of false @@ -73,6 +71,11 @@ class HistoryDBTask : public base::RefCountedThreadSafe { // only invoked if the request was not canceled and returned true from // RunOnDBThread. virtual void DoneRunOnMainThread() = 0; + + protected: + friend class base::RefCountedThreadSafe; + + virtual ~HistoryDBTask() {} }; // The history service records page titles, and visit times, as well as @@ -95,7 +98,6 @@ class HistoryService : public CancelableRequestProvider, explicit HistoryService(Profile* profile); // The empty constructor is provided only for testing. HistoryService(); - ~HistoryService(); // Initializes the history service, returning true on success. On false, do // not call any other functions. The given directory will be used for storing @@ -521,6 +523,7 @@ class HistoryService : public CancelableRequestProvider, private: class BackendDelegate; + friend class base::RefCountedThreadSafe; friend class BackendDelegate; friend class FaviconService; friend class history::HistoryBackend; @@ -534,6 +537,8 @@ class HistoryService : public CancelableRequestProvider, friend class FavIconRequest; friend class TestingProfile; + ~HistoryService(); + // These are not currently used, hopefully we can do something in the future // to ensure that the most important things happen first. enum SchedulePriority { diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 7b45b22..1a3bd09 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -117,6 +117,10 @@ class CommitLaterTask : public base::RefCounted { } private: + friend class base::RefCounted; + + ~CommitLaterTask() {} + scoped_refptr history_backend_; }; diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index 0d854e2..49569f5 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h @@ -94,8 +94,6 @@ class HistoryBackend : public base::RefCountedThreadSafe, Delegate* delegate, BookmarkService* bookmark_service); - ~HistoryBackend(); - // Must be called after creation but before any objects are created. If this // fails, all other functions will fail as well. (Since this runs on another // thread, we don't bother returning failure.) @@ -274,6 +272,7 @@ class HistoryBackend : public base::RefCountedThreadSafe, #endif private: + friend class base::RefCountedThreadSafe; friend class CommitLaterTask; // The commit task needs to call Commit(). friend class HistoryTest; // So the unit tests can poke our innards. FRIEND_TEST(HistoryBackendTest, DeleteAll); @@ -281,6 +280,8 @@ class HistoryBackend : public base::RefCountedThreadSafe, FRIEND_TEST(HistoryBackendTest, URLsNoLongerBookmarked); friend class ::TestingProfile; + ~HistoryBackend(); + // Computes the name of the specified database on disk. FilePath GetThumbnailFileName() const; FilePath GetArchivedFileName() const; diff --git a/chrome/browser/history/history_marshaling.h b/chrome/browser/history/history_marshaling.h index 947f966..d6decb3 100644 --- a/chrome/browser/history/history_marshaling.h +++ b/chrome/browser/history/history_marshaling.h @@ -52,6 +52,10 @@ class HistoryAddPageArgs bool did_replace_entry; private: + friend class base::RefCountedThreadSafe; + + ~HistoryAddPageArgs() {} + DISALLOW_EVIL_CONSTRUCTORS(HistoryAddPageArgs); }; diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc index aa9d00f..47cd4e8 100644 --- a/chrome/browser/history/history_unittest.cc +++ b/chrome/browser/history/history_unittest.cc @@ -785,7 +785,6 @@ class HistoryDBTaskImpl : public HistoryDBTask { static const int kWantInvokeCount; HistoryDBTaskImpl() : invoke_count(0), done_invoked(false) {} - virtual ~HistoryDBTaskImpl() {} virtual bool RunOnDBThread(HistoryBackend* backend, HistoryDatabase* db) { return (++invoke_count == kWantInvokeCount); @@ -800,6 +799,8 @@ class HistoryDBTaskImpl : public HistoryDBTask { bool done_invoked; private: + virtual ~HistoryDBTaskImpl() {} + DISALLOW_EVIL_CONSTRUCTORS(HistoryDBTaskImpl); }; -- cgit v1.1