Chromium Code Reviews| 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 8a7686f2c0c30266c6665cd71acd77da9104c655..488fbea6e79ad73876a2fe1ebec38a12a0091c3f 100644 |
| --- a/components/offline_pages/offline_page_metadata_store_sql.cc |
| +++ b/components/offline_pages/offline_page_metadata_store_sql.cc |
| @@ -42,7 +42,8 @@ const char kOfflinePagesColumns[] = |
| " client_id VARCHAR NOT NULL," |
| " online_url VARCHAR NOT NULL," |
| " offline_url VARCHAR NOT NULL DEFAULT ''," |
| - " file_path VARCHAR NOT NULL" |
| + " file_path VARCHAR NOT NULL," |
| + " expiration_time INTEGER NOT NULL" |
|
bburns
2016/05/20 18:24:53
One of the SQL feedbacks was to pack the integers
fgorski
2016/05/20 20:54:54
Done.
|
| ")"; |
| // This is cloned from //content/browser/appcache/appcache_database.cc |
| @@ -69,7 +70,8 @@ enum : int { |
| OP_CLIENT_ID, |
| OP_ONLINE_URL, |
| OP_OFFLINE_URL, |
| - OP_FILE_PATH |
| + OP_FILE_PATH, |
| + OP_EXPIRATION_TIME, |
| }; |
| 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(); |
| } |