Commit ed895aab authored by Yafei Duan's avatar Yafei Duan Committed by Commit Bot

[Offline Pages] Use existing function to get persistent namespaces.

In StartupMaintenanceTask and PersistentPageConsistencyCheckTask, there
was a step to get persistent/temporary namespaces, which didn't use the
existing function. This CL fixed it.

Bug: NONE
Change-Id: I7b4a1f6255003886917790dff875c20b43cfc032
Reviewed-on: https://chromium-review.googlesource.com/1027111Reviewed-by: default avatarCathy Li <chili@chromium.org>
Commit-Queue: Yafei Duan <romax@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553430}
parent 7a37173e
......@@ -220,12 +220,8 @@ PersistentPageConsistencyCheckTask::~PersistentPageConsistencyCheckTask() =
default;
void PersistentPageConsistencyCheckTask::Run() {
std::vector<std::string> namespaces = policy_controller_->GetAllNamespaces();
std::vector<std::string> persistent_namespaces;
for (const auto& name_space : namespaces) {
if (!policy_controller_->IsRemovedOnCacheReset(name_space))
persistent_namespaces.push_back(name_space);
}
std::vector<std::string> persistent_namespaces =
policy_controller_->GetNamespacesForUserRequestedDownload();
store_->Execute(base::BindOnce(&PersistentPageConsistencyCheckSync, store_,
archive_manager_->GetPrivateArchivesDir(),
......
......@@ -250,15 +250,10 @@ bool StartupMaintenanceSync(OfflinePageMetadataStoreSQL* store,
if (!db)
return false;
std::vector<std::string> namespaces = policy_controller->GetAllNamespaces();
std::vector<std::string> temporary_namespaces;
std::vector<std::string> persistent_namespaces;
for (const auto& name_space : namespaces) {
if (!policy_controller->IsRemovedOnCacheReset(name_space))
persistent_namespaces.push_back(name_space);
else
temporary_namespaces.push_back(name_space);
}
std::vector<std::string> temporary_namespaces =
policy_controller->GetNamespacesRemovedOnCacheReset();
std::vector<std::string> persistent_namespaces =
policy_controller->GetNamespacesForUserRequestedDownload();
// Clear temporary pages that are in legacy directory, which is also the
// directory that serves as the 'private' directory.
......@@ -273,6 +268,7 @@ bool StartupMaintenanceSync(OfflinePageMetadataStoreSQL* store,
result, SyncOperationResult::RESULT_COUNT);
// Report storage usage UMA.
std::vector<std::string> namespaces = policy_controller->GetAllNamespaces();
ReportStorageUsageSync(db, namespaces, archive_manager);
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment