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

Unified Diff: mojo/services/catalog/catalog.h

Issue 1828803002: Simplify resolve. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@61catalog
Patch Set: . Created 4 years, 9 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 | « mojo/services/catalog/BUILD.gn ('k') | mojo/services/catalog/catalog.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/catalog/catalog.h
diff --git a/mojo/services/catalog/catalog.h b/mojo/services/catalog/catalog.h
index 8f949c3219be4aecde56e63ca02e57f197eff21c..8d59b45a2caac240ef87726e317a6ce2b2112bf2 100644
--- a/mojo/services/catalog/catalog.h
+++ b/mojo/services/catalog/catalog.h
@@ -13,7 +13,6 @@
#include "mojo/services/catalog/entry.h"
#include "mojo/services/catalog/public/interfaces/catalog.mojom.h"
#include "mojo/services/catalog/public/interfaces/resolver.mojom.h"
-#include "mojo/services/catalog/reader.h"
#include "mojo/services/catalog/store.h"
#include "mojo/shell/public/cpp/interface_factory.h"
#include "mojo/shell/public/interfaces/shell_resolver.mojom.h"
@@ -22,11 +21,18 @@ namespace catalog {
class Store;
+struct ReadManifestResult {
+ ReadManifestResult();
+ ~ReadManifestResult();
+ scoped_ptr<base::Value> manifest_root;
+ base::FilePath package_dir;
+};
+
class Catalog : public mojom::Resolver,
public mojo::shell::mojom::ShellResolver,
public mojom::Catalog {
public:
- Catalog(base::TaskRunner* blocking_pool, scoped_ptr<Store> store);
+ Catalog(scoped_ptr<Store> store, base::TaskRunner* file_task_runner);
~Catalog() override;
void BindResolver(mojom::ResolverRequest request);
@@ -57,48 +63,38 @@ class Catalog : public mojom::Resolver,
void GetEntries(mojo::Array<mojo::String> names,
const GetEntriesCallback& callback) override;
- // Completes resolving a Mojo name from the Shell after the resolved name has
- // been added to the catalog and the manifest read.
- void CompleteResolveMojoName(const std::string& resolved_name,
- const std::string& qualifier,
- const ResolveMojoNameCallback& callback);
-
- bool IsNameInCatalog(const std::string& name) const;
-
// Populate/serialize the catalog from/to the supplied store.
void DeserializeCatalog();
void SerializeCatalog();
- // Callback for Reader, receives an Entry constructed from the manifest for
- // |name|.
- static void OnReadEntry(base::WeakPtr<Catalog> catalog,
- const std::string& name,
- const ResolveMojoNameCallback& callback,
- scoped_ptr<Entry> entry);
- void OnReadEntryImpl(const std::string& name,
- const ResolveMojoNameCallback& callback,
- scoped_ptr<Entry> entry);
+ // Receives the result of manifest parsing on |file_task_runner_|, may be
+ // received after the catalog object that issued the request is destroyed.
+ static void OnReadManifest(base::WeakPtr<Catalog> catalog,
+ const std::string& name,
+ const ResolveMojoNameCallback& callback,
+ scoped_ptr<ReadManifestResult> result);
- // Construct a catalog entry from |dictionary|.
- scoped_ptr<Entry> DeserializeApplication(
- const base::DictionaryValue* dictionary);
+ // Populate the catalog with data from |entry|, and pass it to the client
+ // via callback.
+ void AddEntryToCatalog(scoped_ptr<Entry> entry);
- scoped_ptr<Reader> reader_;
- base::FilePath package_path_;
+ // Directory that contains packages and executables visible to all users.
+ base::FilePath system_package_dir_;
- mojo::BindingSet<mojom::Resolver> resolver_bindings_;
- mojo::BindingSet<mojo::shell::mojom::ShellResolver> shell_resolver_bindings_;
- mojo::BindingSet<mojom::Catalog> catalog_bindings_;
+ // TODO(beng): add user package dir.
+ // User-specific persistent storage of package manifests and other settings.
scoped_ptr<Store> store_;
- std::map<std::string, Entry> catalog_;
- // Used when an app handles multiple names. Maps from app (as name) to name of
- // app that is responsible for handling it. The value is a pair of the name of
- // the handler along with a qualifier.
- MojoNameAliasMap mojo_name_aliases_;
+ // Task runner for performing file operations.
+ base::TaskRunner* file_task_runner_;
+
+ mojo::BindingSet<mojom::Resolver> resolver_bindings_;
+ mojo::BindingSet<mojo::shell::mojom::ShellResolver> shell_resolver_bindings_;
+ mojo::BindingSet<mojom::Catalog> catalog_bindings_;
- std::map<std::string, std::string> qualifiers_;
+ // Mojo name -> Entry storage, constructed from Store/package manifests.
+ std::map<std::string, scoped_ptr<Entry>> catalog_;
base::WeakPtrFactory<Catalog> weak_factory_;
« no previous file with comments | « mojo/services/catalog/BUILD.gn ('k') | mojo/services/catalog/catalog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698