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

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

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.cc
diff --git a/components/sync/model_impl/passthrough_metadata_change_list.cc b/components/sync/model_impl/passthrough_metadata_change_list.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5f579de39f86c64df6bc5e24498f3f723e01d581
--- /dev/null
+++ b/components/sync/model_impl/passthrough_metadata_change_list.cc
@@ -0,0 +1,41 @@
+// 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.
+
+#include "components/sync/model_impl/passthrough_metadata_change_list.h"
+
+#include "base/logging.h"
+#include "components/sync/protocol/entity_metadata.pb.h"
+#include "components/sync/protocol/model_type_state.pb.h"
+
+namespace syncer {
+
+PassthroughMetadataChangeList::PassthroughMetadataChangeList(
+ ModelTypeStore* store,
+ ModelTypeStore::WriteBatch* batch)
+ : store_(store), batch_(batch) {
+ DCHECK(store_);
+ DCHECK(batch_);
+}
+
+void PassthroughMetadataChangeList::UpdateModelTypeState(
+ const sync_pb::ModelTypeState& model_type_state) {
+ store_->WriteGlobalMetadata(batch_, model_type_state.SerializeAsString());
+}
+
+void PassthroughMetadataChangeList::ClearModelTypeState() {
+ store_->DeleteGlobalMetadata(batch_);
+}
+
+void PassthroughMetadataChangeList::UpdateMetadata(
+ const std::string& storage_key,
+ const sync_pb::EntityMetadata& metadata) {
+ store_->WriteMetadata(batch_, storage_key, metadata.SerializeAsString());
+}
+
+void PassthroughMetadataChangeList::ClearMetadata(
+ const std::string& storage_key) {
+ store_->DeleteMetadata(batch_, storage_key);
+}
+
+} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698