OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_SERVICES_CATALOG_READER_H_ |
| 6 #define MOJO_SERVICES_CATALOG_READER_H_ |
| 7 |
| 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "mojo/services/catalog/types.h" |
| 13 |
| 14 namespace base { |
| 15 class TaskRunner; |
| 16 } |
| 17 |
| 18 namespace catalog { |
| 19 |
| 20 class Reader { |
| 21 public: |
| 22 Reader(EntryCache* entry_cache, |
| 23 base::TaskRunner* file_task_runner, |
| 24 const base::FilePath& package_dir, |
| 25 const base::Closure& read_complete_closure); |
| 26 ~Reader(); |
| 27 |
| 28 // Scans |package_dir_| and reads every manifest it finds within on |
| 29 // |file_task_runner_|, populating |entry_cache_| on the calling thread. When |
| 30 // the read operation is complete, runs |read_complete_closure_|. |
| 31 void ReadAllManifests(); |
| 32 |
| 33 // Reads the manifest for |mojo_name|. |
| 34 void ReadManifestForName(const std::string& mojo_name); |
| 35 |
| 36 private: |
| 37 EntryCache* entry_cache_; |
| 38 scoped_refptr<base::TaskRunner> original_task_runner_; |
| 39 base::TaskRunner* file_task_runner_; |
| 40 base::FilePath package_dir_; |
| 41 base::Closure read_complete_closure_; |
| 42 |
| 43 base::WeakPtrFactory<Reader> weak_factory_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(Reader); |
| 46 }; |
| 47 |
| 48 } // namespace catalog |
| 49 |
| 50 #endif // MOJO_SERVICES_CATALOG_READER_H_ |
OLD | NEW |