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

Unified Diff: sync/internal_api/public/simple_metadata_change_list.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months 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: sync/internal_api/public/simple_metadata_change_list.cc
diff --git a/sync/internal_api/public/simple_metadata_change_list.cc b/sync/internal_api/public/simple_metadata_change_list.cc
deleted file mode 100644
index 591f75e73ad6c2062c64bc4af5e4f728c5d0de8c..0000000000000000000000000000000000000000
--- a/sync/internal_api/public/simple_metadata_change_list.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2015 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 "sync/internal_api/public/simple_metadata_change_list.h"
-
-namespace syncer_v2 {
-
-SimpleMetadataChangeList::SimpleMetadataChangeList() {}
-
-SimpleMetadataChangeList::~SimpleMetadataChangeList() {}
-
-void SimpleMetadataChangeList::UpdateDataTypeState(
- const sync_pb::DataTypeState& data_type_state) {
- state_change_.reset(new DataTypeStateChange{UPDATE, data_type_state});
-}
-
-void SimpleMetadataChangeList::ClearDataTypeState() {
- state_change_.reset(new DataTypeStateChange{CLEAR});
-}
-
-void SimpleMetadataChangeList::UpdateMetadata(
- const std::string& client_tag,
- const sync_pb::EntityMetadata& metadata) {
- metadata_changes_[client_tag] = {UPDATE, metadata};
-}
-
-void SimpleMetadataChangeList::ClearMetadata(const std::string& client_tag) {
- metadata_changes_[client_tag] = {CLEAR, sync_pb::EntityMetadata()};
-}
-
-const SimpleMetadataChangeList::MetadataChanges&
-SimpleMetadataChangeList::GetMetadataChanges() const {
- return metadata_changes_;
-}
-
-bool SimpleMetadataChangeList::HasDataTypeStateChange() const {
- return state_change_.get() != nullptr;
-}
-
-const SimpleMetadataChangeList::DataTypeStateChange&
-SimpleMetadataChangeList::GetDataTypeStateChange() const {
- return *state_change_.get();
-}
-
-void SimpleMetadataChangeList::TransferChanges(
- ModelTypeStore* store,
- ModelTypeStore::WriteBatch* write_batch) {
- DCHECK(write_batch);
- DCHECK(store);
- for (const auto& pair : metadata_changes_) {
- const std::string& key = pair.first;
- const MetadataChange& change = pair.second;
- switch (change.type) {
- case UPDATE:
- store->WriteMetadata(write_batch, key,
- change.metadata.SerializeAsString());
- break;
- case CLEAR:
- store->DeleteMetadata(write_batch, key);
- break;
- }
- }
- metadata_changes_.clear();
- if (HasDataTypeStateChange()) {
- switch (state_change_->type) {
- case UPDATE:
- store->WriteGlobalMetadata(write_batch,
- state_change_->state.SerializeAsString());
- break;
- case CLEAR:
- store->DeleteGlobalMetadata(write_batch);
- break;
- }
- state_change_.reset();
- }
-}
-
-} // namespace syncer_v2

Powered by Google App Engine
This is Rietveld 408576698