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

Unified Diff: components/precache/core/precache_url_table.cc

Issue 2300703004: Fix precache issue with cancel and resume (Closed)
Patch Set: Addressed sclittle comments Created 4 years, 3 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
« no previous file with comments | « components/precache/core/precache_fetcher_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/precache/core/precache_url_table.cc
diff --git a/components/precache/core/precache_url_table.cc b/components/precache/core/precache_url_table.cc
index bdee5136bfc72c35459ed4f195f7d4b4dcb84aae..46a815be6eb54adf7b55c35ccd5514efd39bc1be 100644
--- a/components/precache/core/precache_url_table.cc
+++ b/components/precache/core/precache_url_table.cc
@@ -108,12 +108,20 @@ void PrecacheURLTable::GetURLListForReferrerHost(
}
void PrecacheURLTable::ClearAllForReferrerHost(int64_t referrer_host_id) {
- Statement statement(db_->GetCachedStatement(
+ // Delete the URLs that are not precached.
+ Statement delete_statement(
+ db_->GetCachedStatement(SQL_FROM_HERE,
+ "DELETE FROM precache_urls WHERE "
+ "referrer_host_id=? AND is_precached=0"));
+ delete_statement.BindInt64(0, referrer_host_id);
+ delete_statement.Run();
+
+ // Clear was_used for precached URLs.
+ Statement update_statement(db_->GetCachedStatement(
SQL_FROM_HERE,
"UPDATE precache_urls SET was_used=0 WHERE referrer_host_id=?"));
-
- statement.BindInt64(0, referrer_host_id);
- statement.Run();
+ update_statement.BindInt64(0, referrer_host_id);
+ update_statement.Run();
}
void PrecacheURLTable::DeleteAllPrecachedBefore(const base::Time& delete_end) {
« no previous file with comments | « components/precache/core/precache_fetcher_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698