Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: services/catalog/reader.h

Issue 2611183006: Service Manager: Miscellaneous catalog cleanup (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 SERVICES_CATALOG_READER_H_ 5 #ifndef SERVICES_CATALOG_READER_H_
6 #define SERVICES_CATALOG_READER_H_ 6 #define SERVICES_CATALOG_READER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "services/catalog/types.h"
17 #include "services/service_manager/public/interfaces/resolver.mojom.h" 16 #include "services/service_manager/public/interfaces/resolver.mojom.h"
18 17
19 namespace base { 18 namespace base {
20 class SequencedWorkerPool; 19 class SequencedWorkerPool;
21 class SingleThreadTaskRunner; 20 class SingleThreadTaskRunner;
22 class Value; 21 class Value;
23 } 22 }
24 23
25 namespace catalog { 24 namespace catalog {
26 25
27 class Entry; 26 class Entry;
27 class EntryCache;
28 class ManifestProvider; 28 class ManifestProvider;
29 29
30 // Responsible for loading manifests & building the Entry data structures. 30 // Responsible for loading manifests & building the Entry data structures.
31 class Reader { 31 class Reader {
32 public: 32 public:
33 using ReadManifestCallback = base::Callback<void(std::unique_ptr<Entry>)>; 33 using ReadManifestCallback = base::Callback<void(std::unique_ptr<Entry>)>;
34 using CreateEntryForNameCallback = 34 using CreateEntryForNameCallback =
35 base::Callback<void(service_manager::mojom::ResolveResultPtr)>; 35 service_manager::mojom::Resolver::ResolveServiceNameCallback;
36 36
37 // Construct a Reader over a static manifest. This Reader never performs 37 // Construct a Reader over a static manifest. This Reader never performs
38 // file I/O. 38 // file I/O.
39 Reader(std::unique_ptr<base::Value> static_manifest, EntryCache* cache); 39 Reader(std::unique_ptr<base::Value> static_manifest, EntryCache* cache);
40 40
41 Reader(base::SequencedWorkerPool* worker_pool, 41 Reader(base::SequencedWorkerPool* worker_pool,
42 ManifestProvider* manifest_provider); 42 ManifestProvider* manifest_provider);
43 Reader(base::SingleThreadTaskRunner* task_runner, 43 Reader(base::SingleThreadTaskRunner* task_runner,
44 ManifestProvider* manifest_provider); 44 ManifestProvider* manifest_provider);
45 ~Reader(); 45 ~Reader();
46 46
47 // Scans the contents of |package_dir|, reading all application manifests and 47 // Scans the contents of |package_dir|, reading all application manifests and
48 // populating |cache|. Runs |read_complete_closure| when done. 48 // populating |cache|. Runs |read_complete_closure| when done.
49 void Read(const base::FilePath& package_dir, 49 void Read(const base::FilePath& package_dir,
50 EntryCache* cache, 50 EntryCache* cache,
51 const base::Closure& read_complete_closure); 51 const base::Closure& read_complete_closure);
52 52
53 // Returns an Entry for |mojo_name| via |callback|, assuming a manifest file 53 // Returns an Entry for |name| via |callback|, assuming a manifest file in the
54 // in the canonical location 54 // canonical location
55 void CreateEntryForName( 55 void CreateEntryForName(
56 const std::string& mojo_name, 56 const std::string& name,
57 EntryCache* cache, 57 EntryCache* cache,
58 const CreateEntryForNameCallback& entry_created_callback); 58 const CreateEntryForNameCallback& entry_created_callback);
59 59
60 // Overrides the package name used for a specific service name. 60 // Overrides the package name used for a specific service name.
61 void OverridePackageName(const std::string& service_name, 61 void OverridePackageName(const std::string& service_name,
62 const std::string& package_name); 62 const std::string& package_name);
63 63
64 // Overrides the manifest path used for a specific service name. 64 // Overrides the manifest path used for a specific service name.
65 void OverrideManifestPath(const std::string& service_name, 65 void OverrideManifestPath(const std::string& service_name,
66 const base::FilePath& path); 66 const base::FilePath& path);
(...skipping 12 matching lines...) Expand all
79 std::map<std::string, std::string> package_name_overrides_; 79 std::map<std::string, std::string> package_name_overrides_;
80 std::map<std::string, base::FilePath> manifest_path_overrides_; 80 std::map<std::string, base::FilePath> manifest_path_overrides_;
81 base::WeakPtrFactory<Reader> weak_factory_; 81 base::WeakPtrFactory<Reader> weak_factory_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(Reader); 83 DISALLOW_COPY_AND_ASSIGN(Reader);
84 }; 84 };
85 85
86 } // namespace catalog 86 } // namespace catalog
87 87
88 #endif // SERVICES_CATALOG_READER_H_ 88 #endif // SERVICES_CATALOG_READER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698