diff options
author | ben <ben@chromium.org> | 2016-02-25 23:30:25 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-26 07:31:39 +0000 |
commit | e4a2bc4fb161d8d2ea673d5f55119d36be2cf06f (patch) | |
tree | a09be63e6724713539bd7065ecdcb38b0233a73e /components/resource_provider | |
parent | 0d78506780d9bf1e5e80a0bfca6099a80fd355e0 (diff) | |
download | chromium_src-e4a2bc4fb161d8d2ea673d5f55119d36be2cf06f.zip chromium_src-e4a2bc4fb161d8d2ea673d5f55119d36be2cf06f.tar.gz chromium_src-e4a2bc4fb161d8d2ea673d5f55119d36be2cf06f.tar.bz2 |
Replace with mojo::Connector (already exists) now that Shell is gone.
Requires:
- Move AppRefCount to a different class, MessageLoopRef, which is optionally used by applications that wish to quit the current message loop started by application runner when the ref drops to zero.
- Changing the signature of Initialize() to take a Connector. This is what most of the change in this CL is.
BUG=
Review URL: https://codereview.chromium.org/1725353003
Cr-Commit-Position: refs/heads/master@{#377841}
Diffstat (limited to 'components/resource_provider')
5 files changed, 11 insertions, 13 deletions
diff --git a/components/resource_provider/public/cpp/resource_loader.cc b/components/resource_provider/public/cpp/resource_loader.cc index 1bd8b7c..fc33a36 100644 --- a/components/resource_provider/public/cpp/resource_loader.cc +++ b/components/resource_provider/public/cpp/resource_loader.cc @@ -11,7 +11,7 @@ #include "base/files/file.h" #include "mojo/common/common_type_converters.h" #include "mojo/platform_handle/platform_handle_functions.h" -#include "mojo/shell/public/cpp/shell.h" +#include "mojo/shell/public/cpp/connector.h" #include "mojo/shell/public/interfaces/interface_provider.mojom.h" #include "mojo/shell/public/interfaces/shell.mojom.h" @@ -26,10 +26,10 @@ base::File GetFileFromHandle(mojo::ScopedHandle handle) { } } -ResourceLoader::ResourceLoader(mojo::Shell* shell, +ResourceLoader::ResourceLoader(mojo::Connector* connector, const std::set<std::string>& paths) : loaded_(false), did_block_(false) { - shell->ConnectToInterface("mojo:resource_provider", &resource_provider_); + connector->ConnectToInterface("mojo:resource_provider", &resource_provider_); std::vector<std::string> paths_vector(paths.begin(), paths.end()); resource_provider_->GetResources( mojo::Array<mojo::String>::From(paths_vector), diff --git a/components/resource_provider/public/cpp/resource_loader.h b/components/resource_provider/public/cpp/resource_loader.h index e355d6e..033cfdd 100644 --- a/components/resource_provider/public/cpp/resource_loader.h +++ b/components/resource_provider/public/cpp/resource_loader.h @@ -22,7 +22,7 @@ class File; } namespace mojo { -class Shell; +class Connector; } namespace resource_provider { @@ -33,7 +33,8 @@ namespace resource_provider { // have been obtained. class ResourceLoader { public: - ResourceLoader(mojo::Shell* shell, const std::set<std::string>& paths); + ResourceLoader(mojo::Connector* connector, + const std::set<std::string>& paths); ~ResourceLoader(); // Uses WaitForIncomingMessage() to block until the results are available, or diff --git a/components/resource_provider/resource_provider_app.cc b/components/resource_provider/resource_provider_app.cc index b3723ab..85e6e28 100644 --- a/components/resource_provider/resource_provider_app.cc +++ b/components/resource_provider/resource_provider_app.cc @@ -21,9 +21,10 @@ ResourceProviderApp::ResourceProviderApp( ResourceProviderApp::~ResourceProviderApp() { } -void ResourceProviderApp::Initialize(mojo::Shell* shell, const std::string& url, +void ResourceProviderApp::Initialize(mojo::Connector* connector, + const std::string& url, uint32_t id, uint32_t user_id) { - tracing_.Initialize(shell, url); + tracing_.Initialize(connector, url); } bool ResourceProviderApp::AcceptConnection(mojo::Connection* connection) { diff --git a/components/resource_provider/resource_provider_app.h b/components/resource_provider/resource_provider_app.h index 056c97f..0f2d0f0 100644 --- a/components/resource_provider/resource_provider_app.h +++ b/components/resource_provider/resource_provider_app.h @@ -15,10 +15,6 @@ #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell_client.h" -namespace mojo { -class Shell; -} - namespace resource_provider { class ResourceProviderApp : public mojo::ShellClient, @@ -29,7 +25,7 @@ class ResourceProviderApp : public mojo::ShellClient, private: // mojo::ShellClient: - void Initialize(mojo::Shell* shell, const std::string& url, + void Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) override; bool AcceptConnection(mojo::Connection* connection) override; diff --git a/components/resource_provider/resource_provider_apptest.cc b/components/resource_provider/resource_provider_apptest.cc index cc5bfe1..aecd282 100644 --- a/components/resource_provider/resource_provider_apptest.cc +++ b/components/resource_provider/resource_provider_apptest.cc @@ -55,7 +55,7 @@ class ResourceProviderApplicationTest : public mojo::test::ApplicationTestBase { // resources are returned. The return map maps from the path to the contents // of the file at the specified path. ResourceContentsMap GetResources(const std::set<std::string>& paths) { - ResourceLoader loader(shell(), paths); + ResourceLoader loader(connector(), paths); loader.BlockUntilLoaded(); // Load the contents of each of the handles. |