Chromium Code Reviews| Index: sync/internal_api/public/simple_metadata_change_list.h |
| diff --git a/sync/internal_api/public/simple_metadata_change_list.h b/sync/internal_api/public/simple_metadata_change_list.h |
| index f302b12ff93109a0fc5fbb56c3ce3cdc16ff721a..9daaee49b1bc697fee54dc1fb73da443cf7a7d7e 100644 |
| --- a/sync/internal_api/public/simple_metadata_change_list.h |
| +++ b/sync/internal_api/public/simple_metadata_change_list.h |
| @@ -5,11 +5,15 @@ |
| #ifndef SYNC_INTERNAL_API_PUBLIC_SIMPLE_METADATA_CHANGE_LIST_H_ |
| #define SYNC_INTERNAL_API_PUBLIC_SIMPLE_METADATA_CHANGE_LIST_H_ |
| +#include <map> |
| #include <string> |
| #include "sync/api/metadata_change_list.h" |
| #include "sync/api/model_type_store.h" |
| #include "sync/base/sync_export.h" |
| +#include "sync/internal_api/public/non_blocking_sync_common.h" |
|
skym
2016/02/18 16:11:10
Don't think you need this anymore.
|
| +#include "sync/protocol/data_type_state.pb.h" |
| +#include "sync/protocol/entity_metadata.pb.h" |
| namespace syncer_v2 { |
| @@ -18,6 +22,20 @@ namespace syncer_v2 { |
| // requested transfers them to the store/write batch. |
| class SYNC_EXPORT SimpleMetadataChangeList : public MetadataChangeList { |
| public: |
| + enum ChangeType { UPDATE, CLEAR }; |
| + |
| + struct MetadataChange { |
| + ChangeType type; |
| + sync_pb::EntityMetadata metadata; |
| + }; |
| + |
| + struct DataTypeStateChange { |
| + ChangeType type; |
| + sync_pb::DataTypeState state; |
| + }; |
| + |
| + typedef std::map<std::string, MetadataChange> MetadataChanges; |
| + |
| SimpleMetadataChangeList(); |
| ~SimpleMetadataChangeList() override; |
| @@ -28,11 +46,19 @@ class SYNC_EXPORT SimpleMetadataChangeList : public MetadataChangeList { |
| const sync_pb::EntityMetadata& metadata) override; |
| void ClearMetadata(const std::string& client_tag) override; |
| + const MetadataChanges& GetMetadataChanges() const; |
| + bool HasDataTypeStateChange() const; |
| + const DataTypeStateChange& GetDataTypeStateChange() 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 TranfserChanges(ModelTypeStore* store, |
| + void TransferChanges(ModelTypeStore* store, |
| ModelTypeStore::WriteBatch* write_batch); |
| + |
| + private: |
| + MetadataChanges metadata_changes_; |
| + scoped_ptr<DataTypeStateChange> state_change_; |
| }; |
| } // namespace syncer_v2 |