| Index: components/safe_browsing_db/v4_database.h
|
| diff --git a/components/safe_browsing_db/v4_database.h b/components/safe_browsing_db/v4_database.h
|
| index 509939e68be6366928a21ca4071958d50fb574b7..26dd599d90ba1bad8da029093f56d72124c93e48 100644
|
| --- a/components/safe_browsing_db/v4_database.h
|
| +++ b/components/safe_browsing_db/v4_database.h
|
| @@ -15,6 +15,9 @@ namespace safe_browsing {
|
|
|
| class V4Database;
|
|
|
| +typedef base::Callback<void(std::unique_ptr<V4Database>)>
|
| + NewDatabaseReadyCallback;
|
| +
|
| typedef const base::hash_map<UpdateListIdentifier,
|
| const base::FilePath::CharType>
|
| ListInfoMap;
|
| @@ -44,17 +47,17 @@ class V4DatabaseFactory {
|
| class V4Database {
|
| public:
|
| // Factory method for obtaining a V4Database implementation.
|
| - // It is not thread safe.
|
| - // The availability of each list is controlled by the one flag on this
|
| - // method.
|
| - static V4Database* Create(
|
| + // Posts a task on the provided task runner to create the object.
|
| + // Once the database object has been created, it schedules the callback
|
| + // function on the IO thread.
|
| + static void Create(
|
| const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
|
| const base::FilePath& base_path,
|
| - ListInfoMap list_info_map);
|
| + ListInfoMap list_info_map,
|
| + NewDatabaseReadyCallback callback);
|
|
|
| - V4Database(
|
| - const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
|
| - StoreMap store_map);
|
| + V4Database(const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
|
| + StoreMap store_map);
|
| virtual ~V4Database();
|
|
|
| // Deletes the current database and creates a new one.
|
| @@ -67,6 +70,20 @@ class V4Database {
|
| }
|
|
|
| private:
|
| + // Factory method for obtaining a V4Database implementation.
|
| + // Once the database object has been created, it schedules the callback
|
| + // function on the IO thread.
|
| + static void CreateOnTaskRunner(
|
| + const scoped_refptr<base::SequencedTaskRunner>& db_task_runner,
|
| + const base::FilePath& base_path,
|
| + ListInfoMap list_info_map,
|
| + NewDatabaseReadyCallback callback);
|
| +
|
| + const scoped_refptr<base::SequencedTaskRunner> db_task_runner_;
|
| +
|
| + // Map of UpdateListIdentifier to the V4Store.
|
| + StoreMap store_map_;
|
| +
|
| // The factory that controls the creation of V4Database objects.
|
| // This is used *only* by tests.
|
| static V4DatabaseFactory* factory_;
|
|
|