diff options
author | ben <ben@chromium.org> | 2016-03-14 15:48:48 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-14 22:50:25 +0000 |
commit | 1693cacfdda556be0d56381104055f12829b6772 (patch) | |
tree | 413c145794603a1b624e3e214890c4ae397dbcfd | |
parent | f755705a429d313d57c012895adb033aba5c4529 (diff) | |
download | chromium_src-1693cacfdda556be0d56381104055f12829b6772.zip chromium_src-1693cacfdda556be0d56381104055f12829b6772.tar.gz chromium_src-1693cacfdda556be0d56381104055f12829b6772.tar.bz2 |
Allow Catalogs to be constructed per-user
BUG=
Review URL: https://codereview.chromium.org/1791663002
Cr-Commit-Position: refs/heads/master@{#381099}
-rw-r--r-- | content/browser/mojo/mojo_shell_context.cc | 4 | ||||
-rw-r--r-- | content/browser/mojo/mojo_shell_context.h | 4 | ||||
-rw-r--r-- | mojo/mojo_shell.gyp | 4 | ||||
-rw-r--r-- | mojo/services/catalog/BUILD.gn | 4 | ||||
-rw-r--r-- | mojo/services/catalog/catalog.cc | 39 | ||||
-rw-r--r-- | mojo/services/catalog/catalog.h | 33 | ||||
-rw-r--r-- | mojo/services/catalog/factory.cc | 66 | ||||
-rw-r--r-- | mojo/services/catalog/factory.h | 80 | ||||
-rw-r--r-- | mojo/services/catalog/owner.cc | 24 | ||||
-rw-r--r-- | mojo/services/catalog/owner.h | 44 | ||||
-rw-r--r-- | mojo/shell/background/tests/test_service.cc | 7 | ||||
-rw-r--r-- | mojo/shell/runner/host/native_application_support.cc | 2 | ||||
-rw-r--r-- | mojo/shell/shell.cc | 36 | ||||
-rw-r--r-- | mojo/shell/shell.h | 5 | ||||
-rw-r--r-- | mojo/shell/standalone/context.cc | 4 | ||||
-rw-r--r-- | mojo/shell/standalone/context.h | 4 | ||||
-rw-r--r-- | mojo/shell/tests/loader_unittest.cc | 8 |
17 files changed, 224 insertions, 144 deletions
diff --git a/content/browser/mojo/mojo_shell_context.cc b/content/browser/mojo/mojo_shell_context.cc index 91fdf54..6c1e7a7 100644 --- a/content/browser/mojo/mojo_shell_context.cc +++ b/content/browser/mojo/mojo_shell_context.cc @@ -25,7 +25,7 @@ #include "content/public/common/service_registry.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/string.h" -#include "mojo/services/catalog/owner.h" +#include "mojo/services/catalog/factory.h" #include "mojo/services/catalog/store.h" #include "mojo/shell/connect_params.h" #include "mojo/shell/loader.h" @@ -207,7 +207,7 @@ MojoShellContext::MojoShellContext() { scoped_ptr<mojo::shell::NativeRunnerFactory> native_runner_factory( new mojo::shell::InProcessNativeRunnerFactory( BrowserThread::GetBlockingPool())); - catalog_.reset(new catalog::Owner(file_task_runner.get(), nullptr)); + catalog_.reset(new catalog::Factory(file_task_runner.get(), nullptr)); shell_.reset(new mojo::shell::Shell(std::move(native_runner_factory), catalog_->TakeShellClient())); diff --git a/content/browser/mojo/mojo_shell_context.h b/content/browser/mojo/mojo_shell_context.h index bc71c96..3560364 100644 --- a/content/browser/mojo/mojo_shell_context.h +++ b/content/browser/mojo/mojo_shell_context.h @@ -17,7 +17,7 @@ #include "mojo/shell/shell.h" namespace catalog { -class Owner; +class Factory; } namespace mojo { @@ -62,7 +62,7 @@ class CONTENT_EXPORT MojoShellContext { static base::LazyInstance<scoped_ptr<Proxy>> proxy_; - scoped_ptr<catalog::Owner> catalog_; + scoped_ptr<catalog::Factory> catalog_; scoped_ptr<mojo::shell::Shell> shell_; DISALLOW_COPY_AND_ASSIGN(MojoShellContext); diff --git a/mojo/mojo_shell.gyp b/mojo/mojo_shell.gyp index a5a65ad..9e2e5ee 100644 --- a/mojo/mojo_shell.gyp +++ b/mojo/mojo_shell.gyp @@ -13,8 +13,8 @@ 'services/catalog/catalog.h', 'services/catalog/entry.cc', 'services/catalog/entry.h', - 'services/catalog/owner.cc', - 'services/catalog/owner.h', + 'services/catalog/factory.cc', + 'services/catalog/factory.h', 'services/catalog/store.cc', 'services/catalog/store.h', 'shell/loader.h', diff --git a/mojo/services/catalog/BUILD.gn b/mojo/services/catalog/BUILD.gn index c958317..d81fde3 100644 --- a/mojo/services/catalog/BUILD.gn +++ b/mojo/services/catalog/BUILD.gn @@ -21,8 +21,8 @@ source_set("lib") { "catalog.h", "entry.cc", "entry.h", - "owner.cc", - "owner.h", + "factory.cc", + "factory.h", "store.cc", "store.h", ] diff --git a/mojo/services/catalog/catalog.cc b/mojo/services/catalog/catalog.cc index ba6bcfe..d02e1fe 100644 --- a/mojo/services/catalog/catalog.cc +++ b/mojo/services/catalog/catalog.cc @@ -30,10 +30,12 @@ scoped_ptr<base::Value> ReadManifest(const base::FilePath& manifest_path) { } // namespace -Catalog::Catalog(base::TaskRunner* blocking_pool, - scoped_ptr<Store> catalog) +//////////////////////////////////////////////////////////////////////////////// +// Catalog, public: + +Catalog::Catalog(base::TaskRunner* blocking_pool, scoped_ptr<Store> store) : blocking_pool_(blocking_pool), - store_(std::move(catalog)), + store_(std::move(store)), weak_factory_(this) { base::FilePath shell_dir; PathService::Get(base::DIR_MODULE, &shell_dir); @@ -45,31 +47,25 @@ Catalog::Catalog(base::TaskRunner* blocking_pool, DeserializeCatalog(); } -Catalog::~Catalog() {} -bool Catalog::AcceptConnection(mojo::Connection* connection) { - connection->AddInterface<mojom::Catalog>(this); - connection->AddInterface<mojom::Resolver>(this); - if (connection->GetRemoteIdentity().name() == "mojo:shell") - connection->AddInterface<mojo::shell::mojom::ShellResolver>(this); - return true; -} +Catalog::~Catalog() {} -void Catalog::Create(mojo::Connection* connection, - mojom::ResolverRequest request) { +void Catalog::BindResolver(mojom::ResolverRequest request) { resolver_bindings_.AddBinding(this, std::move(request)); } -void Catalog::Create(mojo::Connection* connection, - mojo::shell::mojom::ShellResolverRequest request) { +void Catalog::BindShellResolver( + mojo::shell::mojom::ShellResolverRequest request) { shell_resolver_bindings_.AddBinding(this, std::move(request)); } -void Catalog::Create(mojo::Connection* connection, - mojom::CatalogRequest request) { +void Catalog::BindCatalog(mojom::CatalogRequest request) { catalog_bindings_.AddBinding(this, std::move(request)); } +//////////////////////////////////////////////////////////////////////////////// +// Catalog, mojom::Resolver: + void Catalog::ResolveResponse(mojo::URLResponsePtr response, const ResolveResponseCallback& callback) { // TODO(beng): implement. @@ -91,6 +87,9 @@ void Catalog::ResolveProtocolScheme( // TODO(beng): implement. } +//////////////////////////////////////////////////////////////////////////////// +// Catalog, mojo::shell::mojom::ShellResolver: + void Catalog::ResolveMojoName(const mojo::String& mojo_name, const ResolveMojoNameCallback& callback) { std::string resolved_name = mojo_name; @@ -109,6 +108,9 @@ void Catalog::ResolveMojoName(const mojo::String& mojo_name, AddNameToCatalog(resolved_name, callback); } +//////////////////////////////////////////////////////////////////////////////// +// Catalog, mojom::Catalog: + void Catalog::GetEntries(mojo::Array<mojo::String> names, const GetEntriesCallback& callback) { mojo::Map<mojo::String, mojom::CatalogEntryPtr> entries; @@ -124,6 +126,9 @@ void Catalog::GetEntries(mojo::Array<mojo::String> names, callback.Run(std::move(entries)); } +//////////////////////////////////////////////////////////////////////////////// +// Catalog, private: + void Catalog::CompleteResolveMojoName( const std::string& resolved_name, const std::string& qualifier, diff --git a/mojo/services/catalog/catalog.h b/mojo/services/catalog/catalog.h index 06ae712..dd0e53a 100644 --- a/mojo/services/catalog/catalog.h +++ b/mojo/services/catalog/catalog.h @@ -15,7 +15,6 @@ #include "mojo/services/catalog/public/interfaces/resolver.mojom.h" #include "mojo/services/catalog/store.h" #include "mojo/shell/public/cpp/interface_factory.h" -#include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/public/interfaces/shell_resolver.mojom.h" #include "url/gurl.h" @@ -23,39 +22,21 @@ namespace catalog { class Store; -class Catalog - : public mojo::ShellClient, - public mojo::InterfaceFactory<mojom::Resolver>, - public mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver>, - public mojo::InterfaceFactory<mojom::Catalog>, - public mojom::Resolver, - public mojo::shell::mojom::ShellResolver, - public mojom::Catalog { +class Catalog : public mojom::Resolver, + public mojo::shell::mojom::ShellResolver, + public mojom::Catalog { public: - // If |register_schemes| is true, mojo: and exe: schemes are registered as - // "standard". Catalog(base::TaskRunner* blocking_pool, scoped_ptr<Store> store); ~Catalog() override; + void BindResolver(mojom::ResolverRequest request); + void BindShellResolver(mojo::shell::mojom::ShellResolverRequest request); + void BindCatalog(mojom::CatalogRequest request); + private: using MojoNameAliasMap = std::map<std::string, std::pair<std::string, std::string>>; - // mojo::ShellClient: - bool AcceptConnection(mojo::Connection* connection) override; - - // mojo::InterfaceFactory<mojom::Resolver>: - void Create(mojo::Connection* connection, - mojom::ResolverRequest request) override; - - // mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver>: - void Create(mojo::Connection* connection, - mojo::shell::mojom::ShellResolverRequest request) override; - - // mojo::InterfaceFactory<mojom::Catalog>: - void Create(mojo::Connection* connection, - mojom::CatalogRequest request) override; - // mojom::Resolver: void ResolveResponse( mojo::URLResponsePtr response, diff --git a/mojo/services/catalog/factory.cc b/mojo/services/catalog/factory.cc new file mode 100644 index 0000000..7087af7 --- /dev/null +++ b/mojo/services/catalog/factory.cc @@ -0,0 +1,66 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/services/catalog/factory.h" + +#include "base/bind.h" +#include "mojo/services/catalog/catalog.h" +#include "mojo/shell/public/cpp/connection.h" +#include "mojo/shell/public/cpp/shell_connection.h" + +namespace catalog { + +Factory::Factory(base::TaskRunner* file_task_runner, scoped_ptr<Store> store) + : file_task_runner_(file_task_runner), + store_(std::move(store)), + weak_factory_(this) { + mojo::shell::mojom::ShellClientRequest request = GetProxy(&shell_client_); + shell_connection_.reset(new mojo::ShellConnection(this, std::move(request))); +} +Factory::~Factory() {} + +mojo::shell::mojom::ShellClientPtr Factory::TakeShellClient() { + return std::move(shell_client_); +} + +bool Factory::AcceptConnection(mojo::Connection* connection) { + connection->AddInterface<mojom::Catalog>(this); + connection->AddInterface<mojom::Resolver>(this); + connection->AddInterface<mojo::shell::mojom::ShellResolver>(this); + return true; +} + +void Factory::Create(mojo::Connection* connection, + mojom::ResolverRequest request) { + Catalog* instance = + GetCatalogForUserId(connection->GetRemoteIdentity().user_id()); + instance->BindResolver(std::move(request)); +} + +void Factory::Create(mojo::Connection* connection, + mojo::shell::mojom::ShellResolverRequest request) { + Catalog* instance = + GetCatalogForUserId(connection->GetRemoteIdentity().user_id()); + instance->BindShellResolver(std::move(request)); +} + +void Factory::Create(mojo::Connection* connection, + mojom::CatalogRequest request) { + Catalog* instance = + GetCatalogForUserId(connection->GetRemoteIdentity().user_id()); + instance->BindCatalog(std::move(request)); +} + +Catalog* Factory::GetCatalogForUserId(const std::string& user_id) { + auto it = catalogs_.find(user_id); + if (it != catalogs_.end()) + return it->second.get(); + + // TODO(beng): There needs to be a way to load the store from different users. + Catalog* instance = new Catalog(file_task_runner_, std::move(store_)); + catalogs_[user_id] = make_scoped_ptr(instance); + return instance; +} + +} // namespace catalog diff --git a/mojo/services/catalog/factory.h b/mojo/services/catalog/factory.h new file mode 100644 index 0000000..545acf3 --- /dev/null +++ b/mojo/services/catalog/factory.h @@ -0,0 +1,80 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_SERVICES_CATALOG_FACTORY_H_ +#define MOJO_SERVICES_CATALOG_FACTORY_H_ + +#include <map> +#include <string> + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "base/memory/weak_ptr.h" +#include "mojo/public/cpp/bindings/binding.h" +#include "mojo/services/catalog/public/interfaces/catalog.mojom.h" +#include "mojo/services/catalog/public/interfaces/resolver.mojom.h" +#include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" +#include "mojo/shell/public/interfaces/shell_resolver.mojom.h" + +namespace base { +class TaskRunner; +} + +namespace mojo{ +class ShellConnection; +} + +namespace catalog { + +class Catalog; +class Store; + +// Creates and owns an instance of the catalog. Exposes a ShellClientPtr that +// can be passed to the Shell, potentially in a different process. +class Factory + : public mojo::ShellClient, + public mojo::InterfaceFactory<mojom::Catalog>, + public mojo::InterfaceFactory<mojom::Resolver>, + public mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver> { + public: + Factory(base::TaskRunner* file_task_runner, scoped_ptr<Store> store); + ~Factory() override; + + mojo::shell::mojom::ShellClientPtr TakeShellClient(); + + private: + // mojo::ShellClient: + bool AcceptConnection(mojo::Connection* connection) override; + + // mojo::InterfaceFactory<mojom::Resolver>: + void Create(mojo::Connection* connection, + mojom::ResolverRequest request) override; + + // mojo::InterfaceFactory<mojo::shell::mojom::ShellResolver>: + void Create(mojo::Connection* connection, + mojo::shell::mojom::ShellResolverRequest request) override; + + // mojo::InterfaceFactory<mojom::Catalog>: + void Create(mojo::Connection* connection, + mojom::CatalogRequest request) override; + + Catalog* GetCatalogForUserId(const std::string& user_id); + + base::TaskRunner* file_task_runner_; + scoped_ptr<Store> store_; + + mojo::shell::mojom::ShellClientPtr shell_client_; + scoped_ptr<mojo::ShellConnection> shell_connection_; + + std::map<std::string, scoped_ptr<Catalog>> catalogs_; + + base::WeakPtrFactory<Factory> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(Factory); +}; + +} // namespace catalog + +#endif // MOJO_SERVICES_CATALOG_FACTORY_H_ diff --git a/mojo/services/catalog/owner.cc b/mojo/services/catalog/owner.cc deleted file mode 100644 index 7d24cfa..0000000 --- a/mojo/services/catalog/owner.cc +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/services/catalog/owner.h" - -#include "mojo/services/catalog/catalog.h" -#include "mojo/shell/public/cpp/shell_connection.h" - -namespace catalog { - -Owner::Owner(base::TaskRunner* file_task_runner, scoped_ptr<Store> store) - : catalog_shell_client_(new Catalog(file_task_runner, std::move(store))) { - mojo::shell::mojom::ShellClientRequest request = GetProxy(&shell_client_); - catalog_connection_.reset(new mojo::ShellConnection( - catalog_shell_client_.get(), std::move(request))); -} -Owner::~Owner() {} - -mojo::shell::mojom::ShellClientPtr Owner::TakeShellClient() { - return std::move(shell_client_); -} - -} // namespace catalog diff --git a/mojo/services/catalog/owner.h b/mojo/services/catalog/owner.h deleted file mode 100644 index c399459..0000000 --- a/mojo/services/catalog/owner.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_SERVICES_CATALOG_OWNER_H_ -#define MOJO_SERVICES_CATALOG_OWNER_H_ - -#include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "mojo/shell/public/interfaces/shell_client.mojom.h" - -namespace base { -class TaskRunner; -} - -namespace mojo{ -class ShellClient; -class ShellConnection; -} - -namespace catalog { - -class Store; - -// Creates and owns an instance of the catalog. Exposes a ShellClientPtr that -// can be passed to the Shell, potentially in a different process. -class Owner { - public: - Owner(base::TaskRunner* file_task_runner, scoped_ptr<Store> store); - ~Owner(); - - mojo::shell::mojom::ShellClientPtr TakeShellClient(); - - private: - mojo::shell::mojom::ShellClientPtr shell_client_; - scoped_ptr<mojo::ShellClient> catalog_shell_client_; - scoped_ptr<mojo::ShellConnection> catalog_connection_; - - DISALLOW_COPY_AND_ASSIGN(Owner); -}; - -} // namespace catalog - -#endif // MOJO_SERVICES_CATALOG_OWNER_H_ diff --git a/mojo/shell/background/tests/test_service.cc b/mojo/shell/background/tests/test_service.cc index 8b68c59..d030a81 100644 --- a/mojo/shell/background/tests/test_service.cc +++ b/mojo/shell/background/tests/test_service.cc @@ -25,6 +25,9 @@ class TestClient : public ShellClient, connection->AddInterface(this); return true; } + void ShellConnectionLost() override { + base::MessageLoop::current()->QuitWhenIdle(); + } // InterfaceFactory<mojom::TestService>: void Create(Connection* connection, @@ -33,7 +36,9 @@ class TestClient : public ShellClient, } // mojom::TestService - void Test(const TestCallback& callback) override { callback.Run(); } + void Test(const TestCallback& callback) override { + callback.Run(); + } BindingSet<mojom::TestService> bindings_; diff --git a/mojo/shell/runner/host/native_application_support.cc b/mojo/shell/runner/host/native_application_support.cc index de1293b..19a255f 100644 --- a/mojo/shell/runner/host/native_application_support.cc +++ b/mojo/shell/runner/host/native_application_support.cc @@ -45,7 +45,7 @@ base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path) { base::NativeLibraryLoadError error; base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); LOG_IF(ERROR, !app_library) - << "Failed to load app library (error: " << error.ToString() << ")"; + << "Failed to load app library (path: " << app_path.value() << ")"; return app_library; } diff --git a/mojo/shell/shell.cc b/mojo/shell/shell.cc index 8056a60..48370a3 100644 --- a/mojo/shell/shell.cc +++ b/mojo/shell/shell.cc @@ -51,6 +51,10 @@ Identity CreateShellIdentity() { return Identity(kShellName, mojom::kRootUserID); } +Identity CreateCatalogIdentity() { + return Identity(kCatalogName, mojom::kRootUserID); +} + CapabilitySpec GetPermissiveCapabilities() { CapabilitySpec capabilities; CapabilityRequest spec; @@ -488,16 +492,14 @@ bool Shell::AcceptConnection(Connection* connection) { // Shell, private: void Shell::InitCatalog(mojom::ShellClientPtr catalog) { - Identity identity(kCatalogName, mojom::kRootUserID); - CreateInstance(identity, CapabilitySpec(), std::move(catalog)); - shell_connection_->connector()->ConnectToInterface( - kCatalogName, &shell_resolver_); + CreateInstance(CreateCatalogIdentity(), CapabilitySpec(), std::move(catalog)); + // TODO(beng): this doesn't work anymore. // Seed the catalog with manifest info for the shell & catalog. - shell_resolver_->ResolveMojoName( - kCatalogName, base::Bind(&EmptyResolverCallback)); - shell_resolver_->ResolveMojoName( - kShellName, base::Bind(&EmptyResolverCallback)); + mojo::shell::mojom::ShellResolverPtr resolver; + shell_connection_->connector()->ConnectToInterface(kCatalogName, &resolver); + resolver->ResolveMojoName(kCatalogName, base::Bind(&EmptyResolverCallback)); + resolver->ResolveMojoName(kShellName, base::Bind(&EmptyResolverCallback)); } void Shell::TerminateShellConnections() { @@ -533,11 +535,20 @@ void Shell::Connect(scoped_ptr<ConnectParams> params, if (!client.is_bound() && ConnectToExistingInstance(¶ms)) return; + // The catalog needs to see the source identity as that of the originating + // app so it loads the correct store. Since the catalog is itself run as root + // when this re-enters Connect() it'll be handled by + // ConnectToExistingInstance(). + mojom::ShellResolverPtr resolver; + ConnectToInterface(this, Identity(kShellName, params->target().user_id()), + CreateCatalogIdentity(), &resolver); + std::string name = params->target().name(); - shell_resolver_->ResolveMojoName( + mojom::ShellResolver* resolver_raw = resolver.get(); + resolver_raw->ResolveMojoName( name, - base::Bind(&Shell::OnGotResolvedName, - weak_ptr_factory_.GetWeakPtr(), base::Passed(¶ms), + base::Bind(&Shell::OnGotResolvedName, weak_ptr_factory_.GetWeakPtr(), + base::Passed(std::move(resolver)), base::Passed(¶ms), base::Passed(&client))); } @@ -632,7 +643,8 @@ void Shell::OnShellClientFactoryLost(const Identity& which) { shell_client_factories_.erase(it); } -void Shell::OnGotResolvedName(scoped_ptr<ConnectParams> params, +void Shell::OnGotResolvedName(mojom::ShellResolverPtr resolver, + scoped_ptr<ConnectParams> params, mojom::ShellClientPtr client, const String& resolved_name, const String& resolved_instance, diff --git a/mojo/shell/shell.h b/mojo/shell/shell.h index b0b00c9..03e9bfd 100644 --- a/mojo/shell/shell.h +++ b/mojo/shell/shell.h @@ -154,7 +154,8 @@ class Shell : public ShellClient { // |file_url| is the resolved file:// URL of the physical package. // |capabilities| is the CapabilitySpecPtr the requested application should be // run with, from its manifest. - void OnGotResolvedName(scoped_ptr<ConnectParams> params, + void OnGotResolvedName(mojom::ShellResolverPtr resolver, + scoped_ptr<ConnectParams> params, mojom::ShellClientPtr client, const String& resolved_name, const String& resolved_instance, @@ -172,8 +173,6 @@ class Shell : public ShellClient { void CleanupRunner(NativeRunner* runner); - mojom::ShellResolverPtr shell_resolver_; - // Loader management. // Loaders are chosen in the order they are listed here. NameToLoaderMap name_to_loader_; diff --git a/mojo/shell/standalone/context.cc b/mojo/shell/standalone/context.cc index 68d5c3a..dc0a25b 100644 --- a/mojo/shell/standalone/context.cc +++ b/mojo/shell/standalone/context.cc @@ -29,7 +29,7 @@ #include "components/tracing/tracing_switches.h" #include "mojo/edk/embedder/embedder.h" #include "mojo/public/cpp/bindings/strong_binding.h" -#include "mojo/services/catalog/owner.h" +#include "mojo/services/catalog/factory.h" #include "mojo/services/catalog/store.h" #include "mojo/services/tracing/public/cpp/switches.h" #include "mojo/services/tracing/public/cpp/trace_provider_impl.h" @@ -155,7 +155,7 @@ void Context::Init(scoped_ptr<InitParams> init_params) { scoped_ptr<catalog::Store> store; if (init_params) store = std::move(init_params->catalog_store); - catalog_.reset(new catalog::Owner(blocking_pool_.get(), std::move(store))); + catalog_.reset(new catalog::Factory(blocking_pool_.get(), std::move(store))); shell_.reset(new Shell(std::move(runner_factory), catalog_->TakeShellClient())); diff --git a/mojo/shell/standalone/context.h b/mojo/shell/standalone/context.h index 6d10318..09f7942 100644 --- a/mojo/shell/standalone/context.h +++ b/mojo/shell/standalone/context.h @@ -20,7 +20,7 @@ class SingleThreadTaskRunner; } namespace catalog { -class Owner; +class Factory; class Store; } @@ -70,7 +70,7 @@ class Context : public edk::ProcessDelegate { // Ensure this is destructed before task_runners_ since it owns a message pipe // that needs the IO thread to destruct cleanly. Tracer tracer_; - scoped_ptr<catalog::Owner> catalog_; + scoped_ptr<catalog::Factory> catalog_; scoped_ptr<Shell> shell_; base::Time main_entry_time_; diff --git a/mojo/shell/tests/loader_unittest.cc b/mojo/shell/tests/loader_unittest.cc index 111c0bd..773bc95 100644 --- a/mojo/shell/tests/loader_unittest.cc +++ b/mojo/shell/tests/loader_unittest.cc @@ -11,7 +11,7 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "mojo/public/cpp/bindings/strong_binding.h" -#include "mojo/services/catalog/owner.h" +#include "mojo/services/catalog/factory.h" #include "mojo/services/catalog/store.h" #include "mojo/shell/connect_util.h" #include "mojo/shell/loader.h" @@ -402,7 +402,7 @@ class LoaderTest : public testing::Test { void SetUp() override { blocking_pool_ = new base::SequencedWorkerPool(3, "blocking_pool"); - catalog_.reset(new catalog::Owner(blocking_pool_.get(), nullptr)); + catalog_.reset(new catalog::Factory(blocking_pool_.get(), nullptr)); shell_.reset(new Shell(nullptr, catalog_->TakeShellClient())); test_loader_ = new TestLoader(&context_); shell_->set_default_loader(scoped_ptr<Loader>(test_loader_)); @@ -453,7 +453,7 @@ class LoaderTest : public testing::Test { TestContext context_; base::MessageLoop loop_; scoped_ptr<TestClient> test_client_; - scoped_ptr<catalog::Owner> catalog_; + scoped_ptr<catalog::Factory> catalog_; scoped_refptr<base::SequencedWorkerPool> blocking_pool_; scoped_ptr<Shell> shell_; DISALLOW_COPY_AND_ASSIGN(LoaderTest); @@ -478,7 +478,7 @@ TEST_F(LoaderTest, ClientError) { TEST_F(LoaderTest, Deletes) { { - catalog::Owner catalog(blocking_pool_.get(), nullptr); + catalog::Factory catalog(blocking_pool_.get(), nullptr); Shell shell(nullptr, catalog.TakeShellClient()); TestLoader* default_loader = new TestLoader(&context_); TestLoader* name_loader1 = new TestLoader(&context_); |