diff options
Diffstat (limited to 'chromium/content/browser/appcache/appcache_database.cc')
-rw-r--r-- | chromium/content/browser/appcache/appcache_database.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/chromium/content/browser/appcache/appcache_database.cc b/chromium/content/browser/appcache/appcache_database.cc index 8ffa4bc305c..b97aa41c977 100644 --- a/chromium/content/browser/appcache/appcache_database.cc +++ b/chromium/content/browser/appcache/appcache_database.cc @@ -20,6 +20,7 @@ #include "sql/statement.h" #include "sql/transaction.h" #include "storage/browser/quota/padding_key.h" +#include "third_party/blink/public/common/features.h" namespace content { @@ -503,25 +504,22 @@ bool AppCacheDatabase::CommitLazyLastAccessTimes() { return transaction.Commit(); } -bool AppCacheDatabase::UpdateEvictionTimesAndTokenExpires( +bool AppCacheDatabase::UpdateEvictionTimes( int64_t group_id, base::Time last_full_update_check_time, - base::Time first_evictable_error_time, - base::Time token_expires) { + base::Time first_evictable_error_time) { if (!LazyOpen(kCreateIfNeeded)) return false; static const char kSql[] = "UPDATE Groups" " SET last_full_update_check_time = ?," - " first_evictable_error_time = ?," - " token_expires = ?" + " first_evictable_error_time = ?" " WHERE group_id = ?"; sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql)); statement.BindInt64(0, last_full_update_check_time.ToInternalValue()); statement.BindInt64(1, first_evictable_error_time.ToInternalValue()); - statement.BindInt64(2, token_expires.ToInternalValue()); - statement.BindInt64(3, group_id); + statement.BindInt64(2, group_id); return statement.Run(); // Will succeed even if group_id is invalid. } @@ -573,9 +571,11 @@ bool AppCacheDatabase::FindCachesForOrigin(const url::Origin& origin, if (!FindGroupsForOrigin(origin, &group_records)) return false; - CacheRecord cache_record; for (const auto& record : group_records) { - if (FindCacheForGroup(record.group_id, &cache_record)) + CacheRecord cache_record; + if (!FindCacheForGroup(record.group_id, &cache_record)) + continue; + if (HasValidOriginTrialToken(&cache_record)) records->push_back(cache_record); } return true; @@ -952,6 +952,12 @@ bool AppCacheDatabase::DeleteDeletableResponseIds( return RunCachedStatementWithIds(SQL_FROM_HERE, kSql, response_ids); } +bool AppCacheDatabase::HasValidOriginTrialToken(CacheRecord* cache_record) { + if (!is_origin_trial_required_) + return true; + return cache_record->token_expires > base::Time::Now(); +} + bool AppCacheDatabase::RunCachedStatementWithIds( sql::StatementID statement_id, const char* sql, |