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

Unified Diff: components/offline_pages/offline_page_metadata_store_sql.cc

Issue 1993953002: [Offline pages] Adding expiration capability to OfflinePageModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing Created 4 years, 7 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: components/offline_pages/offline_page_metadata_store_sql.cc
diff --git a/components/offline_pages/offline_page_metadata_store_sql.cc b/components/offline_pages/offline_page_metadata_store_sql.cc
index 095d923b26c2046d29d055e32fd25c9df8032f9e..93afcb30ad5c8c13231e1147ff692f840bbfbba1 100644
--- a/components/offline_pages/offline_page_metadata_store_sql.cc
+++ b/components/offline_pages/offline_page_metadata_store_sql.cc
@@ -38,6 +38,7 @@ const char kOfflinePagesColumns[] =
// later use. We will treat NULL as "Unknown" in any subsequent queries
// for user_initiated values.
" user_initiated INTEGER," // this is actually a boolean
+ " expiration_time INTEGER NOT NULL,"
" client_namespace VARCHAR NOT NULL,"
" client_id VARCHAR NOT NULL,"
" online_url VARCHAR NOT NULL,"
@@ -65,11 +66,12 @@ enum : int {
OP_ACCESS_COUNT,
OP_STATUS,
OP_USER_INITIATED,
+ OP_EXPIRATION_TIME,
OP_CLIENT_NAMESPACE,
OP_CLIENT_ID,
OP_ONLINE_URL,
OP_OFFLINE_URL,
- OP_FILE_PATH
+ OP_FILE_PATH,
};
bool CreateTable(sql::Connection* db, const TableInfo& table_info) {
@@ -126,6 +128,8 @@ OfflinePageItem MakeOfflinePageItem(sql::Statement* statement) {
statement->ColumnInt64(OP_LAST_ACCESS_TIME));
item.version = statement->ColumnInt(OP_VERSION);
item.access_count = statement->ColumnInt(OP_ACCESS_COUNT);
+ item.expiration_time =
+ base::Time::FromInternalValue(statement->ColumnInt64(OP_EXPIRATION_TIME));
return item;
}
@@ -133,9 +137,10 @@ bool InsertOrReplace(sql::Connection* db, const OfflinePageItem& item) {
const char kSql[] =
"INSERT OR REPLACE INTO " OFFLINE_PAGES_TABLE_NAME
" (offline_id, online_url, client_namespace, client_id, file_path, "
- "file_size, creation_time, last_access_time, version, access_count)"
+ "file_size, creation_time, last_access_time, version, access_count, "
+ "expiration_time)"
" VALUES "
- " (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
sql::Statement statement(db->GetCachedStatement(SQL_FROM_HERE, kSql));
statement.BindInt64(0, item.offline_id);
@@ -155,6 +160,7 @@ bool InsertOrReplace(sql::Connection* db, const OfflinePageItem& item) {
statement.BindInt64(7, item.last_access_time.ToInternalValue());
statement.BindInt(8, item.version);
statement.BindInt(9, item.access_count);
+ statement.BindInt64(10, item.expiration_time.ToInternalValue());
return statement.Run();
}
« no previous file with comments | « components/offline_pages/offline_page_metadata_store_impl_unittest.cc ('k') | components/offline_pages/offline_page_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698