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_MODEL_TYPE_STORE_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_MODEL_TYPE_STORE_H_ |
6 #define COMPONENTS_SYNC_MODEL_MODEL_TYPE_STORE_H_ | 6 #define COMPONENTS_SYNC_MODEL_MODEL_TYPE_STORE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 private: | 99 private: |
100 // A pointer to the store that generated this WriteBatch. | 100 // A pointer to the store that generated this WriteBatch. |
101 ModelTypeStore* store_; | 101 ModelTypeStore* store_; |
102 | 102 |
103 // A MetadataChangeList that is being used to pass changes directly into the | 103 // A MetadataChangeList that is being used to pass changes directly into the |
104 // WriteBatch. Only accessible via GetMetadataChangeList(), and not created | 104 // WriteBatch. Only accessible via GetMetadataChangeList(), and not created |
105 // unless necessary. | 105 // unless necessary. |
106 std::unique_ptr<MetadataChangeList> metadata_change_list_; | 106 std::unique_ptr<MetadataChangeList> metadata_change_list_; |
107 }; | 107 }; |
108 | 108 |
109 typedef std::vector<Record> RecordList; | 109 using RecordList = std::vector<Record>; |
110 typedef std::vector<std::string> IdList; | 110 using IdList = std::vector<std::string>; |
111 | 111 |
112 typedef base::Callback<void(Result result, | 112 using InitCallback = |
113 std::unique_ptr<ModelTypeStore> store)> | 113 base::Callback<void(Result result, |
114 InitCallback; | 114 std::unique_ptr<ModelTypeStore> store)>; |
115 typedef base::Callback<void(Result result)> CallbackWithResult; | 115 using CallbackWithResult = base::Callback<void(Result result)>; |
116 typedef base::Callback<void(Result result, | 116 using ReadDataCallback = |
117 std::unique_ptr<RecordList> data_records, | 117 base::Callback<void(Result result, |
118 std::unique_ptr<IdList> missing_id_list)> | 118 std::unique_ptr<RecordList> data_records, |
119 ReadDataCallback; | 119 std::unique_ptr<IdList> missing_id_list)>; |
120 typedef base::Callback<void(Result result, | 120 using ReadAllDataCallback = |
121 std::unique_ptr<RecordList> data_records)> | 121 base::Callback<void(Result result, |
122 ReadAllDataCallback; | 122 std::unique_ptr<RecordList> data_records)>; |
123 typedef base::Callback<void(base::Optional<ModelError> error, | 123 using ReadMetadataCallback = |
124 std::unique_ptr<MetadataBatch> metadata_batch)> | 124 base::Callback<void(base::Optional<ModelError> error, |
125 ReadMetadataCallback; | 125 std::unique_ptr<MetadataBatch> metadata_batch)>; |
126 | 126 |
127 // CreateStore takes |path| and |blocking_task_runner|. Here is how to get | 127 // CreateStore takes |path| and |blocking_task_runner|. Here is how to get |
128 // task runner in production code: | 128 // task runner in production code: |
129 // | 129 // |
130 // base::SequencedWorkerPool* worker_pool = | 130 // base::SequencedWorkerPool* worker_pool = |
131 // content::BrowserThread::GetBlockingPool(); | 131 // content::BrowserThread::GetBlockingPool(); |
132 // scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( | 132 // scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( |
133 // worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 133 // worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
134 // worker_pool->GetSequenceToken(), | 134 // worker_pool->GetSequenceToken(), |
135 // base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 135 // base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // It will delete all metadata records and global metadata record. | 195 // It will delete all metadata records and global metadata record. |
196 }; | 196 }; |
197 | 197 |
198 // Typedef for a store factory that has all params bound except InitCallback. | 198 // Typedef for a store factory that has all params bound except InitCallback. |
199 using ModelTypeStoreFactory = | 199 using ModelTypeStoreFactory = |
200 base::Callback<void(const ModelTypeStore::InitCallback&)>; | 200 base::Callback<void(const ModelTypeStore::InitCallback&)>; |
201 | 201 |
202 } // namespace syncer | 202 } // namespace syncer |
203 | 203 |
204 #endif // COMPONENTS_SYNC_MODEL_MODEL_TYPE_STORE_H_ | 204 #endif // COMPONENTS_SYNC_MODEL_MODEL_TYPE_STORE_H_ |
OLD | NEW |