Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2739)

Unified Diff: chrome/browser/history/expire_history_backend.cc

Issue 16951015: Remove TextDatabase from the history service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replace_fts
Patch Set: Sync and rebase. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/expire_history_backend.cc
diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc
index 5c338972979e3c9773b36cfa439c089d65564ec9..370a62b4f834e301f7670131a4a794f7b2e90b82 100644
--- a/chrome/browser/history/expire_history_backend.cc
+++ b/chrome/browser/history/expire_history_backend.cc
@@ -19,8 +19,6 @@
#include "chrome/browser/history/archived_database.h"
#include "chrome/browser/history/history_database.h"
#include "chrome/browser/history/history_notifications.h"
-#include "chrome/browser/history/text_database.h"
-#include "chrome/browser/history/text_database_manager.h"
#include "chrome/browser/history/thumbnail_database.h"
using base::Time;
@@ -172,10 +170,6 @@ struct ExpireHistoryBackend::DeleteDependencies {
// The list of all favicon urls that were actually deleted from the thumbnail
// db.
std::set<GURL> expired_favicons;
-
- // Tracks the set of databases that have changed so we can optimize when
- // when we're done.
- TextDatabaseManager::ChangeSet text_db_changes;
};
ExpireHistoryBackend::ExpireHistoryBackend(
@@ -185,7 +179,6 @@ ExpireHistoryBackend::ExpireHistoryBackend(
main_db_(NULL),
archived_db_(NULL),
thumb_db_(NULL),
- text_db_(NULL),
weak_factory_(this),
bookmark_service_(bookmark_service) {
}
@@ -195,12 +188,10 @@ ExpireHistoryBackend::~ExpireHistoryBackend() {
void ExpireHistoryBackend::SetDatabases(HistoryDatabase* main_db,
ArchivedDatabase* archived_db,
- ThumbnailDatabase* thumb_db,
- TextDatabaseManager* text_db) {
+ ThumbnailDatabase* thumb_db) {
main_db_ = main_db;
archived_db_ = archived_db;
thumb_db_ = thumb_db;
- text_db_ = text_db;
}
void ExpireHistoryBackend::DeleteURL(const GURL& url) {
@@ -242,9 +233,6 @@ void ExpireHistoryBackend::DeleteURLs(const std::vector<GURL>& urls) {
DeleteFaviconsIfPossible(dependencies.affected_favicons,
&dependencies.expired_favicons);
- if (text_db_)
- text_db_->OptimizeChangedDatabases(dependencies.text_db_changes);
-
BroadcastDeleteNotifications(&dependencies, DELETION_USER_INITIATED);
}
@@ -253,10 +241,6 @@ void ExpireHistoryBackend::ExpireHistoryBetween(
if (!main_db_)
return;
- // There may be stuff in the text database manager's temporary cache.
- if (text_db_)
- text_db_->DeleteFromUncommitted(restrict_urls, begin_time, end_time);
-
// Find the affected visits and delete them.
// TODO(brettw): bug 1171164: We should query the archived database here, too.
VisitVector visits;
@@ -290,10 +274,6 @@ void ExpireHistoryBackend::ExpireHistoryForTimes(
if (!main_db_)
return;
- // There may be stuff in the text database manager's temporary cache.
- if (text_db_)
- text_db_->DeleteFromUncommittedForTimes(times);
-
// Find the affected visits and delete them.
// TODO(brettw): bug 1171164: We should query the archived database here, too.
VisitVector visits;
@@ -368,7 +348,6 @@ void ExpireHistoryBackend::StartArchivingOldStuff(
// Initialize the queue with all tasks for the first set of iterations.
InitWorkQueue();
ScheduleArchive();
- ScheduleExpireHistoryIndexFiles();
}
void ExpireHistoryBackend::DeleteFaviconsIfPossible(
@@ -422,21 +401,11 @@ void ExpireHistoryBackend::DeleteVisitRelatedInfo(
// Add the URL row to the affected URL list.
std::map<URLID, URLRow>::const_iterator found =
dependencies->affected_urls.find(visits[i].url_id);
- const URLRow* cur_row = NULL;
if (found == dependencies->affected_urls.end()) {
URLRow row;
if (!main_db_->GetURLRow(visits[i].url_id, &row))
continue;
dependencies->affected_urls[visits[i].url_id] = row;
- cur_row = &dependencies->affected_urls[visits[i].url_id];
- } else {
- cur_row = &found->second;
- }
-
- // Delete any associated full-text indexed data.
- if (visits[i].is_indexed && text_db_) {
- text_db_->DeletePageData(visits[i].visit_time, cur_row->url(),
- &dependencies->text_db_changes);
}
}
}
@@ -447,13 +416,6 @@ void ExpireHistoryBackend::DeleteOneURL(
DeleteDependencies* dependencies) {
main_db_->DeleteSegmentForURL(url_row.id());
- // The URL may be in the text database manager's temporary cache.
- if (text_db_) {
- std::set<GURL> restrict_urls;
- restrict_urls.insert(url_row.url());
- text_db_->DeleteFromUncommitted(restrict_urls, base::Time(), base::Time());
- }
-
if (!is_bookmarked) {
dependencies->deleted_urls.push_back(url_row);
@@ -722,48 +684,6 @@ void ExpireHistoryBackend::ParanoidExpireHistory() {
// TODO(brettw): Bug 1067331: write this to clean up any errors.
}
-void ExpireHistoryBackend::ScheduleExpireHistoryIndexFiles() {
- if (!text_db_) {
- // Can't expire old history index files because we
- // don't know where they're located.
- return;
- }
-
- TimeDelta delay = TimeDelta::FromMinutes(kIndexExpirationDelayMin);
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&ExpireHistoryBackend::DoExpireHistoryIndexFiles,
- weak_factory_.GetWeakPtr()),
- delay);
-}
-
-void ExpireHistoryBackend::DoExpireHistoryIndexFiles() {
- if (!text_db_) {
- // The text database may have been closed since the task was scheduled.
- return;
- }
-
- Time::Exploded exploded;
- Time::Now().LocalExplode(&exploded);
- int cutoff_month =
- exploded.year * 12 + exploded.month - kStoreHistoryIndexesForMonths;
- TextDatabase::DBIdent cutoff_id =
- (cutoff_month / 12) * 100 + (cutoff_month % 12);
-
- base::FilePath::StringType history_index_files_pattern =
- TextDatabase::file_base();
- history_index_files_pattern.append(FILE_PATH_LITERAL("*"));
- base::FileEnumerator file_enumerator(
- text_db_->GetDir(), false, base::FileEnumerator::FILES,
- history_index_files_pattern);
- for (base::FilePath file = file_enumerator.Next(); !file.empty();
- file = file_enumerator.Next()) {
- TextDatabase::DBIdent file_id = TextDatabase::FileNameToID(file);
- if (file_id < cutoff_id)
- sql::Connection::Delete(file);
- }
-}
-
BookmarkService* ExpireHistoryBackend::GetBookmarkService() {
// We use the bookmark service to determine if a URL is bookmarked. The
// bookmark service is loaded on a separate thread and may not be done by the
« no previous file with comments | « chrome/browser/history/expire_history_backend.h ('k') | chrome/browser/history/expire_history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698