| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/runner/android/main.h" | 5 #include "mojo/runner/android/main.h" |
| 6 | 6 |
| 7 #include "base/android/fifo_utils.h" | 7 #include "base/android/fifo_utils.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 base::CommandLine::ForCurrentProcess()->InitFromArgv(parameters); | 125 base::CommandLine::ForCurrentProcess()->InitFromArgv(parameters); |
| 126 | 126 |
| 127 InitializeLogging(); | 127 InitializeLogging(); |
| 128 mojo::runner::WaitForDebuggerIfNecessary(); | 128 mojo::runner::WaitForDebuggerIfNecessary(); |
| 129 | 129 |
| 130 InitializeRedirection(); | 130 InitializeRedirection(); |
| 131 | 131 |
| 132 // We want ~MessageLoop to happen prior to ~Context. Initializing | 132 // We want ~MessageLoop to happen prior to ~Context. Initializing |
| 133 // LazyInstances is akin to stack-allocating objects; their destructors | 133 // LazyInstances is akin to stack-allocating objects; their destructors |
| 134 // will be invoked first-in-last-out. | 134 // will be invoked first-in-last-out. |
| 135 Context* shell_context = new Context(); | 135 base::FilePath shell_file_root( |
| 136 shell_context->SetShellFileRoot(base::FilePath( | 136 base::android::ConvertJavaStringToUTF8(env, j_local_apps_directory)); |
| 137 base::android::ConvertJavaStringToUTF8(env, j_local_apps_directory))); | 137 Context* shell_context = new Context(shell_file_root); |
| 138 g_context.Get().reset(shell_context); | 138 g_context.Get().reset(shell_context); |
| 139 | 139 |
| 140 g_java_message_loop.Get().reset(new base::MessageLoopForUI); | 140 g_java_message_loop.Get().reset(new base::MessageLoopForUI); |
| 141 base::MessageLoopForUI::current()->Start(); | 141 base::MessageLoopForUI::current()->Start(); |
| 142 | 142 |
| 143 ConfigureAndroidServices(shell_context); | 143 ConfigureAndroidServices(shell_context); |
| 144 shell_context->Init(); | 144 shell_context->Init(); |
| 145 | 145 |
| 146 // This is done after the main message loop is started since it may post | 146 // This is done after the main message loop is started since it may post |
| 147 // tasks. This is consistent with the ordering from the desktop version of | 147 // tasks. This is consistent with the ordering from the desktop version of |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 base::AtExitManager at_exit; | 187 base::AtExitManager at_exit; |
| 188 base::CommandLine::Init(argc, argv); | 188 base::CommandLine::Init(argc, argv); |
| 189 | 189 |
| 190 #if !defined(OFFICIAL_BUILD) | 190 #if !defined(OFFICIAL_BUILD) |
| 191 base::debug::EnableInProcessStackDumping(); | 191 base::debug::EnableInProcessStackDumping(); |
| 192 #endif | 192 #endif |
| 193 | 193 |
| 194 mojo::runner::InitializeLogging(); | 194 mojo::runner::InitializeLogging(); |
| 195 return mojo::runner::ChildProcessMain(); | 195 return mojo::runner::ChildProcessMain(); |
| 196 } | 196 } |
| OLD | NEW |