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

Unified Diff: components/offline_pages/offline_page_metadata_store_impl.cc

Issue 1869243002: Fix the issue that client id is not saved when upgrading the offline metadata store (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch Created 4 years, 8 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_impl.cc
diff --git a/components/offline_pages/offline_page_metadata_store_impl.cc b/components/offline_pages/offline_page_metadata_store_impl.cc
index 95cb9cf534308cca9972a4de69a38640a7098d38..a7b2d38d5b57aeb9f1e528a91f9df1be601db2cb 100644
--- a/components/offline_pages/offline_page_metadata_store_impl.cc
+++ b/components/offline_pages/offline_page_metadata_store_impl.cc
@@ -168,8 +168,7 @@ void OfflinePageMetadataStoreImpl::LoadDone(
// TODO(bburns): Remove this eventually when we are sure everyone is
// upgraded.
if (!entry.has_offline_id()) {
- entry.set_offline_id(OfflinePageModel::GenerateOfflineId());
- item.offline_id = entry.offline_id();
+ item.offline_id = OfflinePageModel::GenerateOfflineId();
if (!entry.has_deprecated_bookmark_id()) {
LOG(ERROR) << "unexpected entry missing bookmark id";
@@ -178,8 +177,11 @@ void OfflinePageMetadataStoreImpl::LoadDone(
item.client_id.name_space = offline_pages::BOOKMARK_NAMESPACE;
item.client_id.id = base::Int64ToString(entry.deprecated_bookmark_id());
+ OfflinePageEntry upgraded_entry;
+ OfflinePageItemToEntry(item, &upgraded_entry);
entries_to_update->push_back(
- std::make_pair(base::Int64ToString(entry.offline_id()), entry));
+ std::make_pair(base::Int64ToString(upgraded_entry.offline_id()),
+ upgraded_entry));
keys_to_remove->push_back(item.client_id.id);
fgorski 2016/04/08 05:09:58 nit: Add a comment that his is removing the old en
}
result.push_back(item);

Powered by Google App Engine
This is Rietveld 408576698