diff options
author | ben <ben@chromium.org> | 2016-02-08 17:43:05 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-09 01:44:42 +0000 |
commit | d3a4bc09b9692bf6165aa9390d057830466743a5 (patch) | |
tree | b846d0e4328a781ffb6aad420cfcfcc037627cc6 /mojo/shell/standalone | |
parent | 03ab577189f899ca7562a8c1328ead855c15051b (diff) | |
download | chromium_src-d3a4bc09b9692bf6165aa9390d057830466743a5.zip chromium_src-d3a4bc09b9692bf6165aa9390d057830466743a5.tar.gz chromium_src-d3a4bc09b9692bf6165aa9390d057830466743a5.tar.bz2 |
ApplicationImpl->ShellConnection
mojom::Application->mojom::ShellClient
R=rockot@chromium.org
BUG=
Review URL: https://codereview.chromium.org/1675153002
Cr-Commit-Position: refs/heads/master@{#374259}
Diffstat (limited to 'mojo/shell/standalone')
9 files changed, 34 insertions, 38 deletions
diff --git a/mojo/shell/standalone/android/android_handler.cc b/mojo/shell/standalone/android/android_handler.cc index 9878824..cb284c5 100644 --- a/mojo/shell/standalone/android/android_handler.cc +++ b/mojo/shell/standalone/android/android_handler.cc @@ -41,8 +41,8 @@ void RunAndroidApplication(JNIEnv* env, jobject j_context, const base::FilePath& app_path, jint j_handle) { - InterfaceRequest<mojom::Application> application_request = - MakeRequest<mojom::Application>( + InterfaceRequest<mojom::ShellClient> request = + MakeRequest<mojom::ShellClient>( MakeScopedHandle(MessagePipeHandle(j_handle))); // Load the library, so that we can set the application context there if @@ -69,7 +69,7 @@ void RunAndroidApplication(JNIEnv* env, } // Run the application. - RunNativeApplication(app_library, std::move(application_request)); + RunNativeApplication(app_library, std::move(request)); // TODO(vtl): See note about unloading and thread-local destructors above // declaration of |LoadNativeApplication()|. base::UnloadNativeLibrary(app_library); @@ -133,7 +133,7 @@ AndroidHandler::AndroidHandler() : content_handler_factory_(this) {} AndroidHandler::~AndroidHandler() {} void AndroidHandler::RunApplication( - InterfaceRequest<mojom::Application> application_request, + InterfaceRequest<mojom::ShellClient> request, URLResponsePtr response) { JNIEnv* env = AttachCurrentThread(); RunAndroidApplicationFn run_android_application_fn = &RunAndroidApplication; @@ -149,7 +149,7 @@ void AndroidHandler::RunApplication( Java_AndroidHandler_bootstrapCachedApp( env, GetApplicationContext(), j_path_to_mojo.obj(), j_internal_app_path.obj(), - application_request.PassMessagePipe().release().value(), + request.PassMessagePipe().release().value(), reinterpret_cast<jlong>(run_android_application_fn)); return; } @@ -162,7 +162,7 @@ void AndroidHandler::RunApplication( common::BlockingCopyToFile(std::move(response->body), archive_path); Java_AndroidHandler_bootstrap( env, GetApplicationContext(), j_archive_path.obj(), - application_request.PassMessagePipe().release().value(), + request.PassMessagePipe().release().value(), reinterpret_cast<jlong>(run_android_application_fn)); } diff --git a/mojo/shell/standalone/android/android_handler.h b/mojo/shell/standalone/android/android_handler.h index ed8ad3e..70a246f 100644 --- a/mojo/shell/standalone/android/android_handler.h +++ b/mojo/shell/standalone/android/android_handler.h @@ -31,7 +31,7 @@ class AndroidHandler : public ShellClient, bool AcceptConnection(Connection* connection) override; // ContentHandlerFactory::Delegate: - void RunApplication(InterfaceRequest<mojom::Application> application_request, + void RunApplication(InterfaceRequest<mojom::ShellClient> request, URLResponsePtr response) override; ContentHandlerFactory content_handler_factory_; diff --git a/mojo/shell/standalone/android/android_handler_loader.cc b/mojo/shell/standalone/android/android_handler_loader.cc index 1c1bb5e..4ff4bab 100644 --- a/mojo/shell/standalone/android/android_handler_loader.cc +++ b/mojo/shell/standalone/android/android_handler_loader.cc @@ -13,12 +13,11 @@ AndroidHandlerLoader::AndroidHandlerLoader() {} AndroidHandlerLoader::~AndroidHandlerLoader() {} -void AndroidHandlerLoader::Load( - const GURL& url, - InterfaceRequest<mojom::Application> application_request) { - DCHECK(application_request.is_pending()); - application_.reset( - new ApplicationImpl(&android_handler_, std::move(application_request))); +void AndroidHandlerLoader::Load(const GURL& url, + InterfaceRequest<mojom::ShellClient> request) { + DCHECK(request.is_pending()); + shell_client_.reset( + new ShellConnection(&android_handler_, std::move(request))); } } // namespace shell diff --git a/mojo/shell/standalone/android/android_handler_loader.h b/mojo/shell/standalone/android/android_handler_loader.h index 18255d5..5aac6b1 100644 --- a/mojo/shell/standalone/android/android_handler_loader.h +++ b/mojo/shell/standalone/android/android_handler_loader.h @@ -9,7 +9,7 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "mojo/shell/application_loader.h" -#include "mojo/shell/public/cpp/application_impl.h" +#include "mojo/shell/public/cpp/shell_connection.h" #include "mojo/shell/standalone/android/android_handler.h" namespace mojo { @@ -23,10 +23,10 @@ class AndroidHandlerLoader : public ApplicationLoader { private: // ApplicationLoader overrides: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override; + InterfaceRequest<mojom::ShellClient> request) override; AndroidHandler android_handler_; - scoped_ptr<ApplicationImpl> application_; + scoped_ptr<ShellConnection> shell_client_; DISALLOW_COPY_AND_ASSIGN(AndroidHandlerLoader); }; diff --git a/mojo/shell/standalone/android/background_application_loader.cc b/mojo/shell/standalone/android/background_application_loader.cc index 8bd3869..446ce42 100644 --- a/mojo/shell/standalone/android/background_application_loader.cc +++ b/mojo/shell/standalone/android/background_application_loader.cc @@ -29,12 +29,12 @@ BackgroundApplicationLoader::~BackgroundApplicationLoader() { void BackgroundApplicationLoader::Load( const GURL& url, - InterfaceRequest<mojom::Application> application_request) { - DCHECK(application_request.is_pending()); + InterfaceRequest<mojom::ShellClient> request) { + DCHECK(request.is_pending()); if (!thread_) { // TODO(tim): It'd be nice if we could just have each Load call // result in a new thread like DynamicService{Loader, Runner}. But some - // loaders are creating multiple ApplicationImpls (NetworkApplicationLoader) + // loaders are creating multiple ShellConnections (NetworkApplicationLoader) // sharing a delegate (etc). So we have to keep it single threaded, wait // for the thread to initialize, and post to the TaskRunner for subsequent // Load calls for now. @@ -47,8 +47,7 @@ void BackgroundApplicationLoader::Load( task_runner_->PostTask( FROM_HERE, base::Bind(&BackgroundApplicationLoader::LoadOnBackgroundThread, - base::Unretained(this), url, - base::Passed(&application_request))); + base::Unretained(this), url, base::Passed(&request))); } void BackgroundApplicationLoader::Run() { @@ -65,9 +64,9 @@ void BackgroundApplicationLoader::Run() { void BackgroundApplicationLoader::LoadOnBackgroundThread( const GURL& url, - InterfaceRequest<mojom::Application> application_request) { + InterfaceRequest<mojom::ShellClient> request) { DCHECK(task_runner_->RunsTasksOnCurrentThread()); - loader_->Load(url, std::move(application_request)); + loader_->Load(url, std::move(request)); } } // namespace shell diff --git a/mojo/shell/standalone/android/background_application_loader.h b/mojo/shell/standalone/android/background_application_loader.h index 203ce54..ed6f73c1 100644 --- a/mojo/shell/standalone/android/background_application_loader.h +++ b/mojo/shell/standalone/android/background_application_loader.h @@ -26,7 +26,7 @@ class BackgroundApplicationLoader // ApplicationLoader overrides: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override; + InterfaceRequest<mojom::ShellClient> request) override; private: // |base::DelegateSimpleThread::Delegate| method: @@ -34,9 +34,8 @@ class BackgroundApplicationLoader // These functions are exected on the background thread. They call through // to |background_loader_| to do the actual loading. - void LoadOnBackgroundThread( - const GURL& url, - InterfaceRequest<mojom::Application> application_request); + void LoadOnBackgroundThread(const GURL& url, + InterfaceRequest<mojom::ShellClient> request); bool quit_on_shutdown_; scoped_ptr<ApplicationLoader> loader_; diff --git a/mojo/shell/standalone/android/background_application_loader_unittest.cc b/mojo/shell/standalone/android/background_application_loader_unittest.cc index b7c1712..fcea757 100644 --- a/mojo/shell/standalone/android/background_application_loader_unittest.cc +++ b/mojo/shell/standalone/android/background_application_loader_unittest.cc @@ -4,7 +4,7 @@ #include "mojo/shell/standalone/android/background_application_loader.h" -#include "mojo/shell/public/interfaces/application.mojom.h" +#include "mojo/shell/public/interfaces/shell_client.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace mojo { @@ -18,7 +18,7 @@ class DummyLoader : public ApplicationLoader { // ApplicationLoader overrides: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override { + InterfaceRequest<mojom::ShellClient> request) override { if (simulate_app_quit_) base::MessageLoop::current()->QuitWhenIdle(); } diff --git a/mojo/shell/standalone/android/ui_application_loader_android.cc b/mojo/shell/standalone/android/ui_application_loader_android.cc index 39ebb8d..a848b2e 100644 --- a/mojo/shell/standalone/android/ui_application_loader_android.cc +++ b/mojo/shell/standalone/android/ui_application_loader_android.cc @@ -24,20 +24,19 @@ UIApplicationLoader::~UIApplicationLoader() { base::Unretained(this))); } -void UIApplicationLoader::Load( - const GURL& url, - InterfaceRequest<mojom::Application> application_request) { - DCHECK(application_request.is_pending()); +void UIApplicationLoader::Load(const GURL& url, + InterfaceRequest<mojom::ShellClient> request) { + DCHECK(request.is_pending()); ui_message_loop_->PostTask( FROM_HERE, base::Bind(&UIApplicationLoader::LoadOnUIThread, base::Unretained(this), - url, base::Passed(&application_request))); + url, base::Passed(&request))); } void UIApplicationLoader::LoadOnUIThread( const GURL& url, - InterfaceRequest<mojom::Application> application_request) { - loader_->Load(url, std::move(application_request)); + InterfaceRequest<mojom::ShellClient> request) { + loader_->Load(url, std::move(request)); } void UIApplicationLoader::ShutdownOnUIThread() { diff --git a/mojo/shell/standalone/android/ui_application_loader_android.h b/mojo/shell/standalone/android/ui_application_loader_android.h index 6a8c03e..5f9b5e1 100644 --- a/mojo/shell/standalone/android/ui_application_loader_android.h +++ b/mojo/shell/standalone/android/ui_application_loader_android.h @@ -29,7 +29,7 @@ class UIApplicationLoader : public ApplicationLoader { // ApplicationLoader overrides: void Load(const GURL& url, - InterfaceRequest<mojom::Application> application_request) override; + InterfaceRequest<mojom::ShellClient> request) override; private: class UILoader; @@ -39,7 +39,7 @@ class UIApplicationLoader : public ApplicationLoader { // TODO: having this code take a |manager| is fragile (as ApplicationManager // isn't thread safe). void LoadOnUIThread(const GURL& url, - InterfaceRequest<mojom::Application> application_request); + InterfaceRequest<mojom::ShellClient> request); void ShutdownOnUIThread(); scoped_ptr<ApplicationLoader> loader_; |