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

Unified Diff: components/sync/model_impl/accumulating_metadata_change_list.h

Issue 2473553003: [Sync] Improve MetadataChangeList usage for types using ModelTypeStore. (Closed)
Patch Set: Fix comments + protected constructor. 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
Index: components/sync/model_impl/accumulating_metadata_change_list.h
diff --git a/components/sync/model_impl/accumulating_metadata_change_list.h b/components/sync/model_impl/accumulating_metadata_change_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..e810d3a8b2cdc228b3fa0159ac286bf4a67a5edd
--- /dev/null
+++ b/components/sync/model_impl/accumulating_metadata_change_list.h
@@ -0,0 +1,37 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SYNC_MODEL_IMPL_ACCUMULATING_METADATA_CHANGE_LIST_H_
+#define COMPONENTS_SYNC_MODEL_IMPL_ACCUMULATING_METADATA_CHANGE_LIST_H_
+
+#include <map>
+#include <memory>
+#include <string>
+
+#include "components/sync/engine/non_blocking_sync_common.h"
+#include "components/sync/model/model_type_store.h"
+#include "components/sync/model_impl/in_memory_metadata_change_list.h"
+#include "components/sync/protocol/entity_metadata.pb.h"
+#include "components/sync/protocol/model_type_state.pb.h"
+
+namespace syncer {
+
+// A MetadataChangeList implementation that is meant to be used in combination
+// with a ModelTypeStore. It accumulates changes in member fields, and then when
+// requested transfers them to the store/write batch.
+class AccumulatingMetadataChangeList : public InMemoryMetadataChangeList {
+ public:
+ AccumulatingMetadataChangeList();
+ ~AccumulatingMetadataChangeList() override;
+
+ // Moves all currently accumulated changes into the write batch, clear out
+ // local copies. Calling this multiple times will work, but should not be
+ // necessary.
+ void TransferChanges(ModelTypeStore* store,
+ ModelTypeStore::WriteBatch* write_batch);
+};
+
+} // namespace syncer
+
+#endif // COMPONENTS_SYNC_MODEL_IMPL_ACCUMULATING_METADATA_CHANGE_LIST_H_

Powered by Google App Engine
This is Rietveld 408576698