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 "blimp/client/app/android/blimp_library_loader.h" | 5 #include "blimp/client/app/android/blimp_library_loader.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/android/base_jni_onload.h" | 9 #include "base/android/base_jni_onload.h" |
10 #include "base/android/base_jni_registrar.h" | 10 #include "base/android/base_jni_registrar.h" |
11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
12 #include "base/android/library_loader/library_loader_hooks.h" | 12 #include "base/android/library_loader/library_loader_hooks.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "blimp/client/app/android/blimp_app_jni_registrar.h" | 15 #include "blimp/client/app/android/blimp_app_jni_registrar.h" |
16 #include "blimp/client/app/blimp_startup.h" | 16 #include "blimp/client/app/blimp_startup.h" |
17 #include "blimp/client/public/android/blimp_jni_registrar.h" | 17 #include "blimp/client/public/android/blimp_jni_registrar.h" |
18 #include "jni/BlimpLibraryLoader_jni.h" | 18 #include "jni/BlimpLibraryLoader_jni.h" |
19 #include "net/android/net_jni_registrar.h" | 19 #include "net/android/net_jni_registrar.h" |
20 #include "ui/android/ui_android_jni_registrar.h" | 20 #include "ui/android/ui_android_jni_registrar.h" |
21 #include "ui/gl/gl_surface.h" | 21 #include "ui/gl/gl_surface.h" |
22 | 22 |
23 using base::android::JavaParamRef; | |
24 | |
25 namespace { | 23 namespace { |
26 | 24 |
27 bool OnLibrariesLoaded(JNIEnv* env, jclass clazz) { | 25 bool OnLibrariesLoaded(JNIEnv* env, jclass clazz) { |
28 blimp::client::InitializeLogging(); | 26 blimp::client::InitializeLogging(); |
29 return true; | 27 return true; |
30 } | 28 } |
31 | 29 |
32 bool OnJniInitializationComplete() { | 30 bool OnJniInitializationComplete() { |
33 base::android::SetLibraryLoadedHook(&OnLibrariesLoaded); | 31 base::android::SetLibraryLoadedHook(&OnLibrariesLoaded); |
34 return true; | 32 return true; |
(...skipping 16 matching lines...) Expand all Loading... |
51 return false; | 49 return false; |
52 | 50 |
53 return true; | 51 return true; |
54 } | 52 } |
55 | 53 |
56 } // namespace | 54 } // namespace |
57 | 55 |
58 namespace blimp { | 56 namespace blimp { |
59 namespace client { | 57 namespace client { |
60 | 58 |
61 static jboolean StartBlimp(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 59 static jboolean StartBlimp(JNIEnv* env, |
| 60 const base::android::JavaParamRef<jclass>& clazz) { |
62 if (!InitializeMainMessageLoop()) | 61 if (!InitializeMainMessageLoop()) |
63 return false; | 62 return false; |
64 | 63 |
65 base::MessageLoopForUI::current()->Start(); | 64 base::MessageLoopForUI::current()->Start(); |
66 | 65 |
67 return true; | 66 return true; |
68 } | 67 } |
69 | 68 |
70 bool RegisterBlimpLibraryLoaderJni(JNIEnv* env) { | 69 bool RegisterBlimpLibraryLoaderJni(JNIEnv* env) { |
71 return RegisterNativesImpl(env); | 70 return RegisterNativesImpl(env); |
(...skipping 12 matching lines...) Expand all Loading... |
84 // Although we only need to register JNI for base/ and blimp/, this follows | 83 // Although we only need to register JNI for base/ and blimp/, this follows |
85 // the general Chrome for Android pattern, to be future-proof against future | 84 // the general Chrome for Android pattern, to be future-proof against future |
86 // changes to JNI. | 85 // changes to JNI. |
87 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || | 86 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) || |
88 !base::android::OnJNIOnLoadInit(init_callbacks)) { | 87 !base::android::OnJNIOnLoadInit(init_callbacks)) { |
89 return -1; | 88 return -1; |
90 } | 89 } |
91 | 90 |
92 return JNI_VERSION_1_4; | 91 return JNI_VERSION_1_4; |
93 } | 92 } |
OLD | NEW |