| OLD | NEW |
| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 75 // Returns whether entries respect a strict order for sync and if |rhs| can be |
| 76 // submitted to sync after |lhs| has been received. | 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 | 77 // The order should ensure that there is no sync loop in sync and should be |
| 78 // submitted to sync in strictly increasing order. | 78 // submitted to sync in strictly increasing order. |
| 79 // Entries are in increasing order if all the fields respect increasing order. | 79 // Entries are in increasing order if all the fields respect increasing order. |
| 80 // - URL must be the same. | 80 // - URL must be the same. |
| 81 // - title must verify rhs.title.compare(lhs.title) >= 0 | 81 // - title must verify rhs.title.compare(lhs.title) >= 0 |
| 82 // - rhs.creation_time_us >= lhs.creation_time_us | 82 // - creation_time_us: |
| 83 // - rhs.update_time_us >= lhs.update_time_us | 83 // rhs.creation_time_us >= lhs.creation_time_us |
| 84 // - if rhs.update_time_us > lhs.update_time_us, rhs.state can be anything. | 84 // - rhs.first_read_time_us: |
| 85 // - if rhs.update_time_us == lhs.update_time_us, rhs.state >= lhs.state in | 85 // if rhs.creation_time_us > lhs.creation_time_us, |
| 86 // the order UNSEEN, UNREAD, READ. | 86 // rhs.first_read_time_us can be anything. |
| 87 // if rhs.creation_time_us == lhs.creation_time_us |
| 88 // and rhs.first_read_time_us == 0 |
| 89 // rhs.first_read_time_us can be anything. |
| 90 // if rhs.creation_time_us == lhs.creation_time_us, |
| 91 // rhs.first_read_time_us <= lhs.first_read_time_us |
| 92 // - update_time_us: |
| 93 // rhs.update_time_us >= lhs.update_time_us |
| 94 // - state: |
| 95 // if rhs.update_time_us > lhs.update_time_us |
| 96 // rhs.state can be anything. |
| 97 // if rhs.update_time_us == lhs.update_time_us |
| 98 // rhs.state >= lhs.state in the order UNSEEN, UNREAD, READ. |
| 87 static bool CompareEntriesForSync(const sync_pb::ReadingListSpecifics& lhs, | 99 static bool CompareEntriesForSync(const sync_pb::ReadingListSpecifics& lhs, |
| 88 const sync_pb::ReadingListSpecifics& rhs); | 100 const sync_pb::ReadingListSpecifics& rhs); |
| 89 | 101 |
| 90 // Asynchronously retrieve the corresponding sync data for |storage_keys|. | 102 // Asynchronously retrieve the corresponding sync data for |storage_keys|. |
| 91 void GetData(StorageKeyList storage_keys, DataCallback callback) override; | 103 void GetData(StorageKeyList storage_keys, DataCallback callback) override; |
| 92 | 104 |
| 93 // Asynchronously retrieve all of the local sync data. | 105 // Asynchronously retrieve all of the local sync data. |
| 94 void GetAllData(DataCallback callback) override; | 106 void GetAllData(DataCallback callback) override; |
| 95 | 107 |
| 96 // Get or generate a client tag for |entity_data|. This must be the same tag | 108 // Get or generate a client tag for |entity_data|. This must be the same tag |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 std::unique_ptr<syncer::ModelTypeStore> store_; | 155 std::unique_ptr<syncer::ModelTypeStore> store_; |
| 144 ReadingListModel* model_; | 156 ReadingListModel* model_; |
| 145 ReadingListStoreDelegate* delegate_; | 157 ReadingListStoreDelegate* delegate_; |
| 146 StoreFactoryFunction create_store_callback_; | 158 StoreFactoryFunction create_store_callback_; |
| 147 | 159 |
| 148 int pending_transaction_count_; | 160 int pending_transaction_count_; |
| 149 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_; | 161 std::unique_ptr<syncer::ModelTypeStore::WriteBatch> batch_; |
| 150 }; | 162 }; |
| 151 | 163 |
| 152 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_STORE_H_ | 164 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_STORE_H_ |
| OLD | NEW |