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

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

Issue 2573283002: Use a static catalog manifest for the standalone Mash runner (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
« no previous file with comments | « mash/runner/main.cc ('k') | services/catalog/catalog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CATALOG_H_ 5 #ifndef SERVICES_CATALOG_CATALOG_H_
6 #define SERVICES_CATALOG_CATALOG_H_ 6 #define SERVICES_CATALOG_CATALOG_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/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "components/filesystem/public/interfaces/directory.mojom.h" 14 #include "components/filesystem/public/interfaces/directory.mojom.h"
15 #include "mojo/public/cpp/bindings/binding.h" 15 #include "mojo/public/cpp/bindings/binding.h"
16 #include "mojo/public/cpp/bindings/binding_set.h" 16 #include "mojo/public/cpp/bindings/binding_set.h"
17 #include "services/catalog/public/interfaces/catalog.mojom.h" 17 #include "services/catalog/public/interfaces/catalog.mojom.h"
18 #include "services/catalog/types.h" 18 #include "services/catalog/types.h"
19 #include "services/service_manager/public/cpp/interface_factory.h" 19 #include "services/service_manager/public/cpp/interface_factory.h"
20 #include "services/service_manager/public/cpp/service.h" 20 #include "services/service_manager/public/cpp/service.h"
21 #include "services/service_manager/public/interfaces/resolver.mojom.h" 21 #include "services/service_manager/public/interfaces/resolver.mojom.h"
22 #include "services/service_manager/public/interfaces/service.mojom.h" 22 #include "services/service_manager/public/interfaces/service.mojom.h"
23 23
24 namespace base { 24 namespace base {
25 class SequencedWorkerPool; 25 class SequencedWorkerPool;
26 class SingleThreadTaskRunner; 26 class SingleThreadTaskRunner;
27 class Value;
27 } 28 }
28 29
29 namespace filesystem { 30 namespace filesystem {
30 class LockTable; 31 class LockTable;
31 } 32 }
32 33
33 namespace service_manager { 34 namespace service_manager {
34 class ServiceContext; 35 class ServiceContext;
35 } 36 }
36 37
37 namespace catalog { 38 namespace catalog {
38 39
39 class Instance; 40 class Instance;
40 class ManifestProvider; 41 class ManifestProvider;
41 class Reader; 42 class Reader;
42 class Store;
43 43
44 // Creates and owns an instance of the catalog. Exposes a ServicePtr that 44 // Creates and owns an instance of the catalog. Exposes a ServicePtr that
45 // can be passed to the service manager, potentially in a different process. 45 // can be passed to the service manager, potentially in a different process.
46 class Catalog 46 class Catalog
47 : public service_manager::InterfaceFactory<mojom::Catalog>, 47 : public service_manager::InterfaceFactory<mojom::Catalog>,
48 public service_manager::InterfaceFactory<filesystem::mojom::Directory>, 48 public service_manager::InterfaceFactory<filesystem::mojom::Directory>,
49 public service_manager::InterfaceFactory< 49 public service_manager::InterfaceFactory<
50 service_manager::mojom::Resolver>, 50 service_manager::mojom::Resolver>,
51 public service_manager::InterfaceFactory<mojom::CatalogControl>, 51 public service_manager::InterfaceFactory<mojom::CatalogControl>,
52 public mojom::CatalogControl { 52 public mojom::CatalogControl {
53 public: 53 public:
54 // Constructs a catalog over a static manifest. This catalog never performs
55 // file I/O.
56 explicit Catalog(std::unique_ptr<base::Value> static_manifest);
57
54 // |manifest_provider| may be null. 58 // |manifest_provider| may be null.
55 Catalog(base::SequencedWorkerPool* worker_pool, 59 Catalog(base::SequencedWorkerPool* worker_pool,
56 std::unique_ptr<Store> store,
57 ManifestProvider* manifest_provider); 60 ManifestProvider* manifest_provider);
58 Catalog(base::SingleThreadTaskRunner* task_runner, 61 Catalog(base::SingleThreadTaskRunner* task_runner,
59 std::unique_ptr<Store> store,
60 ManifestProvider* manifest_provider); 62 ManifestProvider* manifest_provider);
63
61 ~Catalog() override; 64 ~Catalog() override;
62 65
63 // By default, "foo" resolves to a package named "foo". This allows 66 // By default, "foo" resolves to a package named "foo". This allows
64 // an embedder to override that behavior for specific service names. Must be 67 // an embedder to override that behavior for specific service names. Must be
65 // called before the catalog is connected to the ServiceManager. 68 // called before the catalog is connected to the ServiceManager.
66 void OverridePackageName(const std::string& service_name, 69 void OverridePackageName(const std::string& service_name,
67 const std::string& package_name); 70 const std::string& package_name);
68 71
69 service_manager::mojom::ServicePtr TakeService(); 72 service_manager::mojom::ServicePtr TakeService();
70 73
71 private: 74 private:
72 class ServiceImpl; 75 class ServiceImpl;
73 76
74 explicit Catalog(std::unique_ptr<Store> store); 77 Catalog();
75 78
76 // Starts a scane for system packages. 79 // Starts a scane for system packages.
77 void ScanSystemPackageDir(); 80 void ScanSystemPackageDir();
78 81
79 // service_manager::InterfaceFactory<service_manager::mojom::Resolver>: 82 // service_manager::InterfaceFactory<service_manager::mojom::Resolver>:
80 void Create(const service_manager::Identity& remote_identity, 83 void Create(const service_manager::Identity& remote_identity,
81 service_manager::mojom::ResolverRequest request) override; 84 service_manager::mojom::ResolverRequest request) override;
82 85
83 // service_manager::InterfaceFactory<mojom::Catalog>: 86 // service_manager::InterfaceFactory<mojom::Catalog>:
84 void Create(const service_manager::Identity& remote_identity, 87 void Create(const service_manager::Identity& remote_identity,
(...skipping 10 matching lines...) Expand all
95 // mojom::CatalogControl: 98 // mojom::CatalogControl:
96 void OverrideManifestPath( 99 void OverrideManifestPath(
97 const std::string& service_name, 100 const std::string& service_name,
98 const base::FilePath& path, 101 const base::FilePath& path,
99 const OverrideManifestPathCallback& callback) override; 102 const OverrideManifestPathCallback& callback) override;
100 103
101 Instance* GetInstanceForUserId(const std::string& user_id); 104 Instance* GetInstanceForUserId(const std::string& user_id);
102 105
103 void SystemPackageDirScanned(); 106 void SystemPackageDirScanned();
104 107
105 std::unique_ptr<Store> store_;
106
107 service_manager::mojom::ServicePtr service_; 108 service_manager::mojom::ServicePtr service_;
108 std::unique_ptr<service_manager::ServiceContext> service_context_; 109 std::unique_ptr<service_manager::ServiceContext> service_context_;
109 110
110 std::map<std::string, std::unique_ptr<Instance>> instances_; 111 std::map<std::string, std::unique_ptr<Instance>> instances_;
111 112
112 std::unique_ptr<Reader> system_reader_; 113 std::unique_ptr<Reader> system_reader_;
113 EntryCache system_cache_; 114 EntryCache system_cache_;
114 bool loaded_ = false; 115 bool loaded_ = false;
115 116
116 scoped_refptr<filesystem::LockTable> lock_table_; 117 scoped_refptr<filesystem::LockTable> lock_table_;
117 118
118 mojo::BindingSet<mojom::CatalogControl> control_bindings_; 119 mojo::BindingSet<mojom::CatalogControl> control_bindings_;
119 120
120 base::WeakPtrFactory<Catalog> weak_factory_; 121 base::WeakPtrFactory<Catalog> weak_factory_;
121 122
122 DISALLOW_COPY_AND_ASSIGN(Catalog); 123 DISALLOW_COPY_AND_ASSIGN(Catalog);
123 }; 124 };
124 125
125 } // namespace catalog 126 } // namespace catalog
126 127
127 #endif // SERVICES_CATALOG_CATALOG_H_ 128 #endif // SERVICES_CATALOG_CATALOG_H_
OLDNEW
« no previous file with comments | « mash/runner/main.cc ('k') | services/catalog/catalog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698