diff options
-rw-r--r-- | mandoline/app/desktop/launcher_process.cc | 22 | ||||
-rw-r--r-- | mojo/runner/android/main.cc | 3 | ||||
-rw-r--r-- | mojo/runner/context.cc | 15 | ||||
-rw-r--r-- | mojo/runner/context.h | 3 | ||||
-rw-r--r-- | mojo/runner/desktop/launcher_process.cc | 21 |
5 files changed, 26 insertions, 38 deletions
diff --git a/mandoline/app/desktop/launcher_process.cc b/mandoline/app/desktop/launcher_process.cc index a2b0cc4..e4a2373 100644 --- a/mandoline/app/desktop/launcher_process.cc +++ b/mandoline/app/desktop/launcher_process.cc @@ -76,23 +76,6 @@ void StopTracingAndFlushToDisk() { flush_complete_event.Wait(); } -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")); - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - base::CommandLine::StringVector args = command_line->GetArgs(); - for (size_t i = 0; i < args.size(); ++i) { - GURL possible_app(args[i]); - if (possible_app.SchemeIs("mojo")) { - app_url = possible_app; - break; - } - } - - context->Run(app_url); -} - } // namespace int LauncherProcessMain(int argc, char** argv) { @@ -122,7 +105,10 @@ int LauncherProcessMain(int argc, char** argv) { base::TimeDelta::FromSeconds(5)); } - message_loop.PostTask(FROM_HERE, base::Bind(&StartApp, &shell_context)); + message_loop.PostTask(FROM_HERE, + base::Bind(&mojo::runner::Context::Run, + base::Unretained(&shell_context), + GURL("mojo:window_manager"))); message_loop.Run(); // Must be called before |message_loop| is destroyed. diff --git a/mojo/runner/android/main.cc b/mojo/runner/android/main.cc index dbe65e1..7236763 100644 --- a/mojo/runner/android/main.cc +++ b/mojo/runner/android/main.cc @@ -99,8 +99,7 @@ void MojoShellRunner::Run() { Context* context = g_context.Pointer()->get(); ConfigureAndroidServices(context); context->Init(); - - context->Run(GURL("mojo:window_manager")); + context->RunCommandLineApplication(); loop.Run(); g_java_message_loop.Pointer()->get()->PostTask(FROM_HERE, diff --git a/mojo/runner/context.cc b/mojo/runner/context.cc index adccbfa..d9aee2e 100644 --- a/mojo/runner/context.cc +++ b/mojo/runner/context.cc @@ -318,6 +318,21 @@ void Context::Run(const GURL& url) { base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); } +void Context::RunCommandLineApplication() { + // If an app isn't specified (i.e. for an apptest), run the window manager. + GURL app_url("mojo:window_manager"); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + base::CommandLine::StringVector args = command_line->GetArgs(); + for (size_t i = 0; i < args.size(); ++i) { + GURL possible_app(args[i]); + if (possible_app.SchemeIs("mojo")) { + app_url = possible_app; + break; + } + } + Run(app_url); +} + void Context::OnApplicationEnd(const GURL& url) { if (app_urls_.find(url) != app_urls_.end()) { app_urls_.erase(url); diff --git a/mojo/runner/context.h b/mojo/runner/context.h index 1dd54cb..78cd163 100644 --- a/mojo/runner/context.h +++ b/mojo/runner/context.h @@ -55,6 +55,9 @@ class Context : public shell::ApplicationManager::Delegate, void Run(const GURL& url); + // Run the application specified on the commandline. + void RunCommandLineApplication(); + TaskRunners* task_runners() { return task_runners_.get(); } shell::ApplicationManager* application_manager() { return &application_manager_; diff --git a/mojo/runner/desktop/launcher_process.cc b/mojo/runner/desktop/launcher_process.cc index d8d9f9a..204b3f7 100644 --- a/mojo/runner/desktop/launcher_process.cc +++ b/mojo/runner/desktop/launcher_process.cc @@ -75,23 +75,6 @@ void StopTracingAndFlushToDisk() { flush_complete_event.Wait(); } -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")); - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - base::CommandLine::StringVector args = command_line->GetArgs(); - for (size_t i = 0; i < args.size(); ++i) { - GURL possible_app(args[i]); - if (possible_app.SchemeIs("mojo")) { - app_url = possible_app; - break; - } - } - - context->Run(app_url); -} - } // namespace int LauncherProcessMain(int argc, char** argv) { @@ -120,7 +103,9 @@ int LauncherProcessMain(int argc, char** argv) { base::TimeDelta::FromSeconds(5)); } - message_loop.PostTask(FROM_HERE, base::Bind(&StartApp, &shell_context)); + message_loop.PostTask(FROM_HERE, + base::Bind(&Context::RunCommandLineApplication, + base::Unretained(&shell_context))); message_loop.Run(); // Must be called before |message_loop| is destroyed. |