| 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_IMPL_MODEL_TYPE_STORE_IMPL_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_IMPL_H_ |
| 6 #define COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_IMPL_H_ | 6 #define COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 class ModelTypeStoreBackend; | 24 class ModelTypeStoreBackend; |
| 25 | 25 |
| 26 // ModelTypeStoreImpl handles details of store initialization, threading and | 26 // ModelTypeStoreImpl handles details of store initialization, threading and |
| 27 // leveldb key formatting. Actual leveldb IO calls are performed by | 27 // leveldb key formatting. Actual leveldb IO calls are performed by |
| 28 // ModelTypeStoreBackend. | 28 // ModelTypeStoreBackend. |
| 29 class ModelTypeStoreImpl : public ModelTypeStore, public base::NonThreadSafe { | 29 class ModelTypeStoreImpl : public ModelTypeStore, public base::NonThreadSafe { |
| 30 public: | 30 public: |
| 31 ~ModelTypeStoreImpl() override; | 31 ~ModelTypeStoreImpl() override; |
| 32 | 32 |
| 33 static void CreateStore( | 33 static void CreateStore(ModelType type, |
| 34 ModelType type, | 34 const std::string& path, |
| 35 const std::string& path, | 35 const InitCallback& callback); |
| 36 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner, | |
| 37 const InitCallback& callback); | |
| 38 static void CreateInMemoryStoreForTest(ModelType type, | 36 static void CreateInMemoryStoreForTest(ModelType type, |
| 39 const InitCallback& callback); | 37 const InitCallback& callback); |
| 40 | 38 |
| 41 // ModelTypeStore implementation. | 39 // ModelTypeStore implementation. |
| 42 void ReadData(const IdList& id_list, | 40 void ReadData(const IdList& id_list, |
| 43 const ReadDataCallback& callback) override; | 41 const ReadDataCallback& callback) override; |
| 44 void ReadAllData(const ReadAllDataCallback& callback) override; | 42 void ReadAllData(const ReadAllDataCallback& callback) override; |
| 45 void ReadAllMetadata(const ReadMetadataCallback& callback) override; | 43 void ReadAllMetadata(const ReadMetadataCallback& callback) override; |
| 46 std::unique_ptr<WriteBatch> CreateWriteBatch() override; | 44 std::unique_ptr<WriteBatch> CreateWriteBatch() override; |
| 47 void CommitWriteBatch(std::unique_ptr<WriteBatch> write_batch, | 45 void CommitWriteBatch(std::unique_ptr<WriteBatch> write_batch, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 121 |
| 124 // Key for this type's global metadata record. | 122 // Key for this type's global metadata record. |
| 125 const std::string global_metadata_key_; | 123 const std::string global_metadata_key_; |
| 126 | 124 |
| 127 base::WeakPtrFactory<ModelTypeStoreImpl> weak_ptr_factory_; | 125 base::WeakPtrFactory<ModelTypeStoreImpl> weak_ptr_factory_; |
| 128 }; | 126 }; |
| 129 | 127 |
| 130 } // namespace syncer | 128 } // namespace syncer |
| 131 | 129 |
| 132 #endif // COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_IMPL_H_ | 130 #endif // COMPONENTS_SYNC_MODEL_IMPL_MODEL_TYPE_STORE_IMPL_H_ |
| OLD | NEW |