| Index: ios/chrome/browser/reading_list/reading_list_model_storage.h
|
| diff --git a/ios/chrome/browser/reading_list/reading_list_model_storage.h b/ios/chrome/browser/reading_list/reading_list_model_storage.h
|
| index e55b1d5cba13798e76c92619590b5b8bfe073f1b..9fe680d84fd2324671129501501dc35a8a4945ec 100644
|
| --- a/ios/chrome/browser/reading_list/reading_list_model_storage.h
|
| +++ b/ios/chrome/browser/reading_list/reading_list_model_storage.h
|
| @@ -10,18 +10,46 @@
|
| #include "ios/chrome/browser/reading_list/reading_list_entry.h"
|
|
|
| class ReadingListModel;
|
| +class ReadingListStoreDelegate;
|
| +
|
| +namespace syncer {
|
| +class ModelTypeSyncBridge;
|
| +}
|
|
|
| // Interface for a persistence layer for reading list.
|
| // All interface methods have to be called on main thread.
|
| class ReadingListModelStorage {
|
| public:
|
| - virtual std::vector<ReadingListEntry> LoadPersistentReadList() = 0;
|
| - virtual std::vector<ReadingListEntry> LoadPersistentUnreadList() = 0;
|
| + class ScopedBatchUpdate;
|
| +
|
| + // Sets the model the Storage is backing.
|
| + // This will trigger store initalization and load persistent entries.
|
| + virtual void SetReadingListModel(ReadingListModel* model,
|
| + ReadingListStoreDelegate* delegate) = 0;
|
| +
|
| + // Returns the class responsible for handling sync messages.
|
| + virtual syncer::ModelTypeSyncBridge* GetModelTypeSyncBridge() = 0;
|
| +
|
| + // Starts a transaction. All Save/Remove entry will be delayed until the
|
| + // transaction is commited.
|
| + // Multiple transaction can be started at the same time. Commit will happen
|
| + // when the last transaction is commited.
|
| + // Returns a scoped batch update object that should be retained while the
|
| + // batch update is performed. Deallocating this object will inform model that
|
| + // the batch update has completed.
|
| + virtual std::unique_ptr<ScopedBatchUpdate> EnsureBatchCreated() = 0;
|
| +
|
| + // Saves or updates an entry. If the entry is not yet in the database, it is
|
| + // created.
|
| + virtual void SaveEntry(const ReadingListEntry& entry, bool read) = 0;
|
| +
|
| + // Removed an entry from the storage.
|
| + virtual void RemoveEntry(const ReadingListEntry& entry) = 0;
|
|
|
| - virtual void SavePersistentReadList(
|
| - const std::vector<ReadingListEntry>& read) = 0;
|
| - virtual void SavePersistentUnreadList(
|
| - const std::vector<ReadingListEntry>& unread) = 0;
|
| + class ScopedBatchUpdate {
|
| + public:
|
| + virtual ~ScopedBatchUpdate() {}
|
| + };
|
| };
|
|
|
| #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_STORAGE_H_
|
|
|