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/shell/android/mojo_main.h" | 5 #include "mojo/shell/android/mojo_main.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void StartOnShellThread() { | 45 void StartOnShellThread() { |
46 g_context.Get().reset(new shell::Context()); | 46 g_context.Get().reset(new shell::Context()); |
47 shell::Run(g_context.Get().get()); | 47 shell::Run(g_context.Get().get()); |
48 } | 48 } |
49 | 49 |
50 } // namspace | 50 } // namspace |
51 | 51 |
52 static void Init(JNIEnv* env, jclass clazz, jobject context) { | 52 static void Init(JNIEnv* env, jclass clazz, jobject context) { |
53 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context); | 53 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context); |
54 | 54 |
55 base::android::InitApplicationContext(scoped_context); | 55 base::android::InitApplicationContext(env, scoped_context); |
56 | 56 |
57 if (g_at_exit) | 57 if (g_at_exit) |
58 return; | 58 return; |
59 g_at_exit = new base::AtExitManager(); | 59 g_at_exit = new base::AtExitManager(); |
60 // TODO(abarth): Currently we leak g_at_exit. | 60 // TODO(abarth): Currently we leak g_at_exit. |
61 | 61 |
62 CommandLine::Init(0, 0); | 62 CommandLine::Init(0, 0); |
63 InitializeLogging(); | 63 InitializeLogging(); |
64 | 64 |
65 // TODO(abarth): At which point should we switch to cross-platform | 65 // TODO(abarth): At which point should we switch to cross-platform |
(...skipping 17 matching lines...) Expand all Loading... |
83 base::Bind(StartOnShellThread)); | 83 base::Bind(StartOnShellThread)); |
84 | 84 |
85 // TODO(abarth): Currently we leak g_shell_thread. | 85 // TODO(abarth): Currently we leak g_shell_thread. |
86 } | 86 } |
87 | 87 |
88 bool RegisterMojoMain(JNIEnv* env) { | 88 bool RegisterMojoMain(JNIEnv* env) { |
89 return RegisterNativesImpl(env); | 89 return RegisterNativesImpl(env); |
90 } | 90 } |
91 | 91 |
92 } // namespace mojo | 92 } // namespace mojo |
OLD | NEW |