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

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

Issue 2563303002: Fix crash when deleting ReadingListStore via ReadingListModelStorage*. (Closed)
Patch Set: 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 | no next file » | 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_MODEL_STORAGE_H_ 5 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_
6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_ 6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h"
10 #include "components/reading_list/ios/reading_list_entry.h" 11 #include "components/reading_list/ios/reading_list_entry.h"
11 12
12 class ReadingListModel; 13 class ReadingListModel;
13 class ReadingListStoreDelegate; 14 class ReadingListStoreDelegate;
14 15
15 namespace syncer { 16 namespace syncer {
16 class ModelTypeSyncBridge; 17 class ModelTypeSyncBridge;
17 } 18 }
18 19
19 // Interface for a persistence layer for reading list. 20 // Interface for a persistence layer for reading list.
20 // All interface methods have to be called on main thread. 21 // All interface methods have to be called on main thread.
21 class ReadingListModelStorage { 22 class ReadingListModelStorage {
22 public: 23 public:
23 class ScopedBatchUpdate; 24 class ScopedBatchUpdate;
24 25
26 ReadingListModelStorage() {}
27 virtual ~ReadingListModelStorage() {}
28
25 // Sets the model the Storage is backing. 29 // Sets the model the Storage is backing.
26 // This will trigger store initalization and load persistent entries. 30 // This will trigger store initalization and load persistent entries.
27 virtual void SetReadingListModel(ReadingListModel* model, 31 virtual void SetReadingListModel(ReadingListModel* model,
28 ReadingListStoreDelegate* delegate) = 0; 32 ReadingListStoreDelegate* delegate) = 0;
29 33
30 // Returns the class responsible for handling sync messages. 34 // Returns the class responsible for handling sync messages.
31 virtual syncer::ModelTypeSyncBridge* GetModelTypeSyncBridge() = 0; 35 virtual syncer::ModelTypeSyncBridge* GetModelTypeSyncBridge() = 0;
32 36
33 // Starts a transaction. All Save/Remove entry will be delayed until the 37 // Starts a transaction. All Save/Remove entry will be delayed until the
34 // transaction is commited. 38 // transaction is commited.
35 // Multiple transaction can be started at the same time. Commit will happen 39 // Multiple transaction can be started at the same time. Commit will happen
36 // when the last transaction is commited. 40 // when the last transaction is commited.
37 // Returns a scoped batch update object that should be retained while the 41 // Returns a scoped batch update object that should be retained while the
38 // batch update is performed. Deallocating this object will inform model that 42 // batch update is performed. Deallocating this object will inform model that
39 // the batch update has completed. 43 // the batch update has completed.
40 virtual std::unique_ptr<ScopedBatchUpdate> EnsureBatchCreated() = 0; 44 virtual std::unique_ptr<ScopedBatchUpdate> EnsureBatchCreated() = 0;
41 45
42 // Saves or updates an entry. If the entry is not yet in the database, it is 46 // Saves or updates an entry. If the entry is not yet in the database, it is
43 // created. 47 // created.
44 virtual void SaveEntry(const ReadingListEntry& entry) = 0; 48 virtual void SaveEntry(const ReadingListEntry& entry) = 0;
45 49
46 // Removed an entry from the storage. 50 // Removed an entry from the storage.
47 virtual void RemoveEntry(const ReadingListEntry& entry) = 0; 51 virtual void RemoveEntry(const ReadingListEntry& entry) = 0;
48 52
49 class ScopedBatchUpdate { 53 class ScopedBatchUpdate {
50 public: 54 public:
55 ScopedBatchUpdate() {}
51 virtual ~ScopedBatchUpdate() {} 56 virtual ~ScopedBatchUpdate() {}
57
58 private:
59 DISALLOW_COPY_AND_ASSIGN(ScopedBatchUpdate);
52 }; 60 };
61
62 private:
63 DISALLOW_COPY_AND_ASSIGN(ReadingListModelStorage);
53 }; 64 };
54 65
55 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_ 66 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698