OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SYNC_CORE_SIMPLE_METADATA_CHANGE_LIST_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_SIMPLE_METADATA_CHANGE_LIST_H_ |
6 #define COMPONENTS_SYNC_CORE_SIMPLE_METADATA_CHANGE_LIST_H_ | 6 #define COMPONENTS_SYNC_CORE_SIMPLE_METADATA_CHANGE_LIST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "components/sync/api/metadata_change_list.h" | 11 #include "components/sync/api/metadata_change_list.h" |
12 #include "components/sync/api/model_type_store.h" | 12 #include "components/sync/api/model_type_store.h" |
13 #include "components/sync/core/non_blocking_sync_common.h" | 13 #include "components/sync/core/non_blocking_sync_common.h" |
14 #include "components/sync/protocol/data_type_state.pb.h" | 14 #include "components/sync/protocol/data_type_state.pb.h" |
15 #include "components/sync/protocol/entity_metadata.pb.h" | 15 #include "components/sync/protocol/entity_metadata.pb.h" |
16 | 16 |
17 namespace syncer_v2 { | 17 namespace syncer { |
18 | 18 |
19 // A MetadataChangeList implementation that is meant to be used in combination | 19 // A MetadataChangeList implementation that is meant to be used in combination |
20 // with a ModelTypeStore. It accumulates changes in member fields, and then when | 20 // with a ModelTypeStore. It accumulates changes in member fields, and then when |
21 // requested transfers them to the store/write batch. | 21 // requested transfers them to the store/write batch. |
22 class SimpleMetadataChangeList : public MetadataChangeList { | 22 class SimpleMetadataChangeList : public MetadataChangeList { |
23 public: | 23 public: |
24 enum ChangeType { UPDATE, CLEAR }; | 24 enum ChangeType { UPDATE, CLEAR }; |
25 | 25 |
26 struct MetadataChange { | 26 struct MetadataChange { |
27 ChangeType type; | 27 ChangeType type; |
(...skipping 25 matching lines...) Expand all Loading... |
53 // local copies. Calling this multiple times will work, but should not be | 53 // local copies. Calling this multiple times will work, but should not be |
54 // necessary. | 54 // necessary. |
55 void TransferChanges(ModelTypeStore* store, | 55 void TransferChanges(ModelTypeStore* store, |
56 ModelTypeStore::WriteBatch* write_batch); | 56 ModelTypeStore::WriteBatch* write_batch); |
57 | 57 |
58 private: | 58 private: |
59 MetadataChanges metadata_changes_; | 59 MetadataChanges metadata_changes_; |
60 std::unique_ptr<DataTypeStateChange> state_change_; | 60 std::unique_ptr<DataTypeStateChange> state_change_; |
61 }; | 61 }; |
62 | 62 |
63 } // namespace syncer_v2 | 63 } // namespace syncer |
64 | 64 |
65 #endif // COMPONENTS_SYNC_CORE_SIMPLE_METADATA_CHANGE_LIST_H_ | 65 #endif // COMPONENTS_SYNC_CORE_SIMPLE_METADATA_CHANGE_LIST_H_ |
OLD | NEW |