Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1442)

Unified Diff: shell/android/mojo_main.cc

Issue 1026293002: Aggregate parameters through mappings. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix androdi build Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | shell/application_manager/application_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/android/mojo_main.cc
diff --git a/shell/android/mojo_main.cc b/shell/android/mojo_main.cc
index 4f3a8a6dc6d6dd8b09c794534b6d3035a3c6ad59..c72cea9cb8f09904d07de3261aa723289afd27b1 100644
--- a/shell/android/mojo_main.cc
+++ b/shell/android/mojo_main.cc
@@ -46,12 +46,15 @@ const char kFifoPath[] = "fifo-path";
class MojoShellRunner : public base::DelegateSimpleThread::Delegate {
public:
- MojoShellRunner() {}
+ MojoShellRunner(const std::vector<std::string>& parameters)
+ : parameters_(parameters) {}
~MojoShellRunner() override {}
private:
void Run() override;
+ std::vector<std::string> parameters_;
+
DISALLOW_COPY_AND_ASSIGN(MojoShellRunner);
};
@@ -60,7 +63,8 @@ LazyInstance<scoped_ptr<base::MessageLoop>> g_java_message_loop =
LazyInstance<scoped_ptr<Context>> g_context = LAZY_INSTANCE_INITIALIZER;
-LazyInstance<MojoShellRunner> g_shell_runner = LAZY_INSTANCE_INITIALIZER;
+LazyInstance<scoped_ptr<MojoShellRunner>> g_shell_runner =
+ LAZY_INSTANCE_INITIALIZER;
LazyInstance<scoped_ptr<base::DelegateSimpleThread>> g_shell_thread =
LAZY_INSTANCE_INITIALIZER;
@@ -103,6 +107,9 @@ void MojoShellRunner::Run() {
ConfigureAndroidServices(context);
context->Init();
+ for (auto& args : parameters_)
+ ApplyApplicationArgs(context, args);
+
RunCommandLineApps(context);
loop.Run();
@@ -157,6 +164,7 @@ static void Init(JNIEnv* env,
&parameters);
base::CommandLine::Init(0, nullptr);
base::CommandLine::ForCurrentProcess()->InitFromArgv(parameters);
+ g_shell_runner.Get().reset(new MojoShellRunner(parameters));
InitializeLogging();
@@ -168,9 +176,6 @@ static void Init(JNIEnv* env,
Context* shell_context = new Context();
shell_context->SetShellFileRoot(base::FilePath(
base::android::ConvertJavaStringToUTF8(env, j_local_apps_directory)));
- for (auto& args : parameters)
- ApplyApplicationArgs(shell_context, args);
-
g_context.Get().reset(shell_context);
g_java_message_loop.Get().reset(new base::MessageLoopForUI);
@@ -192,8 +197,8 @@ static jboolean Start(JNIEnv* env, jclass clazz) {
sleep(5);
#endif
- g_shell_thread.Get().reset(
- new base::DelegateSimpleThread(g_shell_runner.Pointer(), "ShellThread"));
+ g_shell_thread.Get().reset(new base::DelegateSimpleThread(
+ g_shell_runner.Get().get(), "ShellThread"));
g_shell_thread.Get()->Start();
return true;
}
« no previous file with comments | « no previous file | shell/application_manager/application_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698