OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_ |
6 #define COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_ | 6 #define COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 10 matching lines...) Expand all Loading... |
21 public: | 21 public: |
22 RecordingModelTypeChangeProcessor(); | 22 RecordingModelTypeChangeProcessor(); |
23 ~RecordingModelTypeChangeProcessor() override; | 23 ~RecordingModelTypeChangeProcessor() override; |
24 | 24 |
25 // FakeModelTypeChangeProcessor overrides. | 25 // FakeModelTypeChangeProcessor overrides. |
26 void Put(const std::string& storage_key, | 26 void Put(const std::string& storage_key, |
27 std::unique_ptr<EntityData> entity_data, | 27 std::unique_ptr<EntityData> entity_data, |
28 MetadataChangeList* metadata_changes) override; | 28 MetadataChangeList* metadata_changes) override; |
29 void Delete(const std::string& storage_key, | 29 void Delete(const std::string& storage_key, |
30 MetadataChangeList* metadata_changes) override; | 30 MetadataChangeList* metadata_changes) override; |
| 31 void UpdateStorageKey(const EntityData& entity_data, |
| 32 const std::string& storage_key, |
| 33 MetadataChangeList* metadata_change_list) override; |
| 34 void UntrackEntity(const EntityData& entity_data) override; |
31 void ModelReadyToSync(std::unique_ptr<MetadataBatch> batch) override; | 35 void ModelReadyToSync(std::unique_ptr<MetadataBatch> batch) override; |
32 bool IsTrackingMetadata() override; | 36 bool IsTrackingMetadata() override; |
33 | 37 |
34 void SetIsTrackingMetadata(bool is_tracking); | 38 void SetIsTrackingMetadata(bool is_tracking); |
35 | 39 |
36 const std::multimap<std::string, std::unique_ptr<EntityData>>& put_multimap() | 40 const std::multimap<std::string, std::unique_ptr<EntityData>>& put_multimap() |
37 const { | 41 const { |
38 return put_multimap_; | 42 return put_multimap_; |
39 } | 43 } |
40 | 44 |
| 45 const std::multimap<std::string, std::unique_ptr<EntityData>>& |
| 46 update_multimap() const { |
| 47 return update_multimap_; |
| 48 } |
| 49 |
41 const std::set<std::string>& delete_set() const { return delete_set_; } | 50 const std::set<std::string>& delete_set() const { return delete_set_; } |
42 | 51 |
| 52 const std::set<std::unique_ptr<EntityData>>& untrack_set() const { |
| 53 return untrack_set_; |
| 54 } |
| 55 |
43 MetadataBatch* metadata() const { return metadata_.get(); } | 56 MetadataBatch* metadata() const { return metadata_.get(); } |
44 | 57 |
45 // Returns a callback that constructs a processor and assigns a raw pointer to | 58 // Returns a callback that constructs a processor and assigns a raw pointer to |
46 // the given address. The caller must ensure that the address passed in is | 59 // the given address. The caller must ensure that the address passed in is |
47 // still valid whenever the callback is run. This can be useful for tests that | 60 // still valid whenever the callback is run. This can be useful for tests that |
48 // want to verify the RecordingModelTypeChangeProcessor was given data by the | 61 // want to verify the RecordingModelTypeChangeProcessor was given data by the |
49 // bridge they are testing. | 62 // bridge they are testing. |
50 static ModelTypeSyncBridge::ChangeProcessorFactory FactoryForBridgeTest( | 63 static ModelTypeSyncBridge::ChangeProcessorFactory FactoryForBridgeTest( |
51 RecordingModelTypeChangeProcessor** processor_address, | 64 RecordingModelTypeChangeProcessor** processor_address, |
52 bool expect_error = false); | 65 bool expect_error = false); |
53 | 66 |
54 private: | 67 private: |
55 std::multimap<std::string, std::unique_ptr<EntityData>> put_multimap_; | 68 std::multimap<std::string, std::unique_ptr<EntityData>> put_multimap_; |
| 69 std::multimap<std::string, std::unique_ptr<EntityData>> update_multimap_; |
56 std::set<std::string> delete_set_; | 70 std::set<std::string> delete_set_; |
| 71 std::set<std::unique_ptr<EntityData>> untrack_set_; |
57 std::unique_ptr<MetadataBatch> metadata_; | 72 std::unique_ptr<MetadataBatch> metadata_; |
58 bool is_tracking_metadata_ = true; | 73 bool is_tracking_metadata_ = true; |
59 }; | 74 }; |
60 | 75 |
61 } // namespace syncer | 76 } // namespace syncer |
62 | 77 |
63 #endif // COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_ | 78 #endif // COMPONENTS_SYNC_MODEL_RECORDING_MODEL_TYPE_CHANGE_PROCESSOR_H_ |
OLD | NEW |