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

Unified Diff: services/catalog/catalog.cc

Issue 1921183003: Fixes race in Shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 2 trunk Created 4 years, 8 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/catalog.h ('k') | services/catalog/reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/catalog/catalog.cc
diff --git a/services/catalog/catalog.cc b/services/catalog/catalog.cc
index 235c79e2783e643c9b033df920f9e36226ffa8fb..35f5d706a67029e8e4f1d52c8ba0f22dfb5ff18e 100644
--- a/services/catalog/catalog.cc
+++ b/services/catalog/catalog.cc
@@ -14,30 +14,43 @@
namespace catalog {
-Catalog::Catalog(base::TaskRunner* file_task_runner,
+Catalog::Catalog(base::SequencedWorkerPool* worker_pool,
std::unique_ptr<Store> store,
ManifestProvider* manifest_provider)
- : file_task_runner_(file_task_runner),
- store_(std::move(store)),
- weak_factory_(this) {
+ : Catalog(std::move(store)) {
+ system_reader_.reset(new Reader(worker_pool, manifest_provider));
+ ScanSystemPackageDir();
+}
+
+Catalog::Catalog(base::SingleThreadTaskRunner* task_runner,
+ std::unique_ptr<Store> store,
+ ManifestProvider* manifest_provider)
+ : Catalog(std::move(store)) {
+ system_reader_.reset(new Reader(task_runner, manifest_provider));
+ ScanSystemPackageDir();
+}
+
+Catalog::~Catalog() {}
+
+shell::mojom::ShellClientPtr Catalog::TakeShellClient() {
+ return std::move(shell_client_);
+}
+
+Catalog::Catalog(std::unique_ptr<Store> store)
+ : store_(std::move(store)), weak_factory_(this) {
shell::mojom::ShellClientRequest request = GetProxy(&shell_client_);
shell_connection_.reset(new shell::ShellConnection(this, std::move(request)));
+}
+void Catalog::ScanSystemPackageDir() {
base::FilePath system_package_dir;
PathService::Get(base::DIR_MODULE, &system_package_dir);
system_package_dir = system_package_dir.AppendASCII(kMojoApplicationsDirName);
- system_reader_.reset(new Reader(file_task_runner, manifest_provider));
system_reader_->Read(system_package_dir, &system_cache_,
base::Bind(&Catalog::SystemPackageDirScanned,
weak_factory_.GetWeakPtr()));
}
-Catalog::~Catalog() {}
-
-shell::mojom::ShellClientPtr Catalog::TakeShellClient() {
- return std::move(shell_client_);
-}
-
bool Catalog::AcceptConnection(shell::Connection* connection) {
connection->AddInterface<mojom::Catalog>(this);
connection->AddInterface<shell::mojom::ShellResolver>(this);
« no previous file with comments | « services/catalog/catalog.h ('k') | services/catalog/reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698