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

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

Issue 2553143002: Create a strict order in ReadingListSpecifics (Closed)
Patch Set: comments 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 if entries respect a strict order for sync and if |rhs| can be
jif 2016/12/07 08:25:36 Returns true if
gambard 2016/12/07 10:28:49 Or "Returns whether".
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 // The order is defined as follow:
80 // - Primary key: update time
81 // - Secondary key: state with UNSEEN < READ && UNSEEN < UNREAD.
82 // If order cannot be determine strictly, the entry should not be sent to
83 // sync.
84 static bool CompareEntriesForSync(const sync_pb::ReadingListSpecifics& lhs,
85 const sync_pb::ReadingListSpecifics& rhs);
86
75 // Asynchronously retrieve the corresponding sync data for |storage_keys|. 87 // Asynchronously retrieve the corresponding sync data for |storage_keys|.
76 void GetData(StorageKeyList storage_keys, DataCallback callback) override; 88 void GetData(StorageKeyList storage_keys, DataCallback callback) override;
77 89
78 // Asynchronously retrieve all of the local sync data. 90 // Asynchronously retrieve all of the local sync data.
79 void GetAllData(DataCallback callback) override; 91 void GetAllData(DataCallback callback) override;
80 92
81 // Get or generate a client tag for |entity_data|. This must be the same tag 93 // 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 94 // that was/would have been generated in the SyncableService/Directory world
83 // for backward compatibility with pre-USS clients. The only time this 95 // 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 96 // 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_; 140 std::unique_ptr<syncer::ModelTypeStore> store_;
129 ReadingListModel* model_; 141 ReadingListModel* model_;
130 ReadingListStoreDelegate* delegate_; 142 ReadingListStoreDelegate* delegate_;
131 StoreFactoryFunction create_store_callback_; 143 StoreFactoryFunction create_store_callback_;
132 144
133 int pending_transaction_count_; 145 int pending_transaction_count_;
134 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_; 146 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_;
135 }; 147 };
136 148
137 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_STORE_H_ 149 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698