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

Unified Diff: components/reading_list/ios/reading_list_store.cc

Issue 2592043002: Add title update merge logic to reading list entry (Closed)
Patch Set: Update function comment Created 4 years 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/reading_list/ios/reading_list_store.cc
diff --git a/components/reading_list/ios/reading_list_store.cc b/components/reading_list/ios/reading_list_store.cc
index a115eec20f90cdf75f50c9021bc67aec1110ca2b..fd02b5ccb6bd313e6bf5431198e6ef0c66241732 100644
--- a/components/reading_list/ios/reading_list_store.cc
+++ b/components/reading_list/ios/reading_list_store.cc
@@ -418,6 +418,8 @@ bool ReadingListStore::CompareEntriesForSync(
DCHECK(lhs.entry_id() == rhs.entry_id());
DCHECK(lhs.has_update_time_us());
DCHECK(rhs.has_update_time_us());
+ DCHECK(lhs.has_update_title_time_us());
+ DCHECK(rhs.has_update_title_time_us());
DCHECK(lhs.has_creation_time_us());
DCHECK(rhs.has_creation_time_us());
DCHECK(lhs.has_url());
@@ -426,7 +428,8 @@ bool ReadingListStore::CompareEntriesForSync(
DCHECK(rhs.has_title());
DCHECK(lhs.has_status());
DCHECK(rhs.has_status());
- if (rhs.url() != lhs.url() || rhs.title().compare(lhs.title()) < 0 ||
+ if (rhs.url() != lhs.url() ||
+ rhs.update_title_time_us() < lhs.update_title_time_us() ||
rhs.creation_time_us() < lhs.creation_time_us() ||
rhs.update_time_us() < lhs.update_time_us()) {
return false;
@@ -438,6 +441,10 @@ bool ReadingListStore::CompareEntriesForSync(
lhs.status() == sync_pb::ReadingListSpecifics::READ))
return false;
}
+ if (rhs.update_title_time_us() == lhs.update_title_time_us()) {
+ if (rhs.title().compare(lhs.title()) < 0)
+ return false;
+ }
if (rhs.creation_time_us() == lhs.creation_time_us()) {
if (rhs.first_read_time_us() == 0 && lhs.first_read_time_us() != 0) {
return false;

Powered by Google App Engine
This is Rietveld 408576698