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: components/offline_pages/offline_page_storage_manager.cc

Issue 2111653002: [Offline Pages] Adding metadatas for namespace async_loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing tests. Created 4 years, 5 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_storage_manager.cc
diff --git a/components/offline_pages/offline_page_storage_manager.cc b/components/offline_pages/offline_page_storage_manager.cc
index 4a23269e2619d129db5726440a1cac1e82041903..cc3fd4cd5b7057656144556701aa16e924a98baf 100644
--- a/components/offline_pages/offline_page_storage_manager.cc
+++ b/components/offline_pages/offline_page_storage_manager.cc
@@ -14,6 +14,8 @@
#include "components/offline_pages/offline_page_item.h"
#include "components/offline_pages/offline_page_model.h"
+using LifetimeType = offline_pages::LifetimePolicy::LifetimeType;
+
namespace offline_pages {
OfflinePageStorageManager::OfflinePageStorageManager(
@@ -108,6 +110,7 @@ void OfflinePageStorageManager::GetPageIdsToClear(
const ArchiveManager::StorageStats& stats,
std::vector<int64_t>* page_ids_to_expire,
std::vector<int64_t>* page_ids_to_remove) {
+ // TODO(romax): See how persistent should be considered here.
// Creating a map from namespace to a vector of page items.
// Sort each vector based on last accessed time and all pages after index
// min{size(), page_limit} should be expired. And then start iterating
@@ -200,7 +203,8 @@ bool OfflinePageStorageManager::ShouldBeExpired(
const OfflinePageItem& page) const {
const LifetimePolicy& policy =
policy_controller_->GetPolicy(page.client_id.name_space).lifetime_policy;
- return clear_time_ - page.last_access_time >= policy.expiration_period;
+ return policy.lifetime_type == LifetimeType::TEMPORARY &&
+ clear_time_ - page.last_access_time >= policy.expiration_period;
}
bool OfflinePageStorageManager::IsInProgress() const {
« no previous file with comments | « components/offline_pages/offline_page_model_impl.cc ('k') | components/offline_pages/offline_page_storage_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698