Index: mojo/services/catalog/reader.h |
diff --git a/mojo/services/catalog/reader.h b/mojo/services/catalog/reader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..25bc410877fd60055b054be3c89a4681d4a90b56 |
--- /dev/null |
+++ b/mojo/services/catalog/reader.h |
@@ -0,0 +1,50 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MOJO_SERVICES_CATALOG_READER_H_ |
+#define MOJO_SERVICES_CATALOG_READER_H_ |
+ |
+#include "base/files/file_path.h" |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "mojo/services/catalog/types.h" |
+ |
+namespace base { |
+class TaskRunner; |
+} |
+ |
+namespace catalog { |
+ |
+class Reader { |
+ public: |
+ Reader(EntryCache* entry_cache, |
+ base::TaskRunner* file_task_runner, |
+ const base::FilePath& package_dir, |
+ const base::Closure& read_complete_closure); |
+ ~Reader(); |
+ |
+ // Scans |package_dir_| and reads every manifest it finds within on |
+ // |file_task_runner_|, populating |entry_cache_| on the calling thread. When |
+ // the read operation is complete, runs |read_complete_closure_|. |
+ void ReadAllManifests(); |
+ |
+ // Reads the manifest for |mojo_name|. |
+ void ReadManifestForName(const std::string& mojo_name); |
+ |
+ private: |
+ EntryCache* entry_cache_; |
+ scoped_refptr<base::TaskRunner> original_task_runner_; |
+ base::TaskRunner* file_task_runner_; |
+ base::FilePath package_dir_; |
+ base::Closure read_complete_closure_; |
+ |
+ base::WeakPtrFactory<Reader> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(Reader); |
+}; |
+ |
+} // namespace catalog |
+ |
+#endif // MOJO_SERVICES_CATALOG_READER_H_ |