Index: components/reading_list/ios/reading_list_entry.cc |
diff --git a/components/reading_list/ios/reading_list_entry.cc b/components/reading_list/ios/reading_list_entry.cc |
index 283d78a924fb9a66310822bfcc40c330e0e00458..01003afa941fb2a97e15e1184e1d796728517d6f 100644 |
--- a/components/reading_list/ios/reading_list_entry.cc |
+++ b/components/reading_list/ios/reading_list_entry.cc |
@@ -8,6 +8,7 @@ |
#include "base/memory/ptr_util.h" |
#include "components/reading_list/ios/offline_url_utils.h" |
#include "components/reading_list/ios/proto/reading_list.pb.h" |
+#include "components/reading_list/ios/reading_list_store.h" |
#include "components/sync/protocol/reading_list_specifics.pb.h" |
#include "net/base/backoff_entry_serializer.h" |
@@ -327,11 +328,28 @@ std::unique_ptr<ReadingListEntry> ReadingListEntry::FromReadingListSpecifics( |
WAITING, base::FilePath(), 0, nullptr)); |
} |
-void ReadingListEntry::MergeLocalStateFrom(ReadingListEntry& other) { |
- distilled_path_ = std::move(other.distilled_path_); |
- distilled_state_ = std::move(other.distilled_state_); |
- backoff_ = std::move(other.backoff_); |
- failed_download_counter_ = std::move(other.failed_download_counter_); |
+void ReadingListEntry::MergeWithEntry(const ReadingListEntry& other) { |
+#if !defined(NDEBUG) |
gambard
2016/12/06 17:02:22
What is the purpose of this? Can you add a comment
Olivier
2016/12/06 17:16:21
Done.
|
+ std::unique_ptr<sync_pb::ReadingListSpecifics> old_this_pb( |
+ AsReadingListSpecifics()); |
+ std::unique_ptr<sync_pb::ReadingListSpecifics> other_pb( |
+ other.AsReadingListSpecifics()); |
+#endif |
+ if (other.UpdateTime() >= UpdateTime()) { |
+ url_ = std::move(other.url_); |
+ title_ = std::move(other.title_); |
+ creation_time_us_ = std::move(other.creation_time_us_); |
+ update_time_us_ = std::move(other.update_time_us_); |
+ if (other.state_ != UNSEEN) { |
+ state_ = std::move(other.state_); |
+ } |
+ } |
+#if !defined(NDEBUG) |
+ std::unique_ptr<sync_pb::ReadingListSpecifics> new_this_pb( |
+ AsReadingListSpecifics()); |
+ DCHECK(ReadingListStore::CompareEntriesForSync(*old_this_pb, *new_this_pb)); |
+ DCHECK(ReadingListStore::CompareEntriesForSync(*other_pb, *new_this_pb)); |
+#endif |
} |
std::unique_ptr<reading_list::ReadingListLocal> |
@@ -423,8 +441,3 @@ ReadingListEntry::AsReadingListSpecifics() const { |
return pb_entry; |
} |
- |
-bool ReadingListEntry::CompareEntryUpdateTime(const ReadingListEntry& lhs, |
- const ReadingListEntry& rhs) { |
- return lhs.UpdateTime() > rhs.UpdateTime(); |
-} |