| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "sky/shell/sky_main.h" | |
| 6 | |
| 7 #include "base/android/jni_android.h" | |
| 8 #include "base/android/jni_array.h" | |
| 9 #include "base/android/jni_string.h" | |
| 10 #include "base/at_exit.h" | |
| 11 #include "base/bind.h" | |
| 12 #include "base/command_line.h" | |
| 13 #include "base/i18n/icu_util.h" | |
| 14 #include "base/lazy_instance.h" | |
| 15 #include "base/logging.h" | |
| 16 #include "base/macros.h" | |
| 17 #include "base/message_loop/message_loop.h" | |
| 18 #include "base/run_loop.h" | |
| 19 #include "base/threading/simple_thread.h" | |
| 20 #include "jni/SkyMain_jni.h" | |
| 21 #include "sky/shell/shell.h" | |
| 22 #include "ui/gl/gl_surface_egl.h" | |
| 23 | |
| 24 using base::LazyInstance; | |
| 25 | |
| 26 namespace sky { | |
| 27 namespace shell { | |
| 28 | |
| 29 namespace { | |
| 30 | |
| 31 LazyInstance<scoped_ptr<base::MessageLoop>> g_java_message_loop = | |
| 32 LAZY_INSTANCE_INITIALIZER; | |
| 33 | |
| 34 void InitializeLogging() { | |
| 35 logging::LoggingSettings settings; | |
| 36 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | |
| 37 logging::InitLogging(settings); | |
| 38 // To view log output with IDs and timestamps use "adb logcat -v threadtime". | |
| 39 logging::SetLogItems(false, // Process ID | |
| 40 false, // Thread ID | |
| 41 false, // Timestamp | |
| 42 false); // Tick count | |
| 43 } | |
| 44 | |
| 45 } // namespace | |
| 46 | |
| 47 static void Init(JNIEnv* env, jclass clazz, jobject context) { | |
| 48 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context); | |
| 49 base::android::InitApplicationContext(env, scoped_context); | |
| 50 | |
| 51 base::CommandLine::Init(0, nullptr); | |
| 52 InitializeLogging(); | |
| 53 | |
| 54 g_java_message_loop.Get().reset(new base::MessageLoopForUI); | |
| 55 base::MessageLoopForUI::current()->Start(); | |
| 56 | |
| 57 base::i18n::InitializeICU(); | |
| 58 gfx::GLSurface::InitializeOneOff(); | |
| 59 | |
| 60 Shell::Init(g_java_message_loop.Get()->task_runner()); | |
| 61 } | |
| 62 | |
| 63 bool RegisterSkyMain(JNIEnv* env) { | |
| 64 return RegisterNativesImpl(env); | |
| 65 } | |
| 66 | |
| 67 } // namespace sky | |
| 68 } // namespace mojo | |
| OLD | NEW |