| Index: chrome/browser/history/expire_history_backend.h
|
| diff --git a/chrome/browser/history/expire_history_backend.h b/chrome/browser/history/expire_history_backend.h
|
| index 471dd7bd86450bb45dfe55d89c7c94f33fc9c324..e54ff5b9a78a5022b886bedcc87ebb1e599f0ed4 100644
|
| --- a/chrome/browser/history/expire_history_backend.h
|
| +++ b/chrome/browser/history/expire_history_backend.h
|
| @@ -22,7 +22,6 @@ class TestingProfile;
|
|
|
| namespace history {
|
|
|
| -class ArchivedDatabase;
|
| class HistoryDatabase;
|
| struct HistoryDetails;
|
| class ThumbnailDatabase;
|
| @@ -37,7 +36,7 @@ class BroadcastNotificationDelegate {
|
|
|
| // Trigger handling of deleted urls in typed url sync code
|
| virtual void NotifySyncURLsDeleted(bool all_history,
|
| - bool archived,
|
| + bool expired,
|
| URLRows* rows) = 0;
|
|
|
| protected:
|
| @@ -57,10 +56,9 @@ class ExpiringVisitsReader {
|
| typedef std::vector<const ExpiringVisitsReader*> ExpiringVisitsReaders;
|
|
|
| // Helper component to HistoryBackend that manages expiration and deleting of
|
| -// history, as well as moving data from the main database to the archived
|
| -// database as it gets old.
|
| +// history.
|
| //
|
| -// It will automatically start periodically archiving old history once you call
|
| +// It will automatically start periodically expiring old history once you call
|
| // StartArchivingOldStuff().
|
| class ExpireHistoryBackend {
|
| public:
|
| @@ -74,12 +72,11 @@ class ExpireHistoryBackend {
|
|
|
| // Completes initialization by setting the databases that this class will use.
|
| void SetDatabases(HistoryDatabase* main_db,
|
| - ArchivedDatabase* archived_db,
|
| ThumbnailDatabase* thumb_db);
|
|
|
| // Begins periodic expiration of history older than the given threshold. This
|
| // will continue until the object is deleted.
|
| - void StartArchivingOldStuff(base::TimeDelta expiration_threshold);
|
| + void StartExpiringOldStuff(base::TimeDelta expiration_threshold);
|
|
|
| // Deletes everything associated with a URL.
|
| void DeleteURL(const GURL& url);
|
| @@ -101,24 +98,22 @@ class ExpireHistoryBackend {
|
| // ExpireHistoryBetween(), but affecting a specific set of visits).
|
| void ExpireVisits(const VisitVector& visits);
|
|
|
| - // Archives all visits before and including the given time, updating the URLs
|
| - // accordingly. This function is intended for migrating old databases
|
| - // (which encompased all time) to the tiered structure and testing, and
|
| - // probably isn't useful for anything else.
|
| - void ArchiveHistoryBefore(base::Time end_time);
|
| + // Expires all visits before and including the given time, updating the URLs
|
| + // accordingly. Currently only used for testing.
|
| + void ExpireHistoryBefore(base::Time end_time);
|
|
|
| - // Returns the current time that we are archiving stuff to. This will return
|
| - // the threshold in absolute time rather than a delta, so the caller should
|
| - // not save it.
|
| - base::Time GetCurrentArchiveTime() const {
|
| + // Returns the current cut-off time before which we will start expiring stuff.
|
| + // Note that this as an absolute, moving timestamp rather than a delta, so the
|
| + // caller should not save it.
|
| + base::Time GetCurrentExpirationTime() const {
|
| return base::Time::Now() - expiration_threshold_;
|
| }
|
|
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, DeleteFaviconsIfPossible);
|
| - FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ArchiveSomeOldHistory);
|
| + FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ExpireSomeOldHistory);
|
| FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ExpiringVisitsReader);
|
| - FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ArchiveSomeOldHistoryWithSource);
|
| + FRIEND_TEST_ALL_PREFIXES(ExpireHistoryTest, ExpireSomeOldHistoryWithSource);
|
| friend class ::TestingProfile;
|
|
|
| struct DeleteDependencies;
|
| @@ -129,9 +124,6 @@ class ExpireHistoryBackend {
|
| void DeleteVisitRelatedInfo(const VisitVector& visits,
|
| DeleteDependencies* dependencies);
|
|
|
| - // Moves the given visits from the main database to the archived one.
|
| - void ArchiveVisits(const VisitVector& visits);
|
| -
|
| // Finds or deletes dependency information for the given URL. Information that
|
| // is specific to this URL (URL row, thumbnails, etc.) is deleted.
|
| //
|
| @@ -153,13 +145,6 @@ class ExpireHistoryBackend {
|
| bool is_bookmarked,
|
| DeleteDependencies* dependencies);
|
|
|
| - // Adds or merges the given URL row with the archived database, returning the
|
| - // ID of the URL in the archived database, or 0 on failure. The main (source)
|
| - // database will not be affected (the URL will have to be deleted later).
|
| - //
|
| - // Assumes the archived database is not NULL.
|
| - URLID ArchiveOneURL(const URLRow& url_row);
|
| -
|
| // Deletes all the URLs in the given vector and handles their dependencies.
|
| // This will delete starred URLs
|
| void DeleteURLs(const URLRows& urls,
|
| @@ -170,10 +155,10 @@ class ExpireHistoryBackend {
|
| // field of the dependencies and DeleteOneURL will handle deleting out from
|
| // there. This function does not handle favicons.
|
| //
|
| - // When a URL is not deleted and |archive| is not set, the last visit time and
|
| - // the visit and typed counts will be updated (we want to clear these when a
|
| - // user is deleting history manually, but not when we're normally expiring old
|
| - // things from history).
|
| + // When a URL is not deleted, the last visit time and the visit and typed
|
| + // counts will be updated (we want to clear these when a user is deleting
|
| + // history manually, but not when we're normally expiring old things from
|
| + // history).
|
| //
|
| // The visits in the given vector should have already been deleted from the
|
| // database, and the list of affected URLs already be filled into
|
| @@ -185,15 +170,6 @@ class ExpireHistoryBackend {
|
| void ExpireURLsForVisits(const VisitVector& visits,
|
| DeleteDependencies* dependencies);
|
|
|
| - // Creates entries in the archived database for the unique URLs referenced
|
| - // by the given visits. It will then add versions of the visits to that
|
| - // database. The source database WILL NOT BE MODIFIED. The source URLs and
|
| - // visits will have to be deleted in another pass.
|
| - //
|
| - // The affected URLs will be filled into the given dependencies structure.
|
| - void ArchiveURLsAndVisits(const VisitVector& visits,
|
| - DeleteDependencies* dependencies);
|
| -
|
| // Deletes the favicons listed in the set if unused. Fails silently (we don't
|
| // care about favicons so much, so don't want to stop everything if it fails).
|
| // Fills |expired_favicons| with the set of favicon urls that no longer
|
| @@ -205,28 +181,28 @@ class ExpireHistoryBackend {
|
| enum DeletionType {
|
| // User initiated the deletion from the History UI.
|
| DELETION_USER_INITIATED,
|
| - // History data was automatically archived due to being more than 90 days
|
| + // History data was automatically expired due to being more than 90 days
|
| // old.
|
| - DELETION_ARCHIVED
|
| + DELETION_EXPIRED
|
| };
|
|
|
| // Broadcast the URL deleted notification.
|
| void BroadcastDeleteNotifications(DeleteDependencies* dependencies,
|
| DeletionType type);
|
|
|
| - // Schedules a call to DoArchiveIteration.
|
| - void ScheduleArchive();
|
| + // Schedules a call to DoExpireIteration.
|
| + void ScheduleExpire();
|
|
|
| - // Calls ArchiveSomeOldHistory to expire some amount of old history, according
|
| + // Calls ExpireSomeOldHistory to expire some amount of old history, according
|
| // to the items in work queue, and schedules another call to happen in the
|
| // future.
|
| - void DoArchiveIteration();
|
| + void DoExpireIteration();
|
|
|
| // Tries to expire the oldest |max_visits| visits from history that are older
|
| // than |time_threshold|. The return value indicates if we think there might
|
| // be more history to expire with the current time threshold (it does not
|
| // indicate success or failure).
|
| - bool ArchiveSomeOldHistory(base::Time end_time,
|
| + bool ExpireSomeOldHistory(base::Time end_time,
|
| const ExpiringVisitsReader* reader,
|
| int max_visits);
|
|
|
| @@ -255,22 +231,20 @@ class ExpireHistoryBackend {
|
|
|
| // Non-owning pointers to the databases we deal with (MAY BE NULL).
|
| HistoryDatabase* main_db_; // Main history database.
|
| - ArchivedDatabase* archived_db_; // Old history.
|
| ThumbnailDatabase* thumb_db_; // Thumbnails and favicons.
|
|
|
| // Used to generate runnable methods to do timers on this class. They will be
|
| // automatically canceled when this class is deleted.
|
| base::WeakPtrFactory<ExpireHistoryBackend> weak_factory_;
|
|
|
| - // The threshold for "old" history where we will automatically expire it to
|
| - // the archived database.
|
| + // The threshold for "old" history where we will automatically delete it.
|
| base::TimeDelta expiration_threshold_;
|
|
|
| // List of all distinct types of readers. This list is used to populate the
|
| // work queue.
|
| ExpiringVisitsReaders readers_;
|
|
|
| - // Work queue for periodic expiration tasks, used by DoArchiveIteration() to
|
| + // Work queue for periodic expiration tasks, used by DoExpireIteration() to
|
| // determine what to do at an iteration, as well as populate it for future
|
| // iterations.
|
| std::queue<const ExpiringVisitsReader*> work_queue_;
|
|
|