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

Unified Diff: services/catalog/catalog.h

Issue 2651953002: Revert of [Service Manager] Get rid of dynamic service discovery (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/catalog/BUILD.gn ('k') | services/catalog/catalog.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/catalog/catalog.h
diff --git a/services/catalog/catalog.h b/services/catalog/catalog.h
index 67f6dd6a547af3a5bf8171987e6396f8370556a2..0913895961db3aba39afea8b26df77424b99f832 100644
--- a/services/catalog/catalog.h
+++ b/services/catalog/catalog.h
@@ -14,7 +14,6 @@
#include "components/filesystem/public/interfaces/directory.mojom.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/binding_set.h"
-#include "services/catalog/entry_cache.h"
#include "services/catalog/public/interfaces/catalog.mojom.h"
#include "services/service_manager/public/cpp/interface_factory.h"
#include "services/service_manager/public/cpp/service.h"
@@ -22,7 +21,8 @@
#include "services/service_manager/public/interfaces/service.mojom.h"
namespace base {
-class FilePath;
+class SequencedWorkerPool;
+class SingleThreadTaskRunner;
class Value;
}
@@ -36,8 +36,10 @@
namespace catalog {
+class EntryCache;
class Instance;
class ManifestProvider;
+class Reader;
// Creates and owns an instance of the catalog. Exposes a ServicePtr that
// can be passed to the service manager, potentially in a different process.
@@ -45,29 +47,37 @@
: public service_manager::InterfaceFactory<mojom::Catalog>,
public service_manager::InterfaceFactory<filesystem::mojom::Directory>,
public service_manager::InterfaceFactory<
- service_manager::mojom::Resolver> {
+ service_manager::mojom::Resolver>,
+ public service_manager::InterfaceFactory<mojom::CatalogControl>,
+ public mojom::CatalogControl {
public:
// Constructs a catalog over a static manifest. This catalog never performs
- // file I/O. Note that either |static_manifest| or |service_manifest_provider|
- // may be null. If both are null, no service names will be resolved.
- explicit Catalog(std::unique_ptr<base::Value> static_manifest,
- ManifestProvider* service_manifest_provider = nullptr);
+ // file I/O.
+ explicit Catalog(std::unique_ptr<base::Value> static_manifest);
+
+ // |manifest_provider| may be null.
+ Catalog(base::SequencedWorkerPool* worker_pool,
+ ManifestProvider* manifest_provider);
+ Catalog(base::SingleThreadTaskRunner* task_runner,
+ ManifestProvider* manifest_provider);
~Catalog() override;
+ // By default, "foo" resolves to a package named "foo". This allows
+ // an embedder to override that behavior for specific service names. Must be
+ // called before the catalog is connected to the ServiceManager.
+ void OverridePackageName(const std::string& service_name,
+ const std::string& package_name);
+
service_manager::mojom::ServicePtr TakeService();
-
- // Allows an embedder to override the default static manifest contents for
- // Catalog instances which are constructed with a null static manifest.
- static void SetDefaultCatalogManifest(
- std::unique_ptr<base::Value> static_manifest);
-
- // Loads a default catalog manifest from the given FilePath. |path| is taken
- // to be relative to the current executable's path.
- static void LoadDefaultCatalogManifest(const base::FilePath& path);
private:
class ServiceImpl;
+
+ Catalog();
+
+ // Starts a scane for system packages.
+ void ScanSystemPackageDir();
// service_manager::InterfaceFactory<service_manager::mojom::Resolver>:
void Create(const service_manager::Identity& remote_identity,
@@ -81,15 +91,32 @@
void Create(const service_manager::Identity& remote_identity,
filesystem::mojom::DirectoryRequest request) override;
+ // service_manager::InterfaceFactory<mojom::CatalogControl>:
+ void Create(const service_manager::Identity& remote_identity,
+ mojom::CatalogControlRequest request) override;
+
+ // mojom::CatalogControl:
+ void OverrideManifestPath(
+ const std::string& service_name,
+ const base::FilePath& path,
+ const OverrideManifestPathCallback& callback) override;
+
Instance* GetInstanceForUserId(const std::string& user_id);
+
+ void SystemPackageDirScanned();
service_manager::mojom::ServicePtr service_;
std::unique_ptr<service_manager::ServiceContext> service_context_;
- ManifestProvider* service_manifest_provider_;
- EntryCache system_cache_;
+
std::map<std::string, std::unique_ptr<Instance>> instances_;
+ std::unique_ptr<Reader> system_reader_;
+ const std::unique_ptr<EntryCache> system_cache_;
+ bool loaded_ = false;
+
scoped_refptr<filesystem::LockTable> lock_table_;
+
+ mojo::BindingSet<mojom::CatalogControl> control_bindings_;
base::WeakPtrFactory<Catalog> weak_factory_;
« no previous file with comments | « services/catalog/BUILD.gn ('k') | services/catalog/catalog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698