Chromium Code Reviews| 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_MODEL_FAKE_MODEL_TYPE_SERVICE_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_FAKE_MODEL_TYPE_SERVICE_H_ |
| 6 #define COMPONENTS_SYNC_MODEL_FAKE_MODEL_TYPE_SERVICE_H_ | 6 #define COMPONENTS_SYNC_MODEL_FAKE_MODEL_TYPE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 SyncError MergeSyncData( | 105 SyncError MergeSyncData( |
| 106 std::unique_ptr<MetadataChangeList> metadata_change_list, | 106 std::unique_ptr<MetadataChangeList> metadata_change_list, |
| 107 EntityDataMap entity_data_map) override; | 107 EntityDataMap entity_data_map) override; |
| 108 SyncError ApplySyncChanges( | 108 SyncError ApplySyncChanges( |
| 109 std::unique_ptr<MetadataChangeList> metadata_change_list, | 109 std::unique_ptr<MetadataChangeList> metadata_change_list, |
| 110 EntityChangeList entity_changes) override; | 110 EntityChangeList entity_changes) override; |
| 111 void GetData(StorageKeyList storage_keys, DataCallback callback) override; | 111 void GetData(StorageKeyList storage_keys, DataCallback callback) override; |
| 112 void GetAllData(DataCallback callback) override; | 112 void GetAllData(DataCallback callback) override; |
| 113 std::string GetClientTag(const EntityData& entity_data) override; | 113 std::string GetClientTag(const EntityData& entity_data) override; |
| 114 std::string GetStorageKey(const EntityData& entity_data) override; | 114 std::string GetStorageKey(const EntityData& entity_data) override; |
| 115 void OnChangeProcessorSet() override; | |
| 116 ConflictResolution ResolveConflict( | 115 ConflictResolution ResolveConflict( |
| 117 const EntityData& local_data, | 116 const EntityData& local_data, |
| 118 const EntityData& remote_data) const override; | 117 const EntityData& remote_data) const override; |
| 119 | 118 |
| 120 // Store a resolution for the next call to ResolveConflict. Note that if this | 119 // Store a resolution for the next call to ResolveConflict. Note that if this |
| 121 // is a USE_NEW resolution, the data will only exist for one resolve call. | 120 // is a USE_NEW resolution, the data will only exist for one resolve call. |
| 122 void SetConflictResolution(ConflictResolution resolution); | 121 void SetConflictResolution(ConflictResolution resolution); |
| 123 | 122 |
| 124 // Sets the error that the next fallible call to the service will generate. | 123 // Sets the error that the next fallible call to the service will generate. |
| 125 void SetServiceError(SyncError::ErrorType error_type); | 124 void SetServiceError(SyncError::ErrorType error_type); |
| 126 | 125 |
| 127 const Store& db() const { return db_; } | 126 Store* db() { return db_.get(); } |
|
maxbogue
2016/10/12 23:40:35
Out of curiosity, why change the signature instead
skym
2016/10/13 19:21:38
Because I wanted it to be modifiable, and my under
| |
| 128 | 127 |
| 129 protected: | 128 protected: |
| 130 // Used to verify conditions upon destruction. | 129 // Used to verify conditions upon destruction. |
| 131 virtual void CheckPostConditions(); | 130 virtual void CheckPostConditions(); |
| 132 | 131 |
| 133 // Contains all of the data and metadata state. | 132 // Contains all of the data and metadata state. |
| 134 Store db_; | 133 std::unique_ptr<Store> db_; |
| 135 | 134 |
| 136 private: | 135 private: |
| 137 // Applies |change_list| to the metadata store. | 136 // Applies |change_list| to the metadata store. |
| 138 void ApplyMetadataChangeList(std::unique_ptr<MetadataChangeList> change_list); | 137 void ApplyMetadataChangeList(std::unique_ptr<MetadataChangeList> change_list); |
| 139 | 138 |
| 140 // The conflict resolution to use for calls to ResolveConflict. | 139 // The conflict resolution to use for calls to ResolveConflict. |
| 141 std::unique_ptr<ConflictResolution> conflict_resolution_; | 140 std::unique_ptr<ConflictResolution> conflict_resolution_; |
| 142 | 141 |
| 143 // The error to produce on the next service call. | 142 // The error to produce on the next service call. |
| 144 SyncError service_error_; | 143 SyncError service_error_; |
| 145 }; | 144 }; |
| 146 | 145 |
| 147 } // namespace syncer | 146 } // namespace syncer |
| 148 | 147 |
| 149 #endif // COMPONENTS_SYNC_MODEL_FAKE_MODEL_TYPE_SERVICE_H_ | 148 #endif // COMPONENTS_SYNC_MODEL_FAKE_MODEL_TYPE_SERVICE_H_ |
| OLD | NEW |