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

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

Issue 2553143002: Create a strict order in ReadingListSpecifics (Closed)
Patch Set: order by field 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
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_STORE_H_ 5 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_STORE_H_
6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_STORE_H_ 6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_STORE_H_
7 7
8 #include "base/threading/non_thread_safe.h" 8 #include "base/threading/non_thread_safe.h"
9 #include "components/reading_list/ios/reading_list_model_storage.h" 9 #include "components/reading_list/ios/reading_list_model_storage.h"
10 #include "components/reading_list/ios/reading_list_store_delegate.h" 10 #include "components/reading_list/ios/reading_list_store_delegate.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 // Apply changes from the sync server locally. 66 // Apply changes from the sync server locally.
67 // Please note that |entity_changes| might have fewer entries than 67 // Please note that |entity_changes| might have fewer entries than
68 // |metadata_change_list| in case when some of the data changes are filtered 68 // |metadata_change_list| in case when some of the data changes are filtered
69 // out, or even be empty in case when a commit confirmation is processed and 69 // out, or even be empty in case when a commit confirmation is processed and
70 // only the metadata needs to persisted. 70 // only the metadata needs to persisted.
71 syncer::SyncError ApplySyncChanges( 71 syncer::SyncError ApplySyncChanges(
72 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list, 72 std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
73 syncer::EntityChangeList entity_changes) override; 73 syncer::EntityChangeList entity_changes) override;
74 74
75 // Returns whether entries respect a strict order for sync and if |rhs| can be
76 // submitted to sync after |lhs| has been received.
77 // The order should ensure that there is no sync loop in sync and should be
78 // submitted to sync in strictly increasing order.
79 // Entries are in increasing order if all the fields respect increasing order.
80 // - URL must be the same.
81 // - title must verify rhs.title.compare(lhs.title) >= 0
pavely 2016/12/07 19:16:06 I don't really understand why title is taken into
Olivier 2016/12/08 08:04:07 At the moment, title cannot be changed, so the onl
82 // - rhs.creation_time_us >= lhs.creation_time_us
83 // - rhs.update_time_us >= lhs.update_time_us
84 // - if rhs.update_time_us > lhs.update_time_us, rhs.state can be anything.
85 // - if rhs.update_time_us == lhs.update_time_us, rhs.state >= lhs.state in
86 // the order UNSEEN, UNREAD, READ.
87 static bool CompareEntriesForSync(const sync_pb::ReadingListSpecifics& lhs,
88 const sync_pb::ReadingListSpecifics& rhs);
89
75 // Asynchronously retrieve the corresponding sync data for |storage_keys|. 90 // Asynchronously retrieve the corresponding sync data for |storage_keys|.
76 void GetData(StorageKeyList storage_keys, DataCallback callback) override; 91 void GetData(StorageKeyList storage_keys, DataCallback callback) override;
77 92
78 // Asynchronously retrieve all of the local sync data. 93 // Asynchronously retrieve all of the local sync data.
79 void GetAllData(DataCallback callback) override; 94 void GetAllData(DataCallback callback) override;
80 95
81 // Get or generate a client tag for |entity_data|. This must be the same tag 96 // Get or generate a client tag for |entity_data|. This must be the same tag
82 // that was/would have been generated in the SyncableService/Directory world 97 // that was/would have been generated in the SyncableService/Directory world
83 // for backward compatibility with pre-USS clients. The only time this 98 // for backward compatibility with pre-USS clients. The only time this
84 // theoretically needs to be called is on the creation of local data, however 99 // theoretically needs to be called is on the creation of local data, however
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 std::unique_ptr<syncer::ModelTypeStore> store_; 143 std::unique_ptr<syncer::ModelTypeStore> store_;
129 ReadingListModel* model_; 144 ReadingListModel* model_;
130 ReadingListStoreDelegate* delegate_; 145 ReadingListStoreDelegate* delegate_;
131 StoreFactoryFunction create_store_callback_; 146 StoreFactoryFunction create_store_callback_;
132 147
133 int pending_transaction_count_; 148 int pending_transaction_count_;
134 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_; 149 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_;
135 }; 150 };
136 151
137 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_STORE_H_ 152 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698