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

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

Issue 2470953002: [Sync] Adding a passthrough MetadataChangeList implementation. (Closed)
Patch Set: Last update for Max. 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/passthrough_metadata_change_list.h
diff --git a/components/sync/model_impl/passthrough_metadata_change_list.h b/components/sync/model_impl/passthrough_metadata_change_list.h
new file mode 100644
index 0000000000000000000000000000000000000000..5e4b850f1548908af745d40ab654c1fdf5723e04
--- /dev/null
+++ b/components/sync/model_impl/passthrough_metadata_change_list.h
@@ -0,0 +1,39 @@
+// 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_PASSTHROUGH_METADATA_CHANGE_LIST_H_
+#define COMPONENTS_SYNC_MODEL_IMPL_PASSTHROUGH_METADATA_CHANGE_LIST_H_
+
+#include <string>
+
+#include "components/sync/model/metadata_change_list.h"
+#include "components/sync/model/model_type_store.h"
+
+namespace syncer {
+
+// A thin wrapper around ModelTypeStore and WriteBatch to implement the
+// MetadataChangeList interface. This class should never outlive any of the
+// delegate objects it calls.
+class PassthroughMetadataChangeList : public MetadataChangeList {
+ public:
+ PassthroughMetadataChangeList(ModelTypeStore* store,
+ ModelTypeStore::WriteBatch* batch);
+
+ // DataBatch MetadataChangeList.
+ void UpdateModelTypeState(
+ const sync_pb::ModelTypeState& model_type_state) override;
+ void ClearModelTypeState() override;
+ void UpdateMetadata(const std::string& storage_key,
+ const sync_pb::EntityMetadata& metadata) override;
+ void ClearMetadata(const std::string& storage_key) override;
+
+ private:
+ // Non owning references.
+ ModelTypeStore* store_;
+ ModelTypeStore::WriteBatch* batch_;
+};
+
+} // namespace syncer
+
+#endif // COMPONENTS_SYNC_MODEL_IMPL_PASSTHROUGH_METADATA_CHANGE_LIST_H_

Powered by Google App Engine
This is Rietveld 408576698