diff options
author | ben <ben@chromium.org> | 2015-04-29 14:30:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-29 21:31:20 +0000 |
commit | 88c9571a2e1aef7c0c84397093ba3673e2f32c08 (patch) | |
tree | df4afa5f152d5cd9ac47327d53ec4c714f8e5bd6 | |
parent | 7e7213dae82225490cc15fc25ac3c093708609f1 (diff) | |
download | chromium_src-88c9571a2e1aef7c0c84397093ba3673e2f32c08.zip chromium_src-88c9571a2e1aef7c0c84397093ba3673e2f32c08.tar.gz chromium_src-88c9571a2e1aef7c0c84397093ba3673e2f32c08.tar.bz2 |
Move runner stuff into a runner namespace.
TBR=sky@chromium.org
BUG=
Review URL: https://codereview.chromium.org/1107233002
Cr-Commit-Position: refs/heads/master@{#327559}
58 files changed, 188 insertions, 179 deletions
@@ -1,7 +1,6 @@ include_rules = [ "+base", "+build", - "+mojo", "+testing", "+third_party/mojo/src/mojo/edk", "-third_party/mojo/src/mojo/edk/system", diff --git a/mojo/runner/android/android_handler.cc b/mojo/runner/android/android_handler.cc index 01e0450..7ab108e 100644 --- a/mojo/runner/android/android_handler.cc +++ b/mojo/runner/android/android_handler.cc @@ -23,7 +23,7 @@ using base::android::ConvertUTF8ToJavaString; using base::android::GetApplicationContext; namespace mojo { -namespace shell { +namespace runner { namespace { @@ -42,7 +42,7 @@ void RunAndroidApplication(JNIEnv* env, // needed. // TODO(vtl): We'd use a ScopedNativeLibrary, but it doesn't have .get()! base::NativeLibrary app_library = - LoadNativeApplication(app_path, NativeApplicationCleanup::DELETE); + LoadNativeApplication(app_path, shell::NativeApplicationCleanup::DELETE); if (!app_library) return; @@ -107,5 +107,5 @@ bool RegisterAndroidHandlerJni(JNIEnv* env) { return RegisterNativesImpl(env); } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/android/android_handler.h b/mojo/runner/android/android_handler.h index e36ff6d..ad0e897 100644 --- a/mojo/runner/android/android_handler.h +++ b/mojo/runner/android/android_handler.h @@ -17,7 +17,7 @@ class FilePath; } namespace mojo { -namespace shell { +namespace runner { class AndroidHandler : public ApplicationDelegate, public ContentHandlerFactory::Delegate { @@ -40,7 +40,7 @@ class AndroidHandler : public ApplicationDelegate, bool RegisterAndroidHandlerJni(JNIEnv* env); -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_ANDROID_ANDROID_HANDLER_H_ diff --git a/mojo/runner/android/android_handler_loader.cc b/mojo/runner/android/android_handler_loader.cc index 5cead0b..cda33cf 100644 --- a/mojo/runner/android/android_handler_loader.cc +++ b/mojo/runner/android/android_handler_loader.cc @@ -5,7 +5,7 @@ #include "mojo/runner/android/android_handler_loader.h" namespace mojo { -namespace shell { +namespace runner { AndroidHandlerLoader::AndroidHandlerLoader() { } @@ -21,5 +21,5 @@ void AndroidHandlerLoader::Load( new ApplicationImpl(&android_handler_, application_request.Pass())); } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/android/android_handler_loader.h b/mojo/runner/android/android_handler_loader.h index 41d6e30..8979790 100644 --- a/mojo/runner/android/android_handler_loader.h +++ b/mojo/runner/android/android_handler_loader.h @@ -13,9 +13,9 @@ #include "mojo/shell/application_loader.h" namespace mojo { -namespace shell { +namespace runner { -class AndroidHandlerLoader : public ApplicationLoader { +class AndroidHandlerLoader : public shell::ApplicationLoader { public: AndroidHandlerLoader(); virtual ~AndroidHandlerLoader(); @@ -31,7 +31,7 @@ class AndroidHandlerLoader : public ApplicationLoader { DISALLOW_COPY_AND_ASSIGN(AndroidHandlerLoader); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_ANDROID_ANDROID_HANDLER_LOADER_H_ diff --git a/mojo/runner/android/apk/src/org/chromium/mojo/shell/AndroidHandler.java b/mojo/runner/android/apk/src/org/chromium/mojo/shell/AndroidHandler.java index 610ff16..0ccc2ad 100644 --- a/mojo/runner/android/apk/src/org/chromium/mojo/shell/AndroidHandler.java +++ b/mojo/runner/android/apk/src/org/chromium/mojo/shell/AndroidHandler.java @@ -22,7 +22,7 @@ import java.lang.reflect.Constructor; * TODO(ppi): create a seperate instance for each application being bootstrapped to keep track of * the temporary files and clean them up once the execution finishes. */ -@JNINamespace("mojo::shell") +@JNINamespace("mojo::runner") public class AndroidHandler { private static final String TAG = "AndroidHandler"; diff --git a/mojo/runner/android/apk/src/org/chromium/mojo/shell/Bootstrap.java b/mojo/runner/android/apk/src/org/chromium/mojo/shell/Bootstrap.java index 9916c83..8ab201f 100644 --- a/mojo/runner/android/apk/src/org/chromium/mojo/shell/Bootstrap.java +++ b/mojo/runner/android/apk/src/org/chromium/mojo/shell/Bootstrap.java @@ -15,7 +15,7 @@ import java.io.File; * Java class with the application classloader in the call stack. We load this class in the * application classloader and call into native from it to achieve that. */ -@JNINamespace("mojo::shell") +@JNINamespace("mojo::runner") public class Bootstrap implements Runnable { private final Context mContext; private final File mBootstrapNativeLibrary; diff --git a/mojo/runner/android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java b/mojo/runner/android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java index ee39c23..28d822f 100644 --- a/mojo/runner/android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java +++ b/mojo/runner/android/apk/src/org/chromium/mojo/shell/MojoShellApplication.java @@ -4,9 +4,8 @@ package org.chromium.mojo.shell; -import android.util.Log; - import org.chromium.base.BaseChromiumApplication; +import org.chromium.base.Log; import org.chromium.base.PathUtils; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryProcessType; @@ -50,7 +49,7 @@ public class MojoShellApplication extends BaseChromiumApplication { try { LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(); } catch (ProcessInitException e) { - Log.e(TAG, "libmojo_shell initialization failed.", e); + Log.e(TAG, "libmojo_runner initialization failed.", e); throw new RuntimeException(e); } } diff --git a/mojo/runner/android/apk/src/org/chromium/mojo/shell/ShellMain.java b/mojo/runner/android/apk/src/org/chromium/mojo/shell/ShellMain.java index 1f55fa2..7b9d67d 100644 --- a/mojo/runner/android/apk/src/org/chromium/mojo/shell/ShellMain.java +++ b/mojo/runner/android/apk/src/org/chromium/mojo/shell/ShellMain.java @@ -19,7 +19,7 @@ import java.util.List; /** * A placeholder class to call native functions. **/ -@JNINamespace("mojo::shell") +@JNINamespace("mojo::runner") public class ShellMain { private static final String TAG = "ShellMain"; @@ -29,7 +29,7 @@ public class ShellMain { private static final String NETWORK_LIBRARY_APP = "network_service.mojo"; // The mojo_shell library is also an executable run in forked processes when running // multi-process. - private static final String MOJO_SHELL_EXECUTABLE = "libmojo_shell.so"; + private static final String MOJO_SHELL_EXECUTABLE = "libmojo_runner.so"; /** * A guard flag for calling nativeInit() only once. diff --git a/mojo/runner/android/background_application_loader.cc b/mojo/runner/android/background_application_loader.cc index c6dace8..db69c75 100644 --- a/mojo/runner/android/background_application_loader.cc +++ b/mojo/runner/android/background_application_loader.cc @@ -9,7 +9,7 @@ #include "mojo/shell/application_manager.h" namespace mojo { -namespace shell { +namespace runner { BackgroundApplicationLoader::BackgroundApplicationLoader( scoped_ptr<ApplicationLoader> real_loader, @@ -69,5 +69,5 @@ void BackgroundApplicationLoader::LoadOnBackgroundThread( loader_->Load(url, application_request.Pass()); } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/android/background_application_loader.h b/mojo/runner/android/background_application_loader.h index e4b0db7..9ced9a8 100644 --- a/mojo/runner/android/background_application_loader.h +++ b/mojo/runner/android/background_application_loader.h @@ -13,13 +13,13 @@ #include "mojo/shell/application_loader.h" namespace mojo { -namespace shell { +namespace runner { class BackgroundApplicationLoader - : public ApplicationLoader, + : public shell::ApplicationLoader, public base::DelegateSimpleThread::Delegate { public: - BackgroundApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, + BackgroundApplicationLoader(scoped_ptr<shell::ApplicationLoader> real_loader, const std::string& thread_name, base::MessageLoop::Type message_loop_type); ~BackgroundApplicationLoader() override; @@ -38,7 +38,7 @@ class BackgroundApplicationLoader const GURL& url, InterfaceRequest<Application> application_request); bool quit_on_shutdown_; - scoped_ptr<ApplicationLoader> loader_; + scoped_ptr<shell::ApplicationLoader> loader_; const base::MessageLoop::Type message_loop_type_; const std::string thread_name_; @@ -58,7 +58,7 @@ class BackgroundApplicationLoader DISALLOW_COPY_AND_ASSIGN(BackgroundApplicationLoader); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_ANDROID_BACKGROUND_APPLICATION_LOADER_H_ diff --git a/mojo/runner/android/background_application_loader_unittest.cc b/mojo/runner/android/background_application_loader_unittest.cc index 4c6f515..19947fe 100644 --- a/mojo/runner/android/background_application_loader_unittest.cc +++ b/mojo/runner/android/background_application_loader_unittest.cc @@ -8,15 +8,15 @@ #include "testing/gtest/include/gtest/gtest.h" namespace mojo { -namespace shell { +namespace runner { namespace { -class DummyLoader : public ApplicationLoader { +class DummyLoader : public shell::ApplicationLoader { public: DummyLoader() : simulate_app_quit_(true) {} ~DummyLoader() override {} - // ApplicationLoader overrides: + // shell::ApplicationLoader overrides: void Load(const GURL& url, InterfaceRequest<Application> application_request) override { if (simulate_app_quit_) @@ -31,7 +31,7 @@ class DummyLoader : public ApplicationLoader { // Tests that the loader can start and stop gracefully. TEST(BackgroundApplicationLoaderTest, StartStop) { - scoped_ptr<ApplicationLoader> real_loader(new DummyLoader()); + scoped_ptr<shell::ApplicationLoader> real_loader(new DummyLoader()); BackgroundApplicationLoader loader(real_loader.Pass(), "test", base::MessageLoop::TYPE_DEFAULT); } @@ -39,7 +39,7 @@ TEST(BackgroundApplicationLoaderTest, StartStop) { // Tests that the loader can load a service that is well behaved (quits // itself). TEST(BackgroundApplicationLoaderTest, Load) { - scoped_ptr<ApplicationLoader> real_loader(new DummyLoader()); + scoped_ptr<shell::ApplicationLoader> real_loader(new DummyLoader()); BackgroundApplicationLoader loader(real_loader.Pass(), "test", base::MessageLoop::TYPE_DEFAULT); ApplicationPtr application; @@ -47,5 +47,5 @@ TEST(BackgroundApplicationLoaderTest, Load) { } } // namespace -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/android/bootstrap.cc b/mojo/runner/android/bootstrap.cc index 3ffe348..7d37173 100644 --- a/mojo/runner/android/bootstrap.cc +++ b/mojo/runner/android/bootstrap.cc @@ -10,7 +10,7 @@ #include "mojo/runner/android/run_android_application_function.h" namespace mojo { -namespace shell { +namespace runner { void Bootstrap(JNIEnv* env, jobject, @@ -29,14 +29,14 @@ bool RegisterBootstrapJni(JNIEnv* env) { return RegisterNativesImpl(env); } -} // namespace shell +} // namespace runner } // namespace mojo JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { base::android::InitVM(vm); JNIEnv* env = base::android::AttachCurrentThread(); - if (!mojo::shell::RegisterBootstrapJni(env)) + if (!mojo::runner::RegisterBootstrapJni(env)) return -1; return JNI_VERSION_1_4; diff --git a/mojo/runner/android/library_loader.cc b/mojo/runner/android/library_loader.cc index e8f6ff8..f24843f 100644 --- a/mojo/runner/android/library_loader.cc +++ b/mojo/runner/android/library_loader.cc @@ -14,10 +14,10 @@ namespace { base::android::RegistrationMethod kMojoRegisteredMethods[] = { - {"AndroidHandler", mojo::shell::RegisterAndroidHandlerJni}, + {"AndroidHandler", mojo::runner::RegisterAndroidHandlerJni}, {"PlatformViewportAndroid", native_viewport::PlatformViewportAndroid::Register}, - {"ShellMain", mojo::shell::RegisterShellMain}, + {"ShellMain", mojo::runner::RegisterShellMain}, }; bool RegisterJNI(JNIEnv* env) { diff --git a/mojo/runner/android/main.cc b/mojo/runner/android/main.cc index a610f22..82ba0b4 100644 --- a/mojo/runner/android/main.cc +++ b/mojo/runner/android/main.cc @@ -33,7 +33,7 @@ using base::LazyInstance; namespace mojo { -namespace shell { +namespace runner { namespace { @@ -201,7 +201,7 @@ bool RegisterShellMain(JNIEnv* env) { return RegisterNativesImpl(env); } -} // namespace shell +} // namespace runner } // namespace mojo // TODO(vtl): Even though main() should never be called, mojo_shell fails to diff --git a/mojo/runner/android/main.h b/mojo/runner/android/main.h index 8031682..d09791f 100644 --- a/mojo/runner/android/main.h +++ b/mojo/runner/android/main.h @@ -8,11 +8,11 @@ #include <jni.h> namespace mojo { -namespace shell { +namespace runner { bool RegisterShellMain(JNIEnv* env); -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_ANDROID_MAIN_H_ diff --git a/mojo/runner/android/native_viewport_application_loader.cc b/mojo/runner/android/native_viewport_application_loader.cc index e2a8afe..815cc05 100644 --- a/mojo/runner/android/native_viewport_application_loader.cc +++ b/mojo/runner/android/native_viewport_application_loader.cc @@ -9,7 +9,7 @@ #include "mojo/public/cpp/application/application_impl.h" namespace mojo { -namespace shell { +namespace runner { NativeViewportApplicationLoader::NativeViewportApplicationLoader() { } @@ -46,5 +46,5 @@ void NativeViewportApplicationLoader::Create(ApplicationConnection* connection, new gles2::GpuImpl(request.Pass(), gpu_state_); } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/android/native_viewport_application_loader.h b/mojo/runner/android/native_viewport_application_loader.h index 210369a..b714008 100644 --- a/mojo/runner/android/native_viewport_application_loader.h +++ b/mojo/runner/android/native_viewport_application_loader.h @@ -20,9 +20,9 @@ namespace mojo { class ApplicationImpl; -namespace shell { +namespace runner { -class NativeViewportApplicationLoader : public ApplicationLoader, +class NativeViewportApplicationLoader : public shell::ApplicationLoader, public ApplicationDelegate, public InterfaceFactory<NativeViewport>, public InterfaceFactory<Gpu> { @@ -52,7 +52,7 @@ class NativeViewportApplicationLoader : public ApplicationLoader, DISALLOW_COPY_AND_ASSIGN(NativeViewportApplicationLoader); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_ANDROID_NATIVE_VIEWPORT_APPLICATION_LOADER_H_ diff --git a/mojo/runner/android/run_android_application_function.h b/mojo/runner/android/run_android_application_function.h index a987124..8b4295e 100644 --- a/mojo/runner/android/run_android_application_function.h +++ b/mojo/runner/android/run_android_application_function.h @@ -9,7 +9,7 @@ #include "base/files/file_path.h" namespace mojo { -namespace shell { +namespace runner { // Type of the function that we inject from the main .so of the Mojo shell to // the helper libbootstrap.so. This function will set the thunks in the @@ -21,7 +21,7 @@ typedef void (*RunAndroidApplicationFn)(JNIEnv* env, const base::FilePath& app_path, jint j_handle); -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_ANDROID_RUN_ANDROID_APPLICATION_FUNCTION_H_ diff --git a/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java b/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java index 2aba46f..a4bd6c5 100644 --- a/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java +++ b/mojo/runner/android/tests/src/org/chromium/mojo/shell/ShellTestBase.java @@ -16,7 +16,7 @@ import java.io.IOException; /** * Helper method for ShellTestBase. */ -@JNINamespace("mojo::shell::test") +@JNINamespace("mojo::runner::test") public class ShellTestBase { // Directory where applications bundled with the tests will be extracted. private static final String TEST_APP_DIRECTORY = "test_apps"; diff --git a/mojo/runner/android/ui_application_loader_android.cc b/mojo/runner/android/ui_application_loader_android.cc index a046d64..4579e80 100644 --- a/mojo/runner/android/ui_application_loader_android.cc +++ b/mojo/runner/android/ui_application_loader_android.cc @@ -9,7 +9,7 @@ #include "mojo/shell/application_manager.h" namespace mojo { -namespace shell { +namespace runner { UIApplicationLoader::UIApplicationLoader( scoped_ptr<ApplicationLoader> real_loader, @@ -44,5 +44,5 @@ void UIApplicationLoader::ShutdownOnUIThread() { loader_.reset(); } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/android/ui_application_loader_android.h b/mojo/runner/android/ui_application_loader_android.h index 46aefa7..be2be15 100644 --- a/mojo/runner/android/ui_application_loader_android.h +++ b/mojo/runner/android/ui_application_loader_android.h @@ -14,14 +14,14 @@ class MessageLoop; } namespace mojo { -namespace shell { +namespace runner { class ApplicationManager; // ApplicationLoader implementation that creates a background thread and issues // load // requests there. -class UIApplicationLoader : public ApplicationLoader { +class UIApplicationLoader : public shell::ApplicationLoader { public: UIApplicationLoader(scoped_ptr<ApplicationLoader> real_loader, base::MessageLoop* ui_message_loop); @@ -48,7 +48,7 @@ class UIApplicationLoader : public ApplicationLoader { DISALLOW_COPY_AND_ASSIGN(UIApplicationLoader); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_ANDROID_UI_APPLICATION_LOADER_ANDROID_H_ diff --git a/mojo/runner/child_process.cc b/mojo/runner/child_process.cc index cee831f..3553193 100644 --- a/mojo/runner/child_process.cc +++ b/mojo/runner/child_process.cc @@ -32,7 +32,7 @@ #include "mojo/runner/switches.h" namespace mojo { -namespace shell { +namespace runner { namespace { @@ -220,12 +220,12 @@ class ChildControllerImpl : public ChildController, public ErrorHandler { DCHECK(thread_checker_.CalledOnValidThread()); on_app_complete_ = on_app_complete; - unblocker_.Unblock(base::Bind(&ChildControllerImpl::StartAppOnMainThread, - base::FilePath::FromUTF8Unsafe(app_path), - clean_app_path - ? NativeApplicationCleanup::DELETE - : NativeApplicationCleanup::DONT_DELETE, - base::Passed(&application_request))); + unblocker_.Unblock(base::Bind( + &ChildControllerImpl::StartAppOnMainThread, + base::FilePath::FromUTF8Unsafe(app_path), + clean_app_path ? shell::NativeApplicationCleanup::DELETE + : shell::NativeApplicationCleanup::DONT_DELETE, + base::Passed(&application_request))); } void ExitNow(int32_t exit_code) override { @@ -252,7 +252,7 @@ class ChildControllerImpl : public ChildController, public ErrorHandler { static void StartAppOnMainThread( const base::FilePath& app_path, - NativeApplicationCleanup cleanup, + shell::NativeApplicationCleanup cleanup, InterfaceRequest<Application> application_request) { // TODO(vtl): This is copied from in_process_native_runner.cc. DVLOG(2) << "Loading/running Mojo app from " << app_path.value() @@ -317,5 +317,5 @@ int ChildProcessMain() { return 0; } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/child_process.h b/mojo/runner/child_process.h index 1d4badf..2b94301 100644 --- a/mojo/runner/child_process.h +++ b/mojo/runner/child_process.h @@ -6,12 +6,12 @@ #define MOJO_RUNNER_CHILD_PROCESS_H_ namespace mojo { -namespace shell { +namespace runner { // Main method for a child process. int ChildProcessMain(); -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_CHILD_PROCESS_H_ diff --git a/mojo/runner/child_process.mojom b/mojo/runner/child_process.mojom index dd423e2..cf83281 100644 --- a/mojo/runner/child_process.mojom +++ b/mojo/runner/child_process.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo.shell; +module mojo.runner; import "mojo/public/interfaces/application/application.mojom"; diff --git a/mojo/runner/child_process_host.cc b/mojo/runner/child_process_host.cc index 2198678..0a06992c 100644 --- a/mojo/runner/child_process_host.cc +++ b/mojo/runner/child_process_host.cc @@ -25,7 +25,7 @@ #include "ui/gl/gl_switches.h" namespace mojo { -namespace shell { +namespace runner { ChildProcessHost::ChildProcessHost(Context* context, const std::string& name) : context_(context), name_(name), channel_info_(nullptr) { @@ -159,5 +159,5 @@ void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) { channel_info_ = channel_info; } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/child_process_host.h b/mojo/runner/child_process_host.h index b0516d5..cbc3d64 100644 --- a/mojo/runner/child_process_host.h +++ b/mojo/runner/child_process_host.h @@ -14,7 +14,7 @@ #include "mojo/runner/child_process_host.h" namespace mojo { -namespace shell { +namespace runner { class Context; @@ -80,7 +80,7 @@ class ChildProcessHost { DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_CHILD_PROCESS_HOST_H_ diff --git a/mojo/runner/child_process_host_unittest.cc b/mojo/runner/child_process_host_unittest.cc index 5e69ec9..8a90802 100644 --- a/mojo/runner/child_process_host_unittest.cc +++ b/mojo/runner/child_process_host_unittest.cc @@ -14,7 +14,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace mojo { -namespace shell { +namespace runner { namespace { // Subclass just so we can observe |DidStart()|. @@ -59,5 +59,5 @@ TEST(ChildProcessHostTest, MAYBE_StartJoin) { } } // namespace -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/context.cc b/mojo/runner/context.cc index 4d8dcd9..9f96cda 100644 --- a/mojo/runner/context.cc +++ b/mojo/runner/context.cc @@ -36,7 +36,7 @@ #include "url/gurl.h" namespace mojo { -namespace shell { +namespace runner { namespace { // Used to ensure we only init once. @@ -103,7 +103,7 @@ bool ConfigureURLMappings(const base::CommandLine& command_line, return true; } -void InitContentHandlers(ApplicationManager* manager, +void InitContentHandlers(shell::ApplicationManager* manager, const base::CommandLine& command_line) { // Default content handlers. manager->RegisterContentHandler("application/pdf", GURL("mojo:pdf_viewer")); @@ -150,7 +150,7 @@ void InitContentHandlers(ApplicationManager* manager, } } -void InitNativeOptions(ApplicationManager* manager, +void InitNativeOptions(shell::ApplicationManager* manager, const base::CommandLine& command_line) { std::vector<std::string> force_in_process_url_list; base::SplitString(command_line.GetSwitchValueASCII(switches::kForceInProcess), @@ -163,7 +163,7 @@ void InitNativeOptions(ApplicationManager* manager, return; } - NativeRunnerFactory::Options options; + shell::NativeRunnerFactory::Options options; options.force_in_process = true; manager->SetNativeOptionsForURL(options, gurl); } @@ -255,7 +255,7 @@ bool Context::Init() { embedder::ProcessType::NONE, task_runners_->shell_runner(), this, task_runners_->io_runner(), embedder::ScopedPlatformHandle()); - scoped_ptr<NativeRunnerFactory> runner_factory; + scoped_ptr<shell::NativeRunnerFactory> runner_factory; if (command_line.HasSwitch(switches::kEnableMultiprocess)) runner_factory.reset(new OutOfProcessNativeRunnerFactory(this)); else @@ -322,5 +322,5 @@ void Context::OnApplicationEnd(const GURL& url) { } } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/context.h b/mojo/runner/context.h index 6f4c150..06a2754 100644 --- a/mojo/runner/context.h +++ b/mojo/runner/context.h @@ -14,12 +14,12 @@ #include "mojo/shell/application_manager.h" namespace mojo { -namespace shell { +namespace runner { class NativeApplicationLoader; // The "global" context for the shell's main process. -class Context : public ApplicationManager::Delegate, +class Context : public shell::ApplicationManager::Delegate, public embedder::ProcessDelegate { public: Context(); @@ -56,7 +56,9 @@ class Context : public ApplicationManager::Delegate, void Run(const GURL& url); TaskRunners* task_runners() { return task_runners_.get(); } - ApplicationManager* application_manager() { return &application_manager_; } + shell::ApplicationManager* application_manager() { + return &application_manager_; + } URLResolver* url_resolver() { return &url_resolver_; } private: @@ -73,7 +75,7 @@ class Context : public ApplicationManager::Delegate, std::set<GURL> app_urls_; scoped_ptr<TaskRunners> task_runners_; - ApplicationManager application_manager_; + shell::ApplicationManager application_manager_; URLResolver url_resolver_; GURL shell_file_root_; GURL command_line_cwd_; @@ -81,7 +83,7 @@ class Context : public ApplicationManager::Delegate, DISALLOW_COPY_AND_ASSIGN(Context); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_CONTEXT_H_ diff --git a/mojo/runner/data_pipe_peek_unittest.cc b/mojo/runner/data_pipe_peek_unittest.cc index 6fc2b7d..42c2177 100644 --- a/mojo/runner/data_pipe_peek_unittest.cc +++ b/mojo/runner/data_pipe_peek_unittest.cc @@ -8,7 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace mojo { -namespace shell { +namespace runner { namespace { TEST(DataPipePeek, PeekNBytes) { @@ -30,15 +30,15 @@ TEST(DataPipePeek, PeekNBytes) { std::string bytes; MojoDeadline timeout = 0; - EXPECT_TRUE(BlockingPeekNBytes(consumer, &bytes, num_bytes4, timeout)); + EXPECT_TRUE(shell::BlockingPeekNBytes(consumer, &bytes, num_bytes4, timeout)); EXPECT_EQ(bytes, std::string(s4)); timeout = 1000; // 1ms - EXPECT_TRUE(BlockingPeekNBytes(consumer, &bytes, num_bytes4, timeout)); + EXPECT_TRUE(shell::BlockingPeekNBytes(consumer, &bytes, num_bytes4, timeout)); EXPECT_EQ(bytes, std::string(s4)); timeout = MOJO_DEADLINE_INDEFINITE; - EXPECT_TRUE(BlockingPeekNBytes(consumer, &bytes, num_bytes4, timeout)); + EXPECT_TRUE(shell::BlockingPeekNBytes(consumer, &bytes, num_bytes4, timeout)); EXPECT_EQ(bytes, std::string(s4)); // Peeking for 5 bytes should fail, until another byte is written. @@ -49,23 +49,26 @@ TEST(DataPipePeek, PeekNBytes) { const char* s5 = "12345"; timeout = 0; - EXPECT_FALSE(BlockingPeekNBytes(consumer, &bytes, num_bytes5, timeout)); + EXPECT_FALSE( + shell::BlockingPeekNBytes(consumer, &bytes, num_bytes5, timeout)); timeout = 500; // Should cause peek to timeout after about 0.5ms. - EXPECT_FALSE(BlockingPeekNBytes(consumer, &bytes, num_bytes5, timeout)); + EXPECT_FALSE( + shell::BlockingPeekNBytes(consumer, &bytes, num_bytes5, timeout)); EXPECT_EQ(MOJO_RESULT_OK, WriteDataRaw(producer, s1, &bytes1, MOJO_WRITE_DATA_FLAG_NONE)); EXPECT_EQ(1u, bytes1); - EXPECT_TRUE(BlockingPeekNBytes(consumer, &bytes, num_bytes5, timeout)); + EXPECT_TRUE(shell::BlockingPeekNBytes(consumer, &bytes, num_bytes5, timeout)); EXPECT_EQ(bytes, std::string(s5)); // If the consumer side of the pipe is closed, peek should fail. data_pipe.consumer_handle.reset(); timeout = 0; - EXPECT_FALSE(BlockingPeekNBytes(consumer, &bytes, num_bytes5, timeout)); + EXPECT_FALSE( + shell::BlockingPeekNBytes(consumer, &bytes, num_bytes5, timeout)); } TEST(DataPipePeek, PeekLine) { @@ -88,7 +91,8 @@ TEST(DataPipePeek, PeekLine) { std::string str; size_t max_str_length = 5; MojoDeadline timeout = 0; - EXPECT_FALSE(BlockingPeekLine(consumer, &str, max_str_length, timeout)); + EXPECT_FALSE( + shell::BlockingPeekLine(consumer, &str, max_str_length, timeout)); // Writing a newline should cause PeekLine to succeed. @@ -98,16 +102,17 @@ TEST(DataPipePeek, PeekLine) { WriteDataRaw(producer, s1, &bytes1, MOJO_WRITE_DATA_FLAG_NONE)); EXPECT_EQ(1u, bytes1); - EXPECT_TRUE(BlockingPeekLine(consumer, &str, max_str_length, timeout)); + EXPECT_TRUE(shell::BlockingPeekLine(consumer, &str, max_str_length, timeout)); EXPECT_EQ(str, std::string(s4) + "\n"); // If the max_line_length parameter is less than the length of the // newline terminated string, then peek should fail. max_str_length = 3; - EXPECT_FALSE(BlockingPeekLine(consumer, &str, max_str_length, timeout)); + EXPECT_FALSE( + shell::BlockingPeekLine(consumer, &str, max_str_length, timeout)); } } // namespace -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/desktop/launcher_process.cc b/mojo/runner/desktop/launcher_process.cc index ebbfccb..d8d9f9a 100644 --- a/mojo/runner/desktop/launcher_process.cc +++ b/mojo/runner/desktop/launcher_process.cc @@ -19,7 +19,7 @@ #include "mojo/runner/switches.h" namespace mojo { -namespace shell { +namespace runner { namespace { // Whether we're currently tracing. @@ -75,7 +75,7 @@ void StopTracingAndFlushToDisk() { flush_complete_event.Wait(); } -void StartApp(mojo::shell::Context* context) { +void StartApp(mojo::runner::Context* context) { // If a mojo app isn't specified (i.e. for an apptest), run the mojo shell's // window manager. GURL app_url(GURL("mojo:window_manager")); @@ -108,7 +108,7 @@ int LauncherProcessMain(int argc, char** argv) { // We want the shell::Context to outlive the MessageLoop so that pipes are // all gracefully closed / error-out before we try to shut the Context down. - mojo::shell::Context shell_context; + Context shell_context; { base::MessageLoop message_loop; if (!shell_context.Init()) { @@ -132,5 +132,5 @@ int LauncherProcessMain(int argc, char** argv) { return 0; } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/desktop/launcher_process.h b/mojo/runner/desktop/launcher_process.h index caed878..9a7841a 100644 --- a/mojo/runner/desktop/launcher_process.h +++ b/mojo/runner/desktop/launcher_process.h @@ -6,12 +6,12 @@ #define MOJO_SHELL_LAUNCHER_PROCESS_H_ namespace mojo { -namespace shell { +namespace runner { // Main method for the launcher process. int LauncherProcessMain(int argc, char** argv); -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_SHELL_LAUNCHER_PROCESS_H_ diff --git a/mojo/runner/desktop/main.cc b/mojo/runner/desktop/main.cc index b5d8576..1764c3f 100644 --- a/mojo/runner/desktop/main.cc +++ b/mojo/runner/desktop/main.cc @@ -13,12 +13,12 @@ int main(int argc, char** argv) { base::AtExitManager at_exit; base::CommandLine::Init(argc, argv); - mojo::shell::InitializeLogging(); + mojo::runner::InitializeLogging(); const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kChildProcess)) - return mojo::shell::ChildProcessMain(); + return mojo::runner::ChildProcessMain(); - return mojo::shell::LauncherProcessMain(argc, argv); + return mojo::runner::LauncherProcessMain(argc, argv); } diff --git a/mojo/runner/in_process_native_runner.cc b/mojo/runner/in_process_native_runner.cc index ce09f5b..c37e31d 100644 --- a/mojo/runner/in_process_native_runner.cc +++ b/mojo/runner/in_process_native_runner.cc @@ -12,10 +12,11 @@ #include "mojo/runner/native_application_support.h" namespace mojo { -namespace shell { +namespace runner { InProcessNativeRunner::InProcessNativeRunner(Context* context) - : cleanup_(NativeApplicationCleanup::DONT_DELETE), app_library_(nullptr) { + : cleanup_(shell::NativeApplicationCleanup::DONT_DELETE), + app_library_(nullptr) { } InProcessNativeRunner::~InProcessNativeRunner() { @@ -31,7 +32,7 @@ InProcessNativeRunner::~InProcessNativeRunner() { void InProcessNativeRunner::Start( const base::FilePath& app_path, - NativeApplicationCleanup cleanup, + shell::NativeApplicationCleanup cleanup, InterfaceRequest<Application> application_request, const base::Closure& app_completed_callback) { app_path_ = app_path; @@ -63,10 +64,10 @@ void InProcessNativeRunner::Run() { app_completed_callback_runner_.Reset(); } -scoped_ptr<NativeRunner> InProcessNativeRunnerFactory::Create( +scoped_ptr<shell::NativeRunner> InProcessNativeRunnerFactory::Create( const Options& options) { return make_scoped_ptr(new InProcessNativeRunner(context_)); } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/in_process_native_runner.h b/mojo/runner/in_process_native_runner.h index e8afcfd..3e1e2e0 100644 --- a/mojo/runner/in_process_native_runner.h +++ b/mojo/runner/in_process_native_runner.h @@ -15,13 +15,13 @@ #include "mojo/shell/native_runner.h" namespace mojo { -namespace shell { +namespace runner { class Context; // An implementation of |NativeRunner| that loads/runs the given app (from the // file system) on a separate thread (in the current process). -class InProcessNativeRunner : public NativeRunner, +class InProcessNativeRunner : public shell::NativeRunner, public base::DelegateSimpleThread::Delegate { public: explicit InProcessNativeRunner(Context* context); @@ -29,7 +29,7 @@ class InProcessNativeRunner : public NativeRunner, // |NativeRunner| method: void Start(const base::FilePath& app_path, - NativeApplicationCleanup cleanup, + shell::NativeApplicationCleanup cleanup, InterfaceRequest<Application> application_request, const base::Closure& app_completed_callback) override; @@ -38,7 +38,7 @@ class InProcessNativeRunner : public NativeRunner, void Run() override; base::FilePath app_path_; - NativeApplicationCleanup cleanup_; + shell::NativeApplicationCleanup cleanup_; InterfaceRequest<Application> application_request_; base::Callback<bool(void)> app_completed_callback_runner_; @@ -48,12 +48,12 @@ class InProcessNativeRunner : public NativeRunner, DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunner); }; -class InProcessNativeRunnerFactory : public NativeRunnerFactory { +class InProcessNativeRunnerFactory : public shell::NativeRunnerFactory { public: explicit InProcessNativeRunnerFactory(Context* context) : context_(context) {} ~InProcessNativeRunnerFactory() override {} - scoped_ptr<NativeRunner> Create(const Options& options) override; + scoped_ptr<shell::NativeRunner> Create(const Options& options) override; private: Context* const context_; @@ -61,7 +61,7 @@ class InProcessNativeRunnerFactory : public NativeRunnerFactory { DISALLOW_COPY_AND_ASSIGN(InProcessNativeRunnerFactory); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_IN_PROCESS_NATIVE_RUNNER_H_ diff --git a/mojo/runner/in_process_native_runner_unittest.cc b/mojo/runner/in_process_native_runner_unittest.cc index 12fecfc..f5e098f 100644 --- a/mojo/runner/in_process_native_runner_unittest.cc +++ b/mojo/runner/in_process_native_runner_unittest.cc @@ -8,7 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace mojo { -namespace shell { +namespace runner { TEST(InProcessNativeRunnerTest, NotStarted) { Context context; @@ -19,5 +19,5 @@ TEST(InProcessNativeRunnerTest, NotStarted) { // Shouldn't crash or DCHECK on destruction. } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/init.cc b/mojo/runner/init.cc index e069f4f..0656c6e 100644 --- a/mojo/runner/init.cc +++ b/mojo/runner/init.cc @@ -7,7 +7,7 @@ #include "base/logging.h" namespace mojo { -namespace shell { +namespace runner { void InitializeLogging() { logging::LoggingSettings settings; @@ -20,5 +20,5 @@ void InitializeLogging() { false); // Tick count } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/init.h b/mojo/runner/init.h index 8ddc2d7..4db9896 100644 --- a/mojo/runner/init.h +++ b/mojo/runner/init.h @@ -6,13 +6,13 @@ #define MOJO_RUNNER_INIT_H_ namespace mojo { -namespace shell { +namespace runner { // Initialization routines shared by desktop and Android main functions. void InitializeLogging(); -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_INIT_H_ diff --git a/mojo/runner/native_application_support.cc b/mojo/runner/native_application_support.cc index aa6f68b..c4270da 100644 --- a/mojo/runner/native_application_support.cc +++ b/mojo/runner/native_application_support.cc @@ -18,7 +18,7 @@ #include "mojo/public/platform/native/system_thunks.h" namespace mojo { -namespace shell { +namespace runner { namespace { @@ -43,13 +43,14 @@ bool SetThunks(Thunks (*make_thunks)(), } // namespace -base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path, - NativeApplicationCleanup cleanup) { +base::NativeLibrary LoadNativeApplication( + const base::FilePath& app_path, + shell::NativeApplicationCleanup cleanup) { DVLOG(2) << "Loading Mojo app in process from library: " << app_path.value(); base::NativeLibraryLoadError error; base::NativeLibrary app_library = base::LoadNativeLibrary(app_path, &error); - if (cleanup == NativeApplicationCleanup::DELETE) + if (cleanup == shell::NativeApplicationCleanup::DELETE) DeleteFile(app_path, false); LOG_IF(ERROR, !app_library) << "Failed to load app library (error: " << error.ToString() << ")"; @@ -141,5 +142,5 @@ bool RunNativeApplication(base::NativeLibrary app_library, return true; } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/native_application_support.h b/mojo/runner/native_application_support.h index b3b8b62..d1b3d4c 100644 --- a/mojo/runner/native_application_support.h +++ b/mojo/runner/native_application_support.h @@ -7,6 +7,7 @@ #include "base/native_library.h" #include "mojo/public/cpp/bindings/interface_request.h" +#include "mojo/shell/native_runner.h" #if defined(OS_WIN) #undef DELETE @@ -20,9 +21,7 @@ namespace mojo { class Application; -namespace shell { - -enum class NativeApplicationCleanup { DELETE, DONT_DELETE }; +namespace runner { // Loads the native Mojo application from the DSO specified by |app_path|. // Returns the |base::NativeLibrary| for the application on success (or null on @@ -33,8 +32,9 @@ enum class NativeApplicationCleanup { DELETE, DONT_DELETE }; // this should be done only after the thread on which |LoadNativeApplication()| // and |RunNativeApplication()| were called has terminated, so that any // thread-local destructors have been executed. -base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path, - NativeApplicationCleanup cleanup); +base::NativeLibrary LoadNativeApplication( + const base::FilePath& app_path, + shell::NativeApplicationCleanup cleanup); // Runs the native Mojo application from the DSO that was loaded using // |LoadNativeApplication()|; this tolerates |app_library| being null. This @@ -45,7 +45,7 @@ base::NativeLibrary LoadNativeApplication(const base::FilePath& app_path, bool RunNativeApplication(base::NativeLibrary app_library, InterfaceRequest<Application> application_request); -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_NATIVE_APPLICATION_SUPPORT_H_ diff --git a/mojo/runner/native_runner_unittest.cc b/mojo/runner/native_runner_unittest.cc index ca69dd4..2efb75e 100644 --- a/mojo/runner/native_runner_unittest.cc +++ b/mojo/runner/native_runner_unittest.cc @@ -9,7 +9,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace mojo { -namespace shell { +namespace runner { namespace { struct TestState { @@ -23,7 +23,7 @@ struct TestState { bool runner_was_destroyed; }; -class TestNativeRunner : public NativeRunner { +class TestNativeRunner : public shell::NativeRunner { public: explicit TestNativeRunner(TestState* state) : state_(state) { state_->runner_was_created = true; @@ -33,7 +33,7 @@ class TestNativeRunner : public NativeRunner { base::MessageLoop::current()->Quit(); } void Start(const base::FilePath& app_path, - NativeApplicationCleanup cleanup, + shell::NativeApplicationCleanup cleanup, InterfaceRequest<Application> application_request, const base::Closure& app_completed_callback) override { state_->runner_was_started = true; @@ -43,12 +43,12 @@ class TestNativeRunner : public NativeRunner { TestState* state_; }; -class TestNativeRunnerFactory : public NativeRunnerFactory { +class TestNativeRunnerFactory : public shell::NativeRunnerFactory { public: explicit TestNativeRunnerFactory(TestState* state) : state_(state) {} ~TestNativeRunnerFactory() override {} - scoped_ptr<NativeRunner> Create(const Options& options) override { - return scoped_ptr<NativeRunner>(new TestNativeRunner(state_)); + scoped_ptr<shell::NativeRunner> Create(const Options& options) override { + return scoped_ptr<shell::NativeRunner>(new TestNativeRunner(state_)); } private: @@ -56,13 +56,13 @@ class TestNativeRunnerFactory : public NativeRunnerFactory { }; class NativeApplicationLoaderTest : public testing::Test, - public ApplicationManager::Delegate { + public shell::ApplicationManager::Delegate { public: NativeApplicationLoaderTest() : application_manager_(this) {} ~NativeApplicationLoaderTest() override {} void SetUp() override { context_.Init(); - scoped_ptr<NativeRunnerFactory> factory( + scoped_ptr<shell::NativeRunnerFactory> factory( new TestNativeRunnerFactory(&state_)); application_manager_.set_native_runner_factory(factory.Pass()); application_manager_.set_blocking_pool( @@ -71,13 +71,13 @@ class NativeApplicationLoaderTest : public testing::Test, void TearDown() override { context_.Shutdown(); } protected: - shell::Context context_; + Context context_; base::MessageLoop loop_; - ApplicationManager application_manager_; + shell::ApplicationManager application_manager_; TestState state_; private: - // ApplicationManager::Delegate + // shell::ApplicationManager::Delegate GURL ResolveMappings(const GURL& url) override { return url; } GURL ResolveMojoURL(const GURL& url) override { return url; } }; @@ -97,5 +97,5 @@ TEST_F(NativeApplicationLoaderTest, DoesNotExist) { } } // namespace -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/out_of_process_native_runner.cc b/mojo/runner/out_of_process_native_runner.cc index 608765e..9623b79 100644 --- a/mojo/runner/out_of_process_native_runner.cc +++ b/mojo/runner/out_of_process_native_runner.cc @@ -13,7 +13,7 @@ #include "mojo/runner/in_process_native_runner.h" namespace mojo { -namespace shell { +namespace runner { OutOfProcessNativeRunner::OutOfProcessNativeRunner(Context* context) : context_(context) { @@ -30,7 +30,7 @@ OutOfProcessNativeRunner::~OutOfProcessNativeRunner() { void OutOfProcessNativeRunner::Start( const base::FilePath& app_path, - NativeApplicationCleanup cleanup, + shell::NativeApplicationCleanup cleanup, InterfaceRequest<Application> application_request, const base::Closure& app_completed_callback) { app_path_ = app_path; @@ -44,7 +44,8 @@ void OutOfProcessNativeRunner::Start( // TODO(vtl): |app_path.AsUTF8Unsafe()| is unsafe. child_process_host_->StartApp( - app_path.AsUTF8Unsafe(), cleanup == NativeApplicationCleanup::DELETE, + app_path.AsUTF8Unsafe(), + cleanup == shell::NativeApplicationCleanup::DELETE, application_request.Pass(), base::Bind(&OutOfProcessNativeRunner::AppCompleted, base::Unretained(this))); @@ -60,7 +61,7 @@ void OutOfProcessNativeRunner::AppCompleted(int32_t result) { app_completed_callback.Run(); } -scoped_ptr<NativeRunner> OutOfProcessNativeRunnerFactory::Create( +scoped_ptr<shell::NativeRunner> OutOfProcessNativeRunnerFactory::Create( const Options& options) { if (options.force_in_process) return make_scoped_ptr(new InProcessNativeRunner(context_)); @@ -68,5 +69,5 @@ scoped_ptr<NativeRunner> OutOfProcessNativeRunnerFactory::Create( return make_scoped_ptr(new OutOfProcessNativeRunner(context_)); } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/out_of_process_native_runner.h b/mojo/runner/out_of_process_native_runner.h index 323e872..d126c36 100644 --- a/mojo/runner/out_of_process_native_runner.h +++ b/mojo/runner/out_of_process_native_runner.h @@ -13,21 +13,21 @@ #include "mojo/shell/native_runner.h" namespace mojo { -namespace shell { +namespace runner { class ChildProcessHost; class Context; // An implementation of |NativeRunner| that loads/runs the given app (from the // file system) in a separate process (of its own). -class OutOfProcessNativeRunner : public NativeRunner { +class OutOfProcessNativeRunner : public shell::NativeRunner { public: explicit OutOfProcessNativeRunner(Context* context); ~OutOfProcessNativeRunner() override; // |NativeRunner| method: void Start(const base::FilePath& app_path, - NativeApplicationCleanup cleanup, + shell::NativeApplicationCleanup cleanup, InterfaceRequest<Application> application_request, const base::Closure& app_completed_callback) override; @@ -45,13 +45,13 @@ class OutOfProcessNativeRunner : public NativeRunner { DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunner); }; -class OutOfProcessNativeRunnerFactory : public NativeRunnerFactory { +class OutOfProcessNativeRunnerFactory : public shell::NativeRunnerFactory { public: explicit OutOfProcessNativeRunnerFactory(Context* context) : context_(context) {} ~OutOfProcessNativeRunnerFactory() override {} - scoped_ptr<NativeRunner> Create(const Options& options) override; + scoped_ptr<shell::NativeRunner> Create(const Options& options) override; private: Context* const context_; @@ -59,7 +59,7 @@ class OutOfProcessNativeRunnerFactory : public NativeRunnerFactory { DISALLOW_COPY_AND_ASSIGN(OutOfProcessNativeRunnerFactory); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_OUT_OF_PROCESS_NATIVE_RUNNER_H_ diff --git a/mojo/runner/shell_test_base.cc b/mojo/runner/shell_test_base.cc index d648999..df7144e 100644 --- a/mojo/runner/shell_test_base.cc +++ b/mojo/runner/shell_test_base.cc @@ -15,7 +15,7 @@ #include "url/gurl.h" namespace mojo { -namespace shell { +namespace runner { namespace test { namespace { @@ -70,5 +70,5 @@ void ShellTestBase::SetUpTestApplications() { #endif } // namespace test -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/shell_test_base.h b/mojo/runner/shell_test_base.h index 110a58e..4a93a09 100644 --- a/mojo/runner/shell_test_base.h +++ b/mojo/runner/shell_test_base.h @@ -16,7 +16,7 @@ class GURL; namespace mojo { -namespace shell { +namespace runner { namespace test { class ShellTestBase : public testing::Test { @@ -53,7 +53,7 @@ class ShellTestBase : public testing::Test { }; } // namespace test -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_SHELL_TEST_BASE_H_ diff --git a/mojo/runner/shell_test_base_android.cc b/mojo/runner/shell_test_base_android.cc index 83f19ad..ded757b 100644 --- a/mojo/runner/shell_test_base_android.cc +++ b/mojo/runner/shell_test_base_android.cc @@ -13,7 +13,7 @@ #include "url/gurl.h" namespace mojo { -namespace shell { +namespace runner { namespace test { namespace { @@ -43,5 +43,5 @@ void ShellTestBase::SetUpTestApplications() { } } // namespace test -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/shell_test_base_unittest.cc b/mojo/runner/shell_test_base_unittest.cc index d7ae8c7..7cd7a03 100644 --- a/mojo/runner/shell_test_base_unittest.cc +++ b/mojo/runner/shell_test_base_unittest.cc @@ -27,7 +27,7 @@ using mojo::test::TestTrackedRequestService; using mojo::test::TestTrackedRequestServicePtr; namespace mojo { -namespace shell { +namespace runner { namespace test { namespace { @@ -305,5 +305,5 @@ TEST_F(ShellTestBaseTest, ConnectManyClientsAndServices) { } // namespace } // namespace test -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/shell_test_main.cc b/mojo/runner/shell_test_main.cc index 2718a2d..a6ec6d1 100644 --- a/mojo/runner/shell_test_main.cc +++ b/mojo/runner/shell_test_main.cc @@ -20,7 +20,7 @@ int main(int argc, char** argv) { if (command_line.HasSwitch(switches::kChildProcess)) { base::AtExitManager at_exit; - return mojo::shell::ChildProcessMain(); + return mojo::runner::ChildProcessMain(); } base::TestSuite test_suite(argc, argv); diff --git a/mojo/runner/task_runners.cc b/mojo/runner/task_runners.cc index e4a49d6..c69f7c4 100644 --- a/mojo/runner/task_runners.cc +++ b/mojo/runner/task_runners.cc @@ -7,7 +7,7 @@ #include "base/threading/sequenced_worker_pool.h" namespace mojo { -namespace shell { +namespace runner { namespace { @@ -35,5 +35,5 @@ TaskRunners::~TaskRunners() { blocking_pool_->Shutdown(); } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/task_runners.h b/mojo/runner/task_runners.h index e09678c..68b9bcc 100644 --- a/mojo/runner/task_runners.h +++ b/mojo/runner/task_runners.h @@ -16,7 +16,7 @@ class SequencedWorkerPool; } namespace mojo { -namespace shell { +namespace runner { // A context object that contains the common task runners for the shell's main // process. @@ -47,7 +47,7 @@ class TaskRunners { DISALLOW_COPY_AND_ASSIGN(TaskRunners); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_TASK_RUNNERS_H_ diff --git a/mojo/runner/url_resolver.cc b/mojo/runner/url_resolver.cc index 3b257f1..e0ab27c2 100644 --- a/mojo/runner/url_resolver.cc +++ b/mojo/runner/url_resolver.cc @@ -15,7 +15,7 @@ #include "url/url_util.h" namespace mojo { -namespace shell { +namespace runner { URLResolver::URLResolver() { // Needed to treat first component of mojo URLs as host, not path. @@ -74,7 +74,7 @@ void URLResolver::AddOriginMapping(const GURL& origin, const GURL& base_url) { GURL URLResolver::ApplyMappings(const GURL& url) const { std::string query; - GURL mapped_url = GetBaseURLAndQuery(url, &query); + GURL mapped_url = shell::GetBaseURLAndQuery(url, &query); for (;;) { const auto& url_it = url_map_.find(mapped_url); if (url_it != url_map_.end()) { @@ -110,7 +110,7 @@ GURL URLResolver::ResolveMojoURL(const GURL& mojo_url) const { // It's still a mojo: URL, use the default mapping scheme. std::string query; - GURL base_url = GetBaseURLAndQuery(mojo_url, &query); + GURL base_url = shell::GetBaseURLAndQuery(mojo_url, &query); if (mojo_base_url_.SchemeIsFile()) { const GURL url_with_directory( mojo_base_url_.Resolve(base_url.host() + "/")); @@ -121,5 +121,5 @@ GURL URLResolver::ResolveMojoURL(const GURL& mojo_url) const { return mojo_base_url_.Resolve(base_url.host() + ".mojo" + query); } -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/runner/url_resolver.h b/mojo/runner/url_resolver.h index 83398f7..35b253d 100644 --- a/mojo/runner/url_resolver.h +++ b/mojo/runner/url_resolver.h @@ -14,7 +14,7 @@ #include "url/gurl.h" namespace mojo { -namespace shell { +namespace runner { // This class supports the mapping of URLs to other URLs. // It's commonly used with mojo: URL, to provide a physical location (i.e. @@ -73,7 +73,7 @@ class URLResolver { DISALLOW_COPY_AND_ASSIGN(URLResolver); }; -} // namespace shell +} // namespace runner } // namespace mojo #endif // MOJO_RUNNER_URL_RESOLVER_H_ diff --git a/mojo/runner/url_resolver_unittest.cc b/mojo/runner/url_resolver_unittest.cc index 26a67f2..9ecc821 100644 --- a/mojo/runner/url_resolver_unittest.cc +++ b/mojo/runner/url_resolver_unittest.cc @@ -11,7 +11,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace mojo { -namespace shell { +namespace runner { namespace test { namespace { @@ -170,5 +170,5 @@ TEST_F(URLResolverTest, PreferDirectory) { } // namespace } // namespace test -} // namespace shell +} // namespace runner } // namespace mojo diff --git a/mojo/shell/DEPS b/mojo/shell/DEPS index 7014b6f..7e32ecd 100644 --- a/mojo/shell/DEPS +++ b/mojo/shell/DEPS @@ -1,4 +1,5 @@ include_rules = [ "+crypto", "+third_party/mojo_services/src/content_handler/public/interfaces", + "-mojo/runner", ] diff --git a/mojo/shell/application_manager.h b/mojo/shell/application_manager.h index 8e517f8..f33d85b 100644 --- a/mojo/shell/application_manager.h +++ b/mojo/shell/application_manager.h @@ -14,7 +14,6 @@ #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/interfaces/application/application.mojom.h" #include "mojo/public/interfaces/application/service_provider.mojom.h" -#include "mojo/runner/native_application_support.h" #include "mojo/services/network/public/interfaces/network_service.mojom.h" #include "mojo/shell/application_loader.h" #include "mojo/shell/identity.h" diff --git a/mojo/shell/native_runner.h b/mojo/shell/native_runner.h index cc2ffb8..b98cb82 100644 --- a/mojo/shell/native_runner.h +++ b/mojo/shell/native_runner.h @@ -9,7 +9,6 @@ #include "base/memory/scoped_ptr.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/interfaces/application/application.mojom.h" -#include "mojo/runner/native_application_support.h" namespace base { class FilePath; @@ -18,6 +17,8 @@ class FilePath; namespace mojo { namespace shell { +enum class NativeApplicationCleanup { DELETE, DONT_DELETE }; + // ApplicationManager requires implementations of NativeRunner and // NativeRunnerFactory to run native applications. class NativeRunner { diff --git a/mojo/tools/mopy/paths.py b/mojo/tools/mopy/paths.py index 19d9ec1..508305c 100644 --- a/mojo/tools/mopy/paths.py +++ b/mojo/tools/mopy/paths.py @@ -36,7 +36,7 @@ class Paths(object): if config and config.target_os == Config.OS_ANDROID: self.target_mojo_shell_path = os.path.join(self.build_dir, "apks", - "MojoShell.apk") + "MojoRunner.apk") else: self.target_mojo_shell_path = self.mojo_shell_path else: |