OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "sky/shell/sky_main.h" | 5 #include "sky/shell/sky_main.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/i18n/icu_util.h" | 13 #include "base/i18n/icu_util.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
19 #include "base/threading/simple_thread.h" | 19 #include "base/threading/simple_thread.h" |
| 20 #include "bin/eventhandler.h" |
| 21 #include "bin/thread.h" |
20 #include "jni/SkyMain_jni.h" | 22 #include "jni/SkyMain_jni.h" |
21 #include "sky/shell/shell.h" | 23 #include "sky/shell/shell.h" |
22 #include "ui/gl/gl_surface_egl.h" | 24 #include "ui/gl/gl_surface_egl.h" |
23 | 25 |
24 using base::LazyInstance; | 26 using base::LazyInstance; |
25 | 27 |
26 namespace sky { | 28 namespace sky { |
27 namespace shell { | 29 namespace shell { |
28 | 30 |
29 namespace { | 31 namespace { |
(...skipping 14 matching lines...) Expand all Loading... |
44 | 46 |
45 } // namespace | 47 } // namespace |
46 | 48 |
47 static void Init(JNIEnv* env, jclass clazz, jobject context) { | 49 static void Init(JNIEnv* env, jclass clazz, jobject context) { |
48 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context); | 50 base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context); |
49 base::android::InitApplicationContext(env, scoped_context); | 51 base::android::InitApplicationContext(env, scoped_context); |
50 | 52 |
51 base::CommandLine::Init(0, nullptr); | 53 base::CommandLine::Init(0, nullptr); |
52 InitializeLogging(); | 54 InitializeLogging(); |
53 | 55 |
| 56 // Bootstrap 'dart:io' event handler. |
| 57 dart::bin::Thread::InitOnce(); |
| 58 dart::bin::EventHandler::Start(); |
| 59 |
54 g_java_message_loop.Get().reset(new base::MessageLoopForUI); | 60 g_java_message_loop.Get().reset(new base::MessageLoopForUI); |
55 base::MessageLoopForUI::current()->Start(); | 61 base::MessageLoopForUI::current()->Start(); |
56 | 62 |
57 base::i18n::InitializeICU(); | 63 base::i18n::InitializeICU(); |
58 gfx::GLSurface::InitializeOneOff(); | 64 gfx::GLSurface::InitializeOneOff(); |
59 | 65 |
60 Shell::Init(g_java_message_loop.Get()->task_runner()); | 66 Shell::Init(g_java_message_loop.Get()->task_runner()); |
61 } | 67 } |
62 | 68 |
63 bool RegisterSkyMain(JNIEnv* env) { | 69 bool RegisterSkyMain(JNIEnv* env) { |
64 return RegisterNativesImpl(env); | 70 return RegisterNativesImpl(env); |
65 } | 71 } |
66 | 72 |
67 } // namespace sky | 73 } // namespace sky |
68 } // namespace mojo | 74 } // namespace mojo |
OLD | NEW |