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

Unified Diff: components/sync/model/model_type_store.h

Issue 2489683002: [Sync] Make all ModelTypeStore write methods go through WriteBatch. (Closed)
Patch Set: Address comment. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/model/mock_model_type_store.h ('k') | components/sync/model/model_type_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/model/model_type_store.h
diff --git a/components/sync/model/model_type_store.h b/components/sync/model/model_type_store.h
index 07d1082d8273869ab228c40ddb3f969fcc7f4f6a..02448ea0c0fb30d2c79a4e555b27167368dfd91c 100644
--- a/components/sync/model/model_type_store.h
+++ b/components/sync/model/model_type_store.h
@@ -70,12 +70,18 @@ class ModelTypeStore {
class WriteBatch {
public:
// Creates a MetadataChangeList that will accumulate metadata changes and
- // can later pass them to a WriteBatch via TransferChanges. Use this when
+ // can later be passed to a WriteBatch via TransferChanges. Use this when
// you need a MetadataChangeList and do not have a WriteBatch in scope.
static std::unique_ptr<MetadataChangeList> CreateMetadataChangeList();
virtual ~WriteBatch();
+ // Write the given |value| for data with |id|.
+ void WriteData(const std::string& id, const std::string& value);
+
+ // Delete the record for data with |id|.
+ void DeleteData(const std::string& id);
+
// Provides access to a MetadataChangeList that will pass its changes
// directly into this WriteBatch. Use this when you need a
// MetadataChangeList and already have a WriteBatch in scope.
@@ -164,7 +170,12 @@ class ModelTypeStore {
virtual void CommitWriteBatch(std::unique_ptr<WriteBatch> write_batch,
const CallbackWithResult& callback) = 0;
- // Write operations.
+ protected:
+ friend class AccumulatingMetadataChangeList;
+ friend class ModelTypeStoreImplTest;
+ friend class PassthroughMetadataChangeList;
+
+ // Write operations; access via WriteBatch.
virtual void WriteData(WriteBatch* write_batch,
const std::string& id,
const std::string& value) = 0;
« no previous file with comments | « components/sync/model/mock_model_type_store.h ('k') | components/sync/model/model_type_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698