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

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

Issue 352913002: Port HistoryService::ScheduleDBTask to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/url_index_private_data.cc
diff --git a/chrome/browser/history/url_index_private_data.cc b/chrome/browser/history/url_index_private_data.cc
index 33b702633f7bf14da5d8bb02d9ba267878bfe54a..413ea5e34df7232dbb3c52a159541cd4b001731f 100644
--- a/chrome/browser/history/url_index_private_data.cc
+++ b/chrome/browser/history/url_index_private_data.cc
@@ -280,7 +280,8 @@ bool URLIndexPrivateData::UpdateURL(
HistoryService* history_service,
const URLRow& row,
const std::string& languages,
- const std::set<std::string>& scheme_whitelist) {
+ const std::set<std::string>& scheme_whitelist,
+ base::CancelableTaskTracker* tracker) {
// The row may or may not already be in our index. If it is not already
// indexed and it qualifies then it gets indexed. If it is already
// indexed and still qualifies then it gets updated, otherwise it
@@ -293,7 +294,7 @@ bool URLIndexPrivateData::UpdateURL(
URLRow new_row(row);
new_row.set_id(row_id);
row_was_updated = RowQualifiesAsSignificant(new_row, base::Time()) &&
- IndexRow(NULL, history_service, new_row, languages, scheme_whitelist);
+ IndexRow(NULL, history_service, new_row, languages, scheme_whitelist, tracker);
blundell 2014/06/26 09:55:39 nit: 80 chars?
sdefresne 2014/06/28 08:14:26 Done.
} else if (RowQualifiesAsSignificant(row, base::Time())) {
// This indexed row still qualifies and will be re-indexed.
// The url won't have changed but the title, visit count, etc.
@@ -308,7 +309,7 @@ bool URLIndexPrivateData::UpdateURL(
row_to_update.set_last_visit(row.last_visit());
// If something appears to have changed, update the recent visits
// information.
- ScheduleUpdateRecentVisits(history_service, row_id);
+ ScheduleUpdateRecentVisits(history_service, row_id, tracker);
// While the URL is guaranteed to remain stable, the title may have
// changed. If so, then update the index with the changed words.
if (title_updated) {
@@ -357,10 +358,10 @@ void URLIndexPrivateData::UpdateRecentVisits(
void URLIndexPrivateData::ScheduleUpdateRecentVisits(
HistoryService* history_service,
- URLID url_id) {
+ URLID url_id,
+ base::CancelableTaskTracker* tracker) {
history_service->ScheduleDBTask(
- new UpdateRecentVisitsFromHistoryDBTask(this, url_id),
- &recent_visits_consumer_);
+ new UpdateRecentVisitsFromHistoryDBTask(this, url_id), tracker);
}
// Helper functor for DeleteURL.
@@ -445,7 +446,7 @@ scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RebuildFromHistory(
rebuilt_data->last_time_rebuilt_from_history_ = base::Time::Now();
for (URLRow row; history_enum.GetNextURL(&row); ) {
rebuilt_data->IndexRow(history_db, NULL, row, languages,
- scheme_whitelist);
+ scheme_whitelist, NULL);
}
UMA_HISTOGRAM_TIMES("History.InMemoryURLIndexingTime",
@@ -468,10 +469,6 @@ bool URLIndexPrivateData::WritePrivateDataToCacheFileTask(
return private_data->SaveToFile(file_path);
}
-void URLIndexPrivateData::CancelPendingUpdates() {
- recent_visits_consumer_.CancelAllRequests();
-}
-
scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::Duplicate() const {
scoped_refptr<URLIndexPrivateData> data_copy = new URLIndexPrivateData;
data_copy->last_time_rebuilt_from_history_ = last_time_rebuilt_from_history_;
@@ -685,7 +682,8 @@ bool URLIndexPrivateData::IndexRow(
HistoryService* history_service,
const URLRow& row,
const std::string& languages,
- const std::set<std::string>& scheme_whitelist) {
+ const std::set<std::string>& scheme_whitelist,
+ base::CancelableTaskTracker* tracker) {
const GURL& gurl(row.url());
// Index only URLs with a whitelisted scheme.
@@ -730,8 +728,9 @@ bool URLIndexPrivateData::IndexRow(
&recent_visits))
UpdateRecentVisits(row_id, recent_visits);
} else {
+ DCHECK(tracker);
DCHECK(history_service);
- ScheduleUpdateRecentVisits(history_service, row_id);
+ ScheduleUpdateRecentVisits(history_service, row_id, tracker);
}
return true;

Powered by Google App Engine
This is Rietveld 408576698