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

Unified Diff: components/sync/model/simple_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
« no previous file with comments | « components/sync/model/model_type_store.cc ('k') | components/sync/model/simple_metadata_change_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/model/simple_metadata_change_list.h
diff --git a/components/sync/model/simple_metadata_change_list.h b/components/sync/model/simple_metadata_change_list.h
deleted file mode 100644
index 685f66178bf0109ab4e52774d9c27e4fece4da15..0000000000000000000000000000000000000000
--- a/components/sync/model/simple_metadata_change_list.h
+++ /dev/null
@@ -1,66 +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.
-
-#ifndef COMPONENTS_SYNC_MODEL_SIMPLE_METADATA_CHANGE_LIST_H_
-#define COMPONENTS_SYNC_MODEL_SIMPLE_METADATA_CHANGE_LIST_H_
-
-#include <map>
-#include <memory>
-#include <string>
-
-#include "components/sync/engine/non_blocking_sync_common.h"
-#include "components/sync/model/metadata_change_list.h"
-#include "components/sync/model/model_type_store.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 SimpleMetadataChangeList : public MetadataChangeList {
- public:
- enum ChangeType { UPDATE, CLEAR };
-
- struct MetadataChange {
- ChangeType type;
- sync_pb::EntityMetadata metadata;
- };
-
- struct ModelTypeStateChange {
- ChangeType type;
- sync_pb::ModelTypeState state;
- };
-
- typedef std::map<std::string, MetadataChange> MetadataChanges;
-
- SimpleMetadataChangeList();
- ~SimpleMetadataChangeList() override;
-
- 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;
-
- const MetadataChanges& GetMetadataChanges() const;
- bool HasModelTypeStateChange() const;
- const ModelTypeStateChange& GetModelTypeStateChange() const;
-
- // 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);
-
- private:
- MetadataChanges metadata_changes_;
- std::unique_ptr<ModelTypeStateChange> state_change_;
-};
-
-} // namespace syncer
-
-#endif // COMPONENTS_SYNC_MODEL_SIMPLE_METADATA_CHANGE_LIST_H_
« no previous file with comments | « components/sync/model/model_type_store.cc ('k') | components/sync/model/simple_metadata_change_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698