OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_LEVELDB_PROTO_PROTO_DATABASE_IMPL_H_ | 5 #ifndef COMPONENTS_LEVELDB_PROTO_PROTO_DATABASE_IMPL_H_ |
6 #define COMPONENTS_LEVELDB_PROTO_PROTO_DATABASE_IMPL_H_ | 6 #define COMPONENTS_LEVELDB_PROTO_PROTO_DATABASE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 // All blocking calls/disk access will happen on the provided |task_runner|. | 34 // All blocking calls/disk access will happen on the provided |task_runner|. |
35 explicit ProtoDatabaseImpl( | 35 explicit ProtoDatabaseImpl( |
36 scoped_refptr<base::SequencedTaskRunner> task_runner); | 36 scoped_refptr<base::SequencedTaskRunner> task_runner); |
37 | 37 |
38 virtual ~ProtoDatabaseImpl(); | 38 virtual ~ProtoDatabaseImpl(); |
39 | 39 |
40 // ProtoDatabase implementation. | 40 // ProtoDatabase implementation. |
41 // TODO(cjhopman): Perhaps Init() shouldn't be exposed to users and not just | 41 // TODO(cjhopman): Perhaps Init() shouldn't be exposed to users and not just |
42 // part of the constructor | 42 // part of the constructor |
43 virtual void Init(const base::FilePath& database_dir, | 43 virtual void Init(const base::FilePath& database_dir, |
44 typename ProtoDatabase<T>::InitCallback callback) OVERRIDE; | 44 typename ProtoDatabase<T>::InitCallback callback) override; |
45 virtual void UpdateEntries( | 45 virtual void UpdateEntries( |
46 scoped_ptr<typename ProtoDatabase<T>::KeyEntryVector> entries_to_save, | 46 scoped_ptr<typename ProtoDatabase<T>::KeyEntryVector> entries_to_save, |
47 scoped_ptr<KeyVector> keys_to_remove, | 47 scoped_ptr<KeyVector> keys_to_remove, |
48 typename ProtoDatabase<T>::UpdateCallback callback) OVERRIDE; | 48 typename ProtoDatabase<T>::UpdateCallback callback) override; |
49 virtual void LoadEntries( | 49 virtual void LoadEntries( |
50 typename ProtoDatabase<T>::LoadCallback callback) OVERRIDE; | 50 typename ProtoDatabase<T>::LoadCallback callback) override; |
51 | 51 |
52 // Allow callers to provide their own Database implementation. | 52 // Allow callers to provide their own Database implementation. |
53 void InitWithDatabase(scoped_ptr<LevelDB> database, | 53 void InitWithDatabase(scoped_ptr<LevelDB> database, |
54 const base::FilePath& database_dir, | 54 const base::FilePath& database_dir, |
55 typename ProtoDatabase<T>::InitCallback callback); | 55 typename ProtoDatabase<T>::InitCallback callback); |
56 | 56 |
57 private: | 57 private: |
58 base::ThreadChecker thread_checker_; | 58 base::ThreadChecker thread_checker_; |
59 | 59 |
60 // Used to run blocking tasks in-order. | 60 // Used to run blocking tasks in-order. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 task_runner_->PostTaskAndReply( | 196 task_runner_->PostTaskAndReply( |
197 FROM_HERE, base::Bind(LoadEntriesFromTaskRunner<T>, | 197 FROM_HERE, base::Bind(LoadEntriesFromTaskRunner<T>, |
198 base::Unretained(db_.get()), entries_ptr, success), | 198 base::Unretained(db_.get()), entries_ptr, success), |
199 base::Bind(RunLoadCallback<T>, callback, base::Owned(success), | 199 base::Bind(RunLoadCallback<T>, callback, base::Owned(success), |
200 base::Passed(&entries))); | 200 base::Passed(&entries))); |
201 } | 201 } |
202 | 202 |
203 } // namespace leveldb_proto | 203 } // namespace leveldb_proto |
204 | 204 |
205 #endif // COMPONENTS_LEVELDB_PROTO_PROTO_DATABASE_IMPL_H_ | 205 #endif // COMPONENTS_LEVELDB_PROTO_PROTO_DATABASE_IMPL_H_ |
OLD | NEW |