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

Side by Side Diff: components/reading_list/ios/reading_list_entry.h

Issue 2553143002: Create a strict order in ReadingListSpecifics (Closed)
Patch Set: rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/reading_list/ios/reading_list_entry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_ 5 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_
6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_ 6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 std::unique_ptr<sync_pb::ReadingListSpecifics> AsReadingListSpecifics() const; 87 std::unique_ptr<sync_pb::ReadingListSpecifics> AsReadingListSpecifics() const;
88 88
89 // Created a ReadingListEntry from the protobuf format. 89 // Created a ReadingListEntry from the protobuf format.
90 static std::unique_ptr<ReadingListEntry> FromReadingListLocal( 90 static std::unique_ptr<ReadingListEntry> FromReadingListLocal(
91 const reading_list::ReadingListLocal& pb_entry); 91 const reading_list::ReadingListLocal& pb_entry);
92 92
93 // Created a ReadingListEntry from the protobuf format. 93 // Created a ReadingListEntry from the protobuf format.
94 static std::unique_ptr<ReadingListEntry> FromReadingListSpecifics( 94 static std::unique_ptr<ReadingListEntry> FromReadingListSpecifics(
95 const sync_pb::ReadingListSpecifics& pb_entry); 95 const sync_pb::ReadingListSpecifics& pb_entry);
96 96
97 // Merge the local data from |other| to this. 97 // Merge |this| and |other| into this.
98 // The local fields (distilled_state_, distilled_url_, backoff_, 98 // Local fields are kept from |this|.
99 // failed_download_counter_) of |other| are moved to |this| and must not be 99 // Each field is merged individually keeping the highest value as defined by
100 // used after this call. 100 // the |ReadingListStore.CompareEntriesForSync| function.
101 void MergeLocalStateFrom(ReadingListEntry& other); 101 //
102 // After calling |MergeLocalStateFrom|, the result must verify
103 // ReadingListStore.CompareEntriesForSync(old_this.AsReadingListSpecifics(),
104 // new_this.AsReadingListSpecifics())
105 // and
106 // ReadingListStore.CompareEntriesForSync(other.AsReadingListSpecifics(),
107 // new_this.AsReadingListSpecifics()).
108 void MergeWithEntry(const ReadingListEntry& other);
102 109
103 ReadingListEntry& operator=(ReadingListEntry&& other); 110 ReadingListEntry& operator=(ReadingListEntry&& other);
104 111
105 bool operator==(const ReadingListEntry& other) const; 112 bool operator==(const ReadingListEntry& other) const;
106 113
107 // Returns whether |lhs| is more recent than |rhs|.
108 static bool CompareEntryUpdateTime(const ReadingListEntry& lhs,
109 const ReadingListEntry& rhs);
110
111 // Sets the title. 114 // Sets the title.
112 void SetTitle(const std::string& title); 115 void SetTitle(const std::string& title);
113 // Sets the distilled URL and switch the state to PROCESSED and reset the time 116 // Sets the distilled URL and switch the state to PROCESSED and reset the time
114 // until the next try. 117 // until the next try.
115 void SetDistilledPath(const base::FilePath& path); 118 void SetDistilledPath(const base::FilePath& path);
116 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR. 119 // Sets the state to one of PROCESSING, WILL_RETRY or ERROR.
117 void SetDistilledState(DistillationState distilled_state); 120 void SetDistilledState(DistillationState distilled_state);
118 // Sets the read state of the entry. Will set the UpdateTime of the entry. 121 // Sets the read state of the entry. Will set the UpdateTime of the entry.
119 void SetRead(bool read); 122 void SetRead(bool read);
120 123
(...skipping 22 matching lines...) Expand all
143 // sorting the entries from the database. They are kept in int64_t to avoid 146 // sorting the entries from the database. They are kept in int64_t to avoid
144 // conversion on each save/read event. 147 // conversion on each save/read event.
145 int64_t creation_time_us_; 148 int64_t creation_time_us_;
146 int64_t first_read_time_us_; 149 int64_t first_read_time_us_;
147 int64_t update_time_us_; 150 int64_t update_time_us_;
148 151
149 DISALLOW_COPY_AND_ASSIGN(ReadingListEntry); 152 DISALLOW_COPY_AND_ASSIGN(ReadingListEntry);
150 }; 153 };
151 154
152 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_ 155 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_ENTRY_H_
OLDNEW
« no previous file with comments | « no previous file | components/reading_list/ios/reading_list_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698